top of page

Book Formatting Woes: I figured out the hard stuff so you don’t have to! (Part 2)

Update: This post was written back in 2012, and thankfully things have gotten A LOT easier since then!! (You NO LONGER need a software degree to do this! Kindle finally has a proper formatting tool with actual UX!) But I'm leaving these posts up just in case there's anything that's still helpful in here.


Continuing Part 1 of this post from earlier this week, which covered CreateSpace print formatting tips, I’m just going to dive right in to the Kindle and Smashwords tips…


EBOOK FORMATTING TIPS FOR KINDLE

#1 Advice: Know What You’re Getting Into

I didn’t.  For some reason, I was under the impression that this would be simple.  I have a finished manuscript that’s nicely formatted for print, so I figured one, two, three, upload this baby to the KDP site, and I’m done.  Right?  Wrong.


KDP is very misleading – sure enough, the form is only 6 questions (9 if you count the second page, which you don’t get to until after you have a working .mobi file).  And the most misleading step is #5 Upload Your Book file.  I knew from reading the formatting guidelines that they accept a whole bunch of different file types, but what Amazon doesn’t explain is that these are not all created equally.  The best is a .prc file which already has your .ncx and .opf and images and everything in there.  What is all that?  Read on to find out.

After LOTS of searching online, this is what I found I needed to do:


1. Save my Word .doc manuscript as a Filtered Web Page .htm (NOT .html) and do some cleanup in Notepad (and by some, I mean like 4 hours).  These are the big things that took me a while to figure out:

2. Anchor Tags & Weird Loss of Formatting Bug.  Make sure hyperlink anchor tags (<a href=””></a>) – like those you find around your Table of Contents (autogenerated by Word if you used their built-in TOC generator, or you may be adding this yourself manually) – are always on the outside of the paragraph <p></p> tags they’re linking to.  Otherwise, you get this weird bug in Kindle where after you use a hyperlink, the text loses all formatting.

Update 5/30/13: As I ran through this process again with Shudder, I discovered that something had changed in Amazon’s interpretation of the HTML code, and now when I put the <a> tags on the outside of the <p> on my TOC links, the Kindle would no longer recognize them as hyperlinks.  However, if I did this around the destination links (the chapter titles) as well, I ran into the same loss of formatting bug.  So what I ended up doing was leaving the <a> tags on the inside of the <p> tags on the TOC links, but putting them on the outside of the <p> tags on the chapter titles.  That seemed to get the behavior I wanted.

4. TOC Page Numbers. Delete unnecessary span tags (<span></span>) with page numbers from the TOC code.  Word automatically added this stuff into my TOC, and obviously page numbers are unnecessary on an e-reader.

5. Centering Images. Add image references as needed (you DON’T need to add your cover, since that will be taken care of later – for me, I just had one image, the cover of the second book in the series which I added as a teaser at the end).  If you’re adding images, I found that this code worked well:

Add this class up at the top somewhere (where the other classes are) to help make sure it’s centered properly: p.imgcentered { text-indent: 0; margin: 1em 0 0 0; padding: 0; text-align: center; font-size: 0.8em; } Then add the image reference in the right spot using something like this: <p><img src=”NameOfTheFile.jpg” alt=”Description of Picture” width=”134″ height=”200″ /><br />Caption for Pic, if you want one.</p>(Note that I think I read somewhere that that alt=”” tag is required – I didn’t try it without it, but just be forewarned.)


6. Un-Indenting Paragraphs. If you have paragraphs that aren’t supposed to be indented (for example, first paragraph of a chapter), you’re going to have to manually mark them as such, because Kindle automatically indents all paragraphs whether you want it to or not.  I tried using Word styles and classes in the HTML, but the only thing that worked for me was to manually add the following to the <p> tags on the paragraphs that don’t have indents: style=’text-indent:0in’


7. Monospaced (Courier) Font. This is another one that drove me nuts.  Even the Kindle Publishing Guidelines (sec 3.1.6) say there is a bunch of ways to get Kindle to display the newspaper-like Courier font, but I tried <font face=”courier”>, I tried <pre>, and the only thing that worked for me was adding <tt> tags around paragraphs (<p></p>) where I wanted to use the  monospaced font.


8. Check your formatting by emailing your .htm file to your Kindle.

  1. Find your Kindle’s email address (it’s under the settings somewhere as “Send-to-Kindle Email”), open a new email (from the same email that your Kindle account is registered to), attach the .htm (doesn’t matter what the subject or body or the email contain), and send it.

  2. Amazon will automatically convert it to display on Kindle, and if your wireless is turned on, it will show up there in 2-3 minutes.

  3. Save yourself some time by tweaking your .htm file NOW, instead of doing all the following steps and having to redo everything when you find a formatting error.  (Note that your images will not work.)


