Recently I’ve been going through a lot of people having problems with the new KF8 format for Kindle ebooks. If you upload html, you get font size and face problems on the PaperWhite. If you upload docx or doc, you have indent problems.

Most suggestions for fixing this involve going in and manually editing the html files. You can do that if you know how. I don’t find it that hard, but I used to do typesetting and electronic conversion for a living. If you want an alternative or just don’t feel like fussing around in html (and I don’t), then it’s not that hard to fix these problems if you use a combination of Microsoft Word (Or LibreOffice’s word processor) and Calibre. This will also produce a valid HTML and NCX table of contents. We’re using Word to style the text in basic ways, then we’re using Calibre to strip out the stuff Microsoft puts in that we don’t want and to create a table of contents.

The TLDR (too long didn’t read) version of this guide is style everything in normal except for chapter headings. Put them in Heading 1. Save as filtered html with no spaces in the file name, import to Calibre, set the TOC setting under conversions to H1 so it will automagically make a TOC, then convert. Done.

Also, this guide is for a more or less run of the mill short story, novel or biography or anything that’s a text based book without pictures or charts or anything like that. That covers most of what we write. Wouldn’t work for this guide though as it has all sorts of graphics.

First go to the Calibre Website and install the program. I’ll explain how it works later. It’s available for Windows and Mac.

Now, we need a proper Word file. This may require some “nuclear method” work to clear out formatting that we don’t want and it will require you to use “styles.” First make an extra copy of your manuscript and put it away somewhere in case we screw it up. Always keep a backup! Then open it up in Word.

At the top of the Word window, you will see a bunch of different icons on “the ribbon.” This guide was created with Word 2007. Word 2010 will be similar. Word 2003 won’t be, but you can probably figure it out.

stylesThese are styles and are the key to how you format. They let you set a whole bundle of formatting and apply them at once. “Normal” is the style we are going to put our text into and “Heading 1″ is what we’re going to use for our chapter titles.

Go to the top bar and find the little paragraph symbol icon. If you hover it will say “show/hide.” This will reveal some of the hidden code in a document, most importantly the tabs and end of paragraph marks. It’s also control-* if you like keyboard commands.

showparamarker

We don’t want any tabs. Tabs are evil! The spawn of Satan. If you indented your paragraphs with tabs rather than with styles or the ruler, we need to get rid of them. Control-H brings up the search and replace box. Word’s search functions are incredibly powerful and one of the things they can do is search for paragraph returns (^p) and tabs (^t).

So click control-h and in the top “find what” box type ^p^t and in the bottom “replace with” type ^p Click replace all. Your tabs should be gone. (If you never had any, you don’t need to do this.) Now let’s get rid of double paragraph returns. Top box ^p^p and bottom ^p. (Don’t worry about the paragraphs being too close together, we will go back and fix that with styles.) Finally, typeset books, print or ebook, only need one space after a period. Two spaces in the top box and one in the bottom.

Now we’re going to get rid of any extra formatting.┬áHere’s a trick I learned when I was doing typesetting for a living. In Microsoft Word, the last paragraph return of a document is “special.” (Isn’t everything from Microsoft a little “special?”) If you Select All and format something with a style, you can get very different results than if you select everything except the last paragraph return.

So we want our entire document to be on “normal” style, but instead of selecting all, instead we go to the end and add one extra paragraph return. We turned on the thing to show these, so we could see them. Then we select everything except that last paragraph return and press the button on the ribbon for “Normal” style. This will set line spacing, indents, and justification to match the “normal” style, but it won’t override italics or bold. It’s not the nuclear option, it’s kind of the tactical nuclear option. (The “nuclear option” is a trick of moving something to a text editor so it strips out all formatting, but losing all those italics and putting them back in is a major pain in the posterior. This should do the trick. If it doesn’t, nuke ‘em till they glow.)

Now we need to set up normal as we want it to be.

Right click on “normal” button at the top of the ribbon and select “Modify Style.”

modstyleNothing here is really important. Later in the process we are going to strip out the font so ebook we create will use the default font for the device. At the lower left hand corner is a little button called “format.” This is where the magic happens. While it will strip the font face and size out, most of what’s in this box will survive the conversion to ebook, so it’s where we get to try our best to make it look nice.

paragraphThere are a number of important things here.

See where it says “special” and I’ve selected “First line” and set it at .25″ That’s setting a small indent at the beginning of each paragraph. You might prefer .3 or .5. It’s your book.

See where it says “spacing” and “after” and I’ve set 8 points? That’s going to tuck just a little bit of extra space between our paragraphs, not even a full line worth, but it makes it just a little bit easier to read. Or at least I think so. If you don’t, then don’t do it or set it to be more or less.

If you don’t want indents and instead want block paragraphs with a double space between them, you should set this at something like 24. You shouldn’t use double paragraph returns because some e-readers will just ignore two in a row.

Now hit a bunch of oks and you should see the changes happen automatically to all your text.

Now we want to right click on the “Heading 1″ button. You can set this however you want. Here, size does matter. You probably want your chapter headings to be a little bit bigger than the body text. I’ve also set it so there’s a bunch of space before and after the heading to set off the Chapter title from the text. I even checked a button to make them all caps. How you want your chapter heads is up to you.

h1modifyNow one more thing. We want our chapters to start on a new page so under the paragraph box, click on “Line and Page Breaks” and put a check next to “Page break before.”

pagebreakNow click a bunch of OKs. Nothing should happen because we set the entire document to be “normal” and these changes are for “Heading 1.” Now go find your chapter headings and click anywhere on them and then press the “Heading 1″ button at the top of the ribbon. It should jump into a larger font, centered (or however you set it up) and put a page break before it.

Once we have “normal” applied to the body text and “Heading 1″ to our chapter titles, the big work is done in Word. You can do the same thing in LibreOffice. I’ve tested it, and maybe someday I’ll do another version with those graphics, but not today. You should be able to figure it out.

You can and should also go and fix any other formatting like centering ***’s if you use them for scene breaks or removing the indent in the first paragraph got a chapter or scene.

Here’s a tip. Most indie authors use centered *** to separate scenes. Some other authors use a non-indented paragraph with a double space between it and the previous paragraph. In either case, some epub programs and readers won’t like it if you use a double space. Instead, click on the little arrow at the lower right of the paragraph button on the ribbon and set some extra space before and after them. It’s the same dialog box as when we set up our indents for the normal heading.

parabutton

If your book contains any pictures in the text you want to keep them as simple as possible. Type an extra return to get a blank line and then go to “insert picture.” Do not fiddle with any of the other picture settings with borders or anything else.

Now you’re going to need some “alternative text” that will display on any device that doesn’t show pictures. If you don’t have this alternative text, it will fail epubcheck and you will get rejected from some stores. To do this right click on the book. You’re looking for “alt text.” In Word 2010 it’s under “format picture” and in Word 2007 it’s under “size.” By default this will be the filename of the picture, but epubcheck doesn’t seem to like that so change it to anything. Really, anything. Nobody’s ever going to see it, but epub check will bounce you without it.

Save your document as a word file then go to “save as” a second time and select “filtered html.” Also, and this is very important, pick a single word name for your save. Ie, save as “book.htm” not “the full title.htm” The reason for this is that when we convert to epub, it will use the name of the original file for some internal stuff and if it has spaces, it will fail epub validation.

Now run the Calibre program. The first thing that confuses people about Calibre is that everyone recommends it to convert files, but it doesn’t seem to have options to do that. Calibre’s real purpose is as a library manager, conversions are secondary. So first we need to add a book to our library.

Click on the red “add books” button, then navigate to the htm file you just saved and add it to calibre.

addbook

You’ll see your book appear. Sort of. The title will be the title of the file and the author name will be blank.

nometa

Highlight your title and click on the blue “edit metadata” button.

editmeta

The edit metadata screen will appear.

empty metadata

This is where we fix our title, author name, and add other “metadata. See how I fill it out? You also add your cover here. Click on browse and find your cover and it will import it. You must add a cover here or Amazon may reject your submission. (They aren’t even going to use the cover here, they’re going to stick in whatever you upload at the KDP site, but they seem to require something be there if you upload a mobi.) You should also fill out as much as you can. Put your blurb in the description field and Use the “tags” section for your keywords, separated by a comma, and they will be included in the metadata, which supposedly Kobo and Apple use for their search.

filled metadataClick OK and it will return us and you can see the book’s title and author have changed and the new cover shows on the right.

hasmetaNow we convert to mobi and epub. Click on the brown “convert books button.”

convertNow before we click ok, we need to change a few things. First go to the Page Setup tab and change the output to “kindle.” (I don’t even know if this is necessary, but it’s how I have it set up because I have a kindle so I’m telling you to do the same.)

pagesetupNow click on the Table of Contents button.tocbuttonWe now want to click on the magic wand next to the Level 1 TOC line.

tocpageThis is going to open up a box, use the pull down menu and select H1

toch1Click ok. You will see that it now says //h:h1. H1 is how Word saves “Heading 1″ when you save to filtered html. Remember we put our chapter headings into that style? This is telling calibre that anything in that style should be turned into a chapter heading and put in the Table of Contents.

One last thing, you need to change the output format at the top right. You use mobi for the Amazon store. There’s another amazon format, AZW, do not use this. Use mobi. Select it and click ok and it will grind away for a few moments doing the conversion.

outputformat

Now click on the convert button again. This time change the input format on the left to mobi and the output format to epub and click ok a second time. (Going direct html to epub will result in validation errors if you have any links in the book.)

Now we need to get our books to somewhere we can find them. To do this, click on the “save to disk” button.

savetodiskSelect somewhere to put the books, your desktop or the documents folder. It will copy a folder with all the different formats to that spot.

That’s it. Make sure to download the offline kindle previewer and look at your mobi file. Also validate the epub, mine have worked, but I can’t vouch for what Apple will make of it as they reject files that pass other converters. Upload your mobi to Amazon and your epub everywhere else.

Good luck and please let me know if this works for you!

If you’ve made it to the end, I also offer up some files as examples.

The original Word docx file

The exported html file (right click and save as)

The mobi

The epub

 

 

Changes:

12/26 Added “last paragraph” return selection rather than select all.

12/27 Added instructions to remove tabs, edit pass, added sample files.