fbpx

How to format books for Kindle: Raj Chaudhuri – Guest Post

Introduction

As you know I just published my first book on Kindle. I could not have done it without help from Raj Chaudhuri. Raj is my close friend and a genius on Microsoft platform. I wrote the book in Word and when I converted it to Kindle format it looked horrible. Raj came to the rescue and refined the HTML to ensure it renders properly on Kindle. We realized that this conversion has to be done by hand and it has not been documented properly anywhere. Fragmented, random posts are available but no authoritative guidance available. So I invited Raj to write this post. image

How to create content for Kindle Books

Kindle books are created in a format called AZW, which is a variation of a format called MobiPocket. AZW (or mobi) files are created from HTML source files, and can include images and some formatting. When creating books for Kindle, we need to keep in mind at least two important things about the MobiPocket format:

  1. Mobipocket content is meant to be freely reflowed, to optimally adapt to the screen size. This means that we should not plan a book with rigid formatting requirements. Things like multiple columns, tables, text flowing around images, etc. should be avoided. We should also avoid page numbers, footers and annotations.
  2. The user (rather than the publisher) chooses the font family, font size, margin size, line spacing, etc. to make the reading more comfortable. This means that we should not spend too much time choosing fonts – nor should we differentiate our text using only font family or font size. Any of these things may be unavailable on some devices, or be overridden by a user.

The Kindle Direct Publishing site allows us to upload a zip file containing an html file and supporting media files, and converts it to the AZW format automatically. The HTML file should not be too complex, and can contain some CSS styling. The CSS styles can be defined in a separate stylesheet file, which needs to be included in the zip file. All images used in the HTML file should also be included in the zip file. In general, we should limit the HTML to the following tags: p, div, h1-h9, ol/li, ul/li, img, a, b and i. CSS should be limited to margin, padding, indent and line-height. There are two lines of Amazon Kindle devices: the e-ink line and the Fire series. The e-ink ones are monochrome, and support a limited number of fonts. The Fire series support color, fonts and richer formatting options such as tables. To ensure a uniform experience across devices, we need to watch out for some factors. These are the ones I found.

  1. Use heading styles (h1-h9) and paragraphs mainly. Use div tags sparingly.
  2. Different Kindle devices have different defaults regarding how headings and paragraphs are styled. If we want uniformity, we will have to redefine the styles using CSS. This is particularly true for paragraph indents. Most kindle devices format paragraphs using a first-line indent. We can override this using the following css: p { text-indent: 0 }
  3. The fire devices support color. The e-ink devices display colored images as grayscale, and do it quite well. Some e-ink devices can also display text foreground and background colors as grayscale, but some can’t. So we should not differentiate any of our text content using color only.
  4. Bold and italic work across kindle devices.
  5. The HTML ul tag creates a bulleted list on all kindle devices. By default, text in this list is slightly indented, which is what is usually expected. The ol tag creates a numbered list on all devices except the Kindle DX. This list is also indented by default.
  6. Changing the default fonts will work on the Fire devices, but not on the e-ink ones. It’s generally better to stick with the default fonts, especially for paragraphs. We can change the fonts for the heading if we really need to.

image

A book will turn out better if the HTML is created by hand. But we can use Microsoft Word if we want to. These are the guidelines for using Microsoft Word. Even after using Word, it is a good idea to clean up and refine the HTML manually. There does not seem to be an automated way of doing it.

  1. Do NOT use any of Word’s wonderful formatting tools. Use only Heading styles, bold and italics.
  2. Do not use Word’s bullets and numbering. Write any bulleted or numbered lists as simple paragraphs, and change them later, as described in point 7.
  3. Do not paste images into the Word document. Instead, use the Insert Image command to insert them from files.
  4. Do not leave extra lines between paragraphs. Use Paragraph setting of Space Before and After to get desired spacing.
  5. You can use Word’s Table of Contents feature. Make sure the TOC is updated before the next step.
  6. Start a new topic (Heading 1) on new page. It is better to add the page break manually rather than include it as a part of Heading 1 style definition.
  7. Save the document as “Filtered HTML”. This saves the document and the associated images using minimal HTML. The HTML that Word still generates is still horrible, but this is better that saving as “HTML”.
  8. Edit the HTML using a text editor. Introduce ul and ol tags in places where you need bullets and numbering. Clear out any unneeded formatting or text. In particular, look for   elements and remove them.
  9. Word embeds a style element in the HTML file itself. It defines a number of CSS style classes, most of which we do not need. The ones we do need are as follows:
  10. MsoNormal – Word assigns this class to all paragraphs. We should ideally ensure that this class contains only margin, padding and indent styles, if at all.
  11. MsoToc1 through MsoToc9 – These are classes for the different levels in the table of contents.
  12. In Nitin’s book, we used custom CSS styles for showing Step by Step processes, additional details, pictures (centering) and spacing above and below and Generic learning. Make sure not to rely on color and font type because monochrome devices do not render it either completely or partially.

Publishing the book

Buy the book Building your book for Kindle. Yes it is 2.5 USD it does explain the process step by step. The formatting details mentioned above are sadly missing. That is why we wrote this blog. Building your book for kindle

  1. Login to Kindle Direct Publishing site and sign in.
  2. Create a new book and enter all details
  3. Create a separate book cover file and upload it.
  4. Create a zip file containing the base html file and its related image files folder. If you are using a CSS file, make sure that is a part of the zip file as well.
  5. Upload it to Kindle Direct Publishing
  6. Fill in all the details and wait. After few hours your book should be available in the store

Feedback

Do post your feedback and comments. We will keep updating this post if we learn any more related best practices.

Queries | Comments | Suggestions | Wish list