9. Use MobiPocket Creator to create the .prc file that you will ultimately upload to KDP.

  1. Start a new MobiPocket project with your formatted .htm file from above

  2. Use MobiPocket’s wizard interface to add the cover, metadata, and guide items (helpful walkthrough on guide items).  This will enable the program to automatically generate 90% of your .opf file.

  3. OPF File. “What is a .opf file?” you might ask.  For some reason, Amazon neglects to address this ABSOLUTELY ESSENTIAL PIECE of your ebook anywhere on their site, so it wasn’t until I did a bunch of digging on the internet that I learned what this was.  It’s called the Open Packaging Format and it’s basically an overall file that tells your Kindle where to find all the stuff it needs to display the book properly, including your .ncx file (more coming on this in a bit), images, all the metadata, the guide items, etc.

  4. Resize any images referenced in the manuscript .htm file to the desired display size and copy the image files into the same folder that your MobiPocket project is in.  (Don’t use MobiPocket’s Add File feature UNLESS you want the image to also display at the very end of your book.)

  5. Manually create a toc.ncx file and copy it into the same folder as the rest of your MobiPocket project

  6. NCX File. Perhaps you’re wondering, “What’s a .ncx file?”  I was wondering the same, and lo and behold, Amazon once again COMPLETELY NEGLECTS TO MENTION THIS CRITICAL PIECE OF YOUR EBOOK anywhere on their site.  Seriously, Amazon, wtf?  I learned from this really helpful guide to making a toc.ncx that it’s called a “Navigation Control file for XML applications” and that it basically tells your Kindle where those little tick marks at the bottom of your screen should go and enables users to jump quickly between chapters.  From a usability standpoint (and if you want your book to look like a “real book”), you need to have this working, so follow the instructions in that post to make yourself a nice toc.ncx file

  7. Use MobiPocket’s Build function, which will create the initial .opf file and .prc file (but you’re not done yet!)

  8. You might hit some errors, so read the build feedback and if there are any warnings, look them up online to try to fix them.  Luckily for me, the only thing I hit was that I had forgotten to copy my image into the same folder, so I don’t really have much experience debugging build issues – sorry!

  9. Now it’s time to tell that .opf file where to find the .ncx file.  Open the folder where your MobiPocket project is stored, right-click the .opf file and choose to open it in Notepad.  (Do NOT edit in MobiPocket or any changes you make will be overwritten).  Then do the following:

    1. Fix the line spacing to make it readable, if need be

    2. Add within the <manifest> tags: <item href=”toc.ncx” id=”ncx” media-type=”application/x-dtbncx+xml” />

    3. Edit the <spine> tag to read: <spine toc=”ncx”>

    4. Save and close the .opf file

  10. Now go back into MobiPocket Creator and Build again to generate an updated .prc file which now includes your .ncx

  11. Again, save yourself some time by testing the file before you move on.  Follow the same steps from #2 above to email the .prc file to your Kindle and test out your .ncx and images and general formatting to make sure it looks good.  If not, go back and edit (either in your .htm file and make a new MobiPocket project, or in the .html file in your MobiPocket folder) BEFORE you go to the next step.

10. Okay, now that you’ve got a good .prc file, you’re ready for KDP.  Login to KDP, fill in your metadata in Steps 1-4, and on Step 5, upload the .prc file that you generated with MobiPocket.

Note that if your book is a series, the only way I could figure out to get the series title to display consistently (e.g., “Stitch (Stitch Trilogy, Book 1)” instead of just “Stitch”) is to manually type that in the title.  I did this everywhere – on CreateSpace, KDP, MobiPocket, Smashwords etc. I’m not sure if that’s necessary or not, but it seems to be working thus far.


That’s it!  Just follow the rest of the steps on KDP to preview the .mobi file for your book, and once you’re happy, follow the rest of the KDP setup process to get that baby out there!

Note that if your previewing turns up issues, you’ll need to repeat this all starting from a new project in Step 2 (or editing the existing .html file in your MobiPocket project and rebuilding).  In case you have to start a new project, remember to save a copy of your .ncx file somewhere safe so that you don’t have to remake it from scratch every time.


EBOOK FORMATTING TIPS FOR SMASHWORDS

(Ugh, yes, there’s more…)


Just when I thought I was done, I went on to Smashwords to investigate what format they needed so that I could get my book on iTunes, B&N, etc.  I expected this to be easy – after all, I had a perfectly formatted, fully-functioning .mobi file from all that work above, so I should be good to go, right?  Nope!


For some reason I thought I’d be able to take my .mobi file and upload at Smashwords and we’d be all set.  Not so.  Smashwords only takes .doc files.  I thought, “Well that’s not too bad – my manuscript is a .doc after all, so I’ll just upload that.”  But then I started reading the Smashwords Style Guide (which is VERY helpful, btw) and realized that the chances of that working were almost nil.


So I tried one idea for a shortcut, which was to open my .htm in Word and save it as a .doc.  Unfortunately, this did not work – it looked like garbage, with random line breaks all over, the styles completely messed up, just unreadable.  So I ended up going with the Nuclear Method.


The Nuclear Method

The Nuclear Method was recommended in the Smashwords Style Guide (Section 5) as the easiest way to clean up all that formatting garbage.  I ended up having to invest another 4 hours here, but in the end I have a version of my book which Smashwords was able to successfully convert into 10 different electronic formats, making it available on virtually any reading device.  For some of these formats the formatting is not quite as good as on my Kindle version, but it’s 95% of the way there and I just decided that that’s going to have to be good enough.


Here’s what you do: Open your Word file with your original (or CreateSpace) manuscript, do CTRL+A to select EVERYTHING, then CTRL+C to copy it all, then open a new Notepad file and do CTRL+V to paste it.  You’ve effectively removed all formatting from your book.  Now you need to repeat the process and copy it back from Notepad into a new Word .doc file.  Do CTRL+A once more to highlight everything, and choose the text style “Normal.”  And now you’re starting from scratch.


The main thing to keep in mind about the Nuclear Method is that it removes EVERYTHING.  That means you’re going to have to manually add back page breaks, all your text styles, extra spacing after paragraphs, even any italicized words THROUGHOUT THE ENTIRE BOOK.  But it was the only thing that worked, so just grin and bear it (or, if you can, get smart and pay someone else to do it for you!  I will next time…)


Here’s a bunch of stuff you need to remember to fix:

  1. ISBN & Smashwords License. Make sure your copyright page is showing the correct ISBN (NOT the same ISBN as your print or Kindle formats – it must have a separate one, which Smashwords will give you for free.  Or you can just leave the ISBN out).  Also remember to include the required Smashwords License Notes:This ebook is licensed for your personal enjoyment only. This ebook may not be re-sold or given away to other people. If you would like to share this book with another person, please purchase an additional copy for each recipient. If you’re reading this book and did not purchase it, or it was not purchased for your use only, then please return to Smashwords.com and purchase your own copy. Thank you for respecting the hard work of this author.

  2. Page Breaks.  Not all output formats respect them, but at least the PDF and Mobi versions do (and possibly others), so add these back in at the end of your front matter pages and chapters.

  3. Un-Indented Paragraphs. Similar to my Kindle experience, I tried making a “First Paragraph” text style which set the indent to 0 or 0.01, but I found that it wasn’t respected in most (any?) of the output formats.  Instead, manually select each paragraph that you don’t want to be indented and change the Paragraph properties to set the First Line Indent to 0.01 (helpful tutorial from Microsoft).

  4. Space Before/After Paragraphs. Don’t use the Enter key to add space before/after paragraphs, as the Smashwords Auto Vetting tool might flag you for doing so and prevent you from publishing your book.  Instead, add extra space before/after paragraphs using Word’s paragraph spacing feature (tips from Microsoft).

  5. Italics/Bold/Etc.. Unfortunately the Nuclear Method kills all your text decorations, so you’ll need to manually add them all back.  I found that it was helpful to use my original/CreateSpace manuscript file to search for italicized words so that I could remember where to add italics (helpful walkthrough on searching for formatting in Word here).

  6. Other Text Styles. I had mixed results using text styles other than Normal in my Smashwords .doc.  The Chapter Header style I created seemed to work well, and some parts of the Newspaper style worked, but for some reason the Front Matter style and the First Paragraph style were ignored completely by most output formats.  I found that my best bet was to manually add any formatting other than Normal to the paragraphs where it was needed.

  7. Hyperlinks. If you include any hyperlinks to websites in your book, make sure they include the http:// – otherwise, they will get nailed by Smashwords’s automated tools.

  8. Rebuild TOC. Yes, you have to rebuild your Table of Contents ONE MORE TIME.

    1. DON’T use Word’s autogenerated one this time.  Instead, manually add bookmarks at each chapter – instructions here.  Smashwords will use this to autogenerate a .ncx file for you.

    2. I found that it was best to put the bookmark BEFORE the chapter header, in the line above if possible.  At first I highlighted the whole chapter title and added the bookmark, which resulted in the actual “jump point” being at the END of the highlighted text, which meant that when I tried this out on an e-reader, it would jump to the right spot but would cut off the title of the chapter, which was disorienting to the reader.  On my second attempt, I put the bookmark on the paragraph right after the page break from the last chapter (above the header) and this seemed to give me the behavior I wanted.

    3. Once you’ve got your bookmarks, retype your TOC (it should probably be there already from when you pasted in from Notepad) and add hyperlinks to each bookmark from the TOC.  See instructions in the Smashwords Style Guide (Section 20).

  9. Preview It. EXCEPT you’re not previewing it, you’re publishing it. What?  You heard me – if you upload this thing to Smashwords, it’s going live right then and there.  I didn’t realize this, and I thought I would just get a preview version like I did on Amazon, and then I hit the submit button and there was Stitch on the homepage of Smashwords.  Oops!

  10. If you’re not ready to publish the book yet, you can quickly go into your Dashboard and Unpublish it, which will pull it from the store, and you can still continue uploading drafts and testing out the various outputs until you get it right.  But be forewarned that the publishing date will forever show as the original one.

Whew!  We’re done.  I sincerely hope this information is helpful to someone out there – it took me a LONG time to figure this all out and document it, so hopefully it will save someone else some time!  Remember to check out Part 1 of this post if you’re looking for CreateSpace print formatting tips.

(NOTE TO READERS: My tips are based on my experience in summer 2012 doing this in Word 2010. Things change quickly in the world of software, so just be advised that my tips may be out of date by the time you get to them…)

Related Posts

See All

Comments


bottom of page