Formatting Issues when publishing for the Kindle

When I was converting my collection of short stories for the Kindle, I had two formatting issues with the .html file I’d created from MS Word.

The first was with the spacing between chapter (or story) titles and the following text. For some reason, some of them were spaced correctly and some were much closer together than the others. The fix was really simple: I opened the .html file in notepad, did a search for the title in question, and then underneath the code that contained the title inserted the tab <br>. Those who know basic html will know this is a line break, but it brought all the spacings into line for me.

The second problem was a bit more complicated. The .html file had defaulted the paragraph settings so the first line of each one was indented. I didn’t want it to look that way and spent a few hours messing about with it. In the end, I found a section of code in the document that Word had created that looks like this:

p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:””;
margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
mso-fareast-font-family:”Times New Roman”;
mso-fareast-theme-font:minor-fareast;}

I inserted the following line in this section (below the margin-left line): text-indent:0in;

The secondary problem, however, was that Word had applied the MsoNormal class to some paragraphs, but not to all. So whilst that fixed the problem, it didn’t fix it everywhere. So what I then did was to replace all the paragraph tags in the document with the MsoNormal class. To do this, I selected Edit > Replace in notepad and set it to replace <p style= with <p style=MSONormal. This set all the paragraphs to the correct class in the style settings and the indent code was then applied across the whole document.

When I was formatting The Haiku Diary I wanted to ensure that the book had three Haiku per page, regardless of whether it was being viewed on the Kindle, the Kindle DX, or any of the Kindle apps. But by this point I’d made so many changes to the .html that I didn’t want to go back and put page breaks in the Word document and then go through all the other changes again. So instead I trawled through the .html file (again in notepad) and inserted the following line after every third poem: <br clear=all style=’page-break-before:always’>.

I also wanted to indent the date beneath each Haiku and used the following code to do this: <p style=’margin-left:180.0pt;text-indent:250.0pt;line-height:normal’>.

If you’re a web developer or html and CSS expert this will all be second nature to you – you’ll probably know better code than the stuff MS Word auto-generates. But for those of you struggling to find answers to your formatting issues (as I was), I hope this helps.

Advertisements

One thought on “Formatting Issues when publishing for the Kindle

  1. Marion January 30, 2013 / 9:11 pm

    Word is just a nightmare and no matter what you do there’s “stuff” left in the HTML. I found some good advice (online somewhere) about converting the word doc to open office AND then converting to HTML from there. Did the trick. I may just start using ODT for everything. I don’t see any disadvantages.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s