Take pride in your eBook formatting (Part IX)

This is the ninth installment of a series of articles. To read the previous one, please click here

Okay, it is time for me to finally make good on my promise and turn your book’s HTML source file into a proper eBook. All we need is a little software called Calibre that you can download here.

I want to take a brief moment to point out that Calibre is a free software package and I cannot thank its developer Kovid Goyal enough for putting so much time and effort into this program. Not only is he putting all the effort into writing the application and improving it constantly, Kovid is also very active in his support forums and tries to help everyone with problems whenever he can. So, please feel free to support his restless efforts by perhaps donating a few dollars for the cause. You will find a button on his website and maybe you’d even be willing to commit a small amount every time you actually prepare a new book for publication using his software.

All right, now it’s time to get serious. One of the great things about Calibre is that it allows us to build a variety of eBook formats from the one source file we have so carefully crafted.

The first thing we need to do is to add our new book to the Library. Simply click on the “Add books” button in the upper left corner and select your book’s HTML file. A lot of people do not know that you can actually use an HTML file as a book source in Calibre, but as I pointed out, not only is it possible, it is, in fact, the most reliable way to create a predictable output.

Once you have done that you will see the book appear in the top line of the Library listing. It may have a strange name at this point – Calibre uses the HTML file name by default – but we will fix that in a second.

The next step is to edit all of our book’s meta data. Highlight your book in the Library listing and then click on the “Edit metadata” button in the toolbar at the top. You will now see an input form that allows you to insert all the relevant information about your book on the left side. Most of these fields should be self explanatory, though the “Author Sort” line might be confusing. It is used to allow you to use your last name for sorting. So, instead of “Guido Henkel” I would enter “Henkel, Guido” here.

The large “Comments” field at the bottom is used for your product description. Simply enter your whole flap copy here, your synopsis or whatever you want to call your product description.

Moving on to the right side of the input window you will see a block that is called “Available formats.” Currently it includes only a ZIP file, which is a zipped-up version of our HTML source. Do not do anything else in this block. We will get to it at a later stage.

Finally, lets include the cover of the book into the meta data. This is the cover that will be included in the front of your eBook. It is not the cover that is used by distribution channels to list your book! It is the actual cover image inside the final eBook.

I always create 600×800 pixel color versions of the cover for use here. Even though many eBook readers do not support color at this point this is nothing you have to worry about. The device will automatically convert this to a grayscale image for you. Purists may say at this point that you should actually create an optimized grayscale image for inclusion for better quality. For the most part I found this not necessary. While the end result might be a tad better – and I stress might here because eBook readers are still notoriously bad at displaying images in general – and while the file size might be reduced, I found the tradeoffs not worth it. Not only would you have to create separate versions for color and grayscale readers, but with the growing proliferation of color devices, you will make it possible for Kindle readers on the iPad, for example, to enjoy the full color version of your cover. That alone should be reason enough to stick with the color cover.

Select “Browse,” find your cover and make sure it displays properly in the meta data window. We now have all our meta data and it is time to click “OK” to make sure they are saved.

Next, click on the “Convert books” button in the toolbar at the top of the screen. This is where the rubber meets the road – from a technical standpoint. Here you find the modules that actually turn our source HTML file into the various eBook formats. While all the menu entries and names might seem extremely technical to you, I will guide you through here to make things easier to understand, especially since most of the technical parameters are identical regardless of the selected output format. Which reminds me… let’s select an output format.

In the upper right hand corner you will find a drop-down menu allowing you to select the output format you want to build. For our purposes right now, select EPUB, which we will be able to use for the Nook, the Apple store, Kobo, Google Books and other outlets.

On the left side of the input window you will see a column of icons. these icons give us access to the different settings for the ePub compiler. Most of these parameters we will leave untouched as the default settings that Calibre provides are real world common sense settings. In fact, we could already press the “OK” button at the bottom of the window and get a decent eBook out of it.

Perfectionists that we are, however, we want to take things a little bit further.

Click on the “Structure Detection” icon and you will see a series of cryptic-looking XPath instructions. Not to worry…

Calibre uses this section to determine your book’s structure so that it can format it properly. For example, this can be used to create page breaks before a new chapter. In fact, it is the default setting. The reason I am taking you here is because in case you do not want to include page breaks here, you will need to switch it off by selecting “None” from the “Chapter mark” drop-down menu.

Next stop, our table of contents (TOC). Select the “Table of Contents” icon so we can tell Calibre how to automatically build a fully linkable TOC and include it in our eBook.

Since we have been using a special stye in our HTML file to manicure chapter headings, we can now use this style to tell Calibre where each chapter starts.

All we have to do is enter

//h:p[re:test(@class, "chapter", "i")]

in the field for the “Level 1 TOC (XPath Expression)”. It tells Calibre to look for all instances where the style “chapter” is applied and add them to the table of contents. Calibre will automatically use the entire chapter heading text to display in the TOC, which means the entire block of text that is style with the “chapter” style. From my experience that is exactly what we want. If not, you could narrow the selection down further using XPath expressions to drill down further. If you want to learn more about XPath expressions, feel free to check here.

The last step before we build our book is found in the “EPUB Output” section. Select the icon in the left toolbar and you will find a checkbox entry that says “Preserve cover aspect ratio.” Make sure to select this as otherwise your cover will be disproportionally scaled to fill the entire display of any eBook reader. I am not sure why this is not checked by default, but so be it.

That’s it. Click on the “OK” button and you will notice that Calibre is doing some work in the background. It will tell you so with a small animation in the lower right hand corner of the Calibre window.

This will take a second or two, depending on your computer’s speed and the length of your book. But once it is done we are ready to save the finished eBook.

Click on the “Save to disk” icon in the top toolbar and select a location where you want the book to be saved.

Now it is time to take a look how things turned out – it is the big moment. While it is possible in to use Calibre’s viewer, I found that despite the overall quality of Calibre, the viewer is – at the time of this writing – not at all representative for what your eBook really looks and behaves like on a real reader.

For first checks I always use the software versions of the Kindle or the Nook reader or Adobe Digital Editions. These will immediately give you the results you’re looking for, especially since many people use these application to actually read their books on. However, you should always make sure to also load you books onto the actual devices, if possible, to see they behave properly. It is always better to make sure than to make assumptions and extrapolate from a software implementation running on a desktop computer.
When I load an eBook up for the first time, there are usually three things I checked first.

Does the cover display correctly?

Are there proper page breaks before chapters, and do the chapter headings display properly?

Does the book contain a complete and working table of contents?

Once you have made sure these are in order, you should begin to browse the book very carefully from beginning to end. Look particularly for passages where text switches suddenly to italic text. Particularly when have inserted the <i> tags by hand, it can happen all too easily that you accidentally forgot to close the tag properly, or you mistyped it. Only a visual inspection of the book, page by page, will make sure your text is in order, so take a few minutes and go through it.

If there are errors in your source file you will have to go back and edit the HTML file. What is important is that once you have made the changes, you will have to re-import the HTML file back into the Calibre book. In order to do this, click on the “View metadata” button again to bring up the meta data input form.

You will see that the box saying “Available formats” now also includes an EPUB entry. Delete all the entries here, MOBI, EPUB and most importantly the ZIP entry. Simply select them and hit the “Delete” key on your keyboard to get rid of them.

All we have to do now is bring the HTML file back by clicking on the icon with the red book and the plus sign in the right hand corner. Select your corrected HTML file and then go ahead and rebuild your eBook file. Save it and check to make sure the errors have gone.

Once you have confirmed that everything is as it should, it is time to build the other formats. Select MOBI from the drop-down menu in the “Covert books” form. chances are you will not have to change anything else, as the structure and TOC settings format independent, and because MOBI does not require any format specific adjustments. Build the eBook and save it.

Congratulations, you now have proper EPUB and MOBI ebook versions of your book that are virtually guaranteed to be free of the most common formatting errors found in today’s eBooks. To distribute your eBooks, all you need to do is send the .epub or .mobi file to your customers via email, or to upload them to Amazon, Barnes&Noble, or whichever outlet you want to serve. In case you were wondering, the eBook files contain all the graphics and images that are needed, so you will not have to send the JPG images with it. They are safely embedded directly in the files so that they can’t get lost.

I hope I have been able to help you with this series to understand that in order to create quality eBooks it is not only necessary to tackle the problems by their roots, but also that it is not nearly as intimidating a process as one might think.

Building an eBook from the manuscript to the final build can be done well under an hour if you’re familiar with the workflow. In fact, formatting my own “Jason Dark” titles, usually takes me no more than 15 minutes.

Let me know how this series has helped you, and let me also know there are subjects and issues that you’d like discussed in more detail. I’ll definitely see what I can do and highlight these issues in follow-up posts to this series.

In addition, if you wish to hire me to create your eBooks for you, feel free to send me an email.

I’m also hopping over from JK’s blog and this series is awesome! Thanks so much for making it easy to understand. I’m hopping over to check out your books because I love ghost hunting and have written a couple of short stories myself. Looks interesting! Good luck!

Comment by Guido on February 11, 2011 at 6:04 pm

Thanks for the show of support. Like I mentioned in the series, if you have specific questions, feel free to let me know.

Comment by Jason on February 16, 2011 at 6:49 am

Saw your guest post on Konrath’s blog, and he specifically mentioned these posts. Since I’m finishing up my first novel and getting ready to format it, I’m ecstatic to have this information to base that formatting on.

Thank you so much!

Jason

P.S. I also picked up The Heretic based on your review, and am enjoying it immensely, so thanks for that, too!

Comment by A. J. Abbiati on February 21, 2011 at 9:51 am

Hi Guido,

Thanks for the info! Will head out and pick up one of your Dark books in return…

As for suggested topics, I would LOVE to hear about your process from this point forward. Who do you distribute your books with, who gets which formats, any specific recommendations for each seller, marketing, print versions, pricing, etc.

Thanks again…

–Jim

Comment by Guido on February 25, 2011 at 1:49 pm

Jim,

The distribution path is an entirely different subject, of course, and it is highly dependent on the author/publisher and their needs. I might write some time about what I am doing and why I am doing it the way I do.

So many thanks for all this information! I am working on converting a book my wife wrote many years ago, and you have saved me many hours of trial and error. I am looking at the first 2 chapters on my Kindle right now!

I hadn’t put together how easy the formats being based on HTML made it. I have tons of experience with it, so now this suddenly simple.

I followed your instructions for formatting chapter headings, and they show up perfectly in HTML and mobi. But in B&N’s Nook preview, they’re not appearing at all–the chapter number and text are all jammed up to the top of the screen. Any input?

Thanks.

Comment by Guido on March 11, 2011 at 9:13 am

Ed, without taking a look at the actual HTML code you have, it is impossible to say what might be going on. It usually also helps if you download the Nook software reader for your computer so you can actually take a look at your eBook right in there.

Hi Guido,
First off, many thanks for generously sharing your expertise!
I used your instructions and copied and pasted most of your code to format my book for Kindle. It’s a simple book, no images or unusual formatting. Yet when I upload it and look at the preview, I have this one flaw: the left margin has a space between it and the edge (of the box representing the Kindle), but the right margin does not. So it looks like the text is off center. If anything, the left margin is too big, so really, if the whole thing could just get shifted to the left by a few spaces, that would be perfect. I’d be happy to send you the code if that would faciliate your giving me much needed advice on this–I can’t wait to publish and this flaw is a thorn in my side. Thanks for your help!

In the first block of code in part VII of this series, there’s a parameter that reads, “padding: 0.1em”. I changed the 0.1 to 0, and it did the trick.

Hope that helps! I’m sure there’s some reason Guido has that there, but changing the padding was the only way I could get my book to display correctly on my Kindle. I’d be interested to know if there is a reason for it being there!

By the way, thanks for the series, Guido–it was extremely helpful and I’m very happy with the way my first ebook turned out.

Comment by Guido on April 4, 2011 at 3:42 pm

The problem is that the Kindle is not interpreting the padding parameter correctly. Writing “padding: 0.1em;” means that a padding should be applied to ALL four sides of the page. Sadly, the Kindle adds it only to the left side and ignores the others. Hence the problem.

As a followup, I figured out what was going on with my margins: the version of Calibre I’m using doesn’t preserve them correctly, and at least in my experiments, the Nook doesn’t seem to support the “em” definition at all. It will accept “px,” though.

Comment by Guido on April 4, 2011 at 4:02 pm

I guess I’ll have to buy a Nook some time. I have trouble believing that it doesn’t understand em, though. It is the very basis of HTML sizing.

I have a question. I have used your guide to get a non-fiction book with pretty complicated formatting to look great on my Kindle and nook for the PC. I used the ePub and uploaded it to Amazon without a problem (not posted yet, but I am confident).

My question is: how do I get this to Smashwords? They want a .doc file, which seems like a step backwards at this point.

Thanks for all your help!

Comment by Guido on April 14, 2011 at 9:32 pm

It is indeed a step backwards. Everything about Smashwords is a step backwords.

The best way to go about it is probably to start Word and then open your source HTML file from within there. Word can interpret HTML files – it may require setting an import toggle – and the result may be fairly close to what you formatted. Once it is imported properly you should be able to save it as a DOC file.

I’ve never done this because I do not use Word and I also do not do Smashwords because I am completely dissatisfied with the quality of their output – apart from the fact that they generate zero sales and are thus a waste of time – but it should work in theory.

Thank’s Guido. I had to tweak my HTML, but I finally got Word to open it.

I just looked at the Smashwords style guide, and I just want to scream now. I had perfect HTML with CSS and I have to reformat the whole thing again!? I have epub done, and I have to reformat it again!?

Yikes. That’s just too much (for now at least).

Comment by Guido on April 15, 2011 at 4:41 pm

That’s why I keep telling people, forget about Smashwords. They are forcing you to a low quality output.

Guido, thanks for putting this all together and sharing it. Pretty easy to follow and something I”ll be able to use again. You’re very generous.

I had one question for people, Besides finding some weird stuff in my html viewing it in kindle and nook readers that I have to go back and replace (mostly quotation marks), after I ran it through caliber, I didn’t get a TOC. The chapter class was set up OK in html, the chapter headings came thru in the book OK, but no TOC generated from calibre conversion.

Any hints?

Thanks and good luck with the new covers and those nasty ly’s.

Doug

Comment by Guido on April 16, 2011 at 9:18 pm

Did you make sure to enter

//h:p[re:test(@class, “chapter”, “i”)]

in the “Level 1 TOC (XPath Expression)” the way I described above? That should generate the TOC based on your chapter headings.

Guido, I just wanted to say thank you. I am not a technical person (I last used HTML in 1999 and failed the one and only programming class I ever took), but I used your series to produce a really beautifully formatted short story. I don’t mean to brag, but IMO it compares very well to most of the stuff professionally published in my genre.

I almost cried when I got to Smashwords and saw the 85 page style guide… which is what a writer needs to do in order to get .doc to function like your nine part guide

Thanks again!

Comment by Guido on April 21, 2011 at 1:32 pm

Thank you so much for your kind words, Kathleen. I am glad it worked so well for you. As you can certainly tell I am not a fan of Smashwords at all and usually tell people to just abandon it unless there is a really good reason to go through them. since it is possible to cover the major – or what they call “premium” outlets – yourself, why even bother with Smashwords? They force you to create an inferior product.

I’m going through your guide now, it’s very helpful – I was delighted to find that after hearing all about the “dreaded” formatting, it was actually quite straight forward, especially if you have some knowledge of HTML.

I will start formatting my first story on Monday (when I get my final edits back), and I am actually look forward to it!

One quick point – for international users, Smashwords is the only way to get onto B&N, which does make it worthwhile IMHO.

Dave

Comment by Guido on April 22, 2011 at 2:23 pm

That is a valid point. Kobo is also a bit selective as to who they work with, so Smashwords can be helpful there as well.

Comment by Catherine on April 24, 2011 at 5:20 pm

Hi Guido,

I’ve been following this guide religiously while preparing my first book for Kindle. I knew nothing about HTML, and I’ve declared your posts to be the e-book formatting LAW—although I don’t even know you. Thank you for taking the time to publish this information for us “newbs” trying to muddle our way through. I have three issues keeping me from success.

My tidy little HTML shows perfectly in browsers, but when I convert in Calibre something goes amuck. The paragraph indent and margin are not reflected.
p
{
text-indent:1.5em;
margin-bottom:0.5em;
}

Two, where do I stick the image source with the cover.jpg? Anywhere in the ?

And lastly, I’ve got an image that is centered between two paragraphs in chapter 2. It’s an inscription on a charm—read fancy fonts—that is a broken link after the conversion. (I removed the lengthy filepath for this post)

I’d sure appreciate if you could offer me any direction. Thanks.

Comment by Guido on April 24, 2011 at 6:58 pm

Catherine, thank you so much for your kind words. I am glad you found the series helpful.

The location of the cover artwork is irrelevant. Since the cover is included in Calibre, you can browse anywhere on your hard drive to grab it. Calibre remembers the path and will include the image properly in the resulting eBook.

When you include images in your HTML source file, by default the same folder that your HTML file is where you should place your images. You then include them simply using only the filename of the image in the tag. If you wish to have a little more structure, you can place the images in a separate directory and then reference the images as for example.

As for your paragraph formatting. I would have to take a look at the HTML file to see what is going on. If you wish, feel free to send it to me via email (ghenkel (at) jasondarkseries (dot) com)

Comment by Catherine on April 25, 2011 at 7:38 am

Sent!
Thank you so much Guido.

Catherine

Comment by Emily on April 30, 2011 at 4:42 pm

Hello, Mr. Henkel!

Thank you so much for this guide to formatting ebooks. I’m in the process of publishing my first book and I stumbled across your site while searching for a reliable way to create professional-looking ebooks. You’ve laid everything out in a straightforward fashion that makes sense and is very easy to follow.

I have one issue preventing me from complete success.

My html displays perfectly in IE, but when I view it in firefox or use Calibre to convert the html file, all of my title, chapter, and scenebreak formatting disappears. I’m left with regular indented lines of text that are neither centered nor bolded.

I’ve scratched my head over this for the last week and I haven’t been able to figure out what I’m doing wrong.

Any help you could give me regarding this would be greatly appreciated. Thanks!

Comment by Guido on May 1, 2011 at 7:45 pm

Emily,

Your styles look okay. There may be something else that is going on – sometimes it is just a misplaced bracket or. If you wish, feel free to email me your full document and I’ll give it a quick look-over.

I just wanted to take a minute to say THANK YOU for this wonderful guide. It’s very easy to follow, and I used it to create a bullet-point procedure doc to help me with future books. You’ve taken the mystery out of formatting, and my book looks great!

I really don’t know what I would have done without this series. I am completely computer illiterate and was dreading having anything to do with making an ebook. But this was so absolutely helpful! In fact, I’ve told my blog followers that if they’re ever thinking to self-publish, they need to come to your blog first.

Now, that I am soooo close to being done, I do have one issue that seems to be keeping me from perfect completion. I don’t know why, but all of my punctuation is coming up as little boxes when I converted my ebook. Whenever I checked it on the internet as I was writing everything out, there were no problems, but now I can’t seem to get ellipses, parenthesis, or em-dashes. Is there any way you can help me???

Comment by Guido on May 11, 2011 at 3:44 pm

It seems your punctuation marks have not been converted to named entities correctly. Take a look at it or send me the file and I’ll fix it for you.

Comment by Julianna on May 14, 2011 at 12:26 am

Thank you SO MUCH for publishing this guide! The only part I found at all challenging was some of the search and replace – in particular, I’ve located the ellipse symbol and tried to replace three periods with it using search/replace in MS Word (which I assume is what you are saying I should do in your example), but Word says there are no triple periods in the doc I created (and I deliberately created them just to test this so I know they are there), hence it thinks there’s nothing to replace. Any suggestions (this is on a PC)? I also wonder if you could address special characters like umlauts, as you warn that using the numerical codes for special characters is hazardous in your example with quotation marks, but I’m not aware of non-numerical HTML-accepted code for, example, umlaut a’s and i’s? Many thanks again! I’ll definitely be purchasing at least one of your books – the least I can do for such very useful advice and all your time and trouble writing it up for us. Plus I feel sure I’ll enjoy reading it.

Comment by Guido on May 14, 2011 at 10:05 am

I am sorry to say but Word is about the dumbest software ever written because a lot of people have the same problem you describe. The best way is to do the search and replace in a different software, such as Textmate, JEdit or Notepad+++

As for the umlauts, there are named entities for those as well. ä, for example becomes &auml; ü becomes &uuml; and so forth.

Guido, many thanks for your great work. I learned a lot. I followed your formatting guide almost to the letter.

In the end, Calibre and Mobipocket did a terrible job of my html. Calibre would not recognise any style at all from my stylesheet in the head. I did not try an external style sheet.

The good news was that the Amazon Kindle grinder on upload handled it superbly with almost perfect reproduction — the exact same html that Calibre (latest version) would not.

I’m guessing there is something in the style sheet that I’m missing that Kindle has accommodated that Calibre has not. In any case, I’m in good shape.

BTW, I used EditPad Pro v7 to build the text from Word (and then Dreamweaver). This new version of EditPad has a great html named entity converter that instantly converts all of Word’s rules, quotes etc.

Thanks again.

Comment by Guido on June 8, 2011 at 5:15 pm

Paul,

I’m kind of curious to find out why you had these problems with Calibre. Id there a chance you could email me your HTML file?

Comment by J. Tanner on June 14, 2011 at 1:11 am

Guido, thanks for the great resource. I hit a couple snags along the way but I’ll leave those until I’m sure they’re not user error.

For the moment I have one question that’s more curiousity. I downloaded samples of two of your books to see how the TOC gets formatted by using Calibre vs hand-formatting it for Kindle. Neither book has a TOC at all on the Kindle Viewer. Do your books really not use the method described, or is there some issue with them displaying?

Comment by Guido on June 14, 2011 at 7:16 am

Some of my books do not have TOCs, that is correct. Because my stories are not chaptered, TOCs would not make a lot of sense. However, for completeness sake I have begun to include a minimal TOC in most of them these days.

Comment by J. Tanner on June 14, 2011 at 8:53 am

Gotcha. I checked Demon’s Night, Curse of Kali and Dr. Prometheus before giving up. If that matches your expectations, you’re all good. (Just passing it along in case there’s some issue you’re unaware of.)

I just want to say first, thank you so much for creating this fantastic blog on formatting books for Kindle and Barnes & Noble, it was incredibly helpful.

I do want the people reading this however to note that Smashwords should also be used as a portal for publishing despite what you may hear here. I use it exclusively to purchase indie books as I own a Kobo. I have yet to have any issue with any item I have purchased through them as far as quality goes. The Smashwords guide, although somewhat long, is not difficult to follow and if you do exactly what it suggests you should have no issues. Remember that Kindles and Nooks are not the only E-Readers on the market and Smashwords distributes to Apple, Sony and Scroll Motion (which supports a number of smartphones). These could someday take over the ebook market.

(Sorry, I hope I didn’t hijack your blog Guido)

Comment by Guido on June 20, 2011 at 2:05 pm

Sorry, but I could not disagree more. Smashwords has absolutely no value for me. I can see foreign authors use it to get on channels that are denied to them otherwise but why so many US authors put up with the Smashword bologna, I don’t understand.

The output quality they deliver is simply crap. It doesn’t work properly on half the platforms they claim to support and it reduces your document to a bare minimum on all others.

The Style Guide works, sure, but only because it abstracts you document to the barest possible minimum. You could just as well upload a TXT file without any formatting. As soon as you do even the most trivial formatting, their Meat Grinder freaks out and either breaks your eBook or vomits up some kind of error message – which by the way has nothing to do with the real problem as a rule of thumb.

As for Apple , and the other outlets, I don’t need Smashwords for that. I am doing all my distribution directly where it counts. And for outlets like Scroll Motion? I’ve never even heard of them, so why would I care?

The other complaint I have with Smashwords is that I have yet to receive a single payment from them! I listed books on their channel for 10 months or so before I took all my books off, and have never been paid.

That is my opinion on Smashwords in a nutshell – anyone can take it for what they want – and it does not even take into consideration that Smashwords has an amateur cache to me. I honestly would not want to tell people to look up my stuff on Smashwords. It’s like saying, hey, check out my techno thriller in the kid’s aisle at Walmart. No one takes that seriously.

Comment by Mike McIntyre on July 1, 2011 at 11:17 am

Thank you for this guide. I’ve stared at it for the last week. Part of my problem is a pre-Intel Mac that doesn’t support various editing/programming software; and stone-age search and replace functionality on my 2004 Word for Mac. Also, as simple as HTML sounds, it’s Greek to me. I like following directions, but I apparently need twice as many as everyone else (e.g., Place your cursor in the upper lefthand corner of your document; now type the following…). I’m probably someone who would benefit from a video tutorial, and I guess I should also read a book on HTML.

At any rate, after a lot of experimentation, I’ve been able to use some of your tips to come up with vastly improved ebooks. But, and I know you won’t like this, I used Word (and a “save as” function) and Calibre to accomplish this. First off, I was able to follow your instructions for replacing straight quotes with curly ones. I added page breaks after chapters (something I did not know about before). I also made my chapter titles bigger and in bold font. When I emailed this Word doc to my Kindle, some of the indenting was off. So I then saved the Word doc as a filtered web page; or in the case of my Mac, I saved it as a Web Page, then clicked the tab called “save only display information.” I then took this .htm file, loaded it into an older version of Calibre that works with my Mac, and followed your instructions, adding a 600×800 version of my cover. When I emailed the resulting mobi file to my Kindle, it came out looking perfect–cover, indents, bold, font, everything!

The one drawback about this method is that I don’t have a table of contents. Someday, when I acquire at least a basic understanding of HTML and some better hardware/software, I will come back to your guide and make more improvements. But for now, the new versions are so much better than the ones currently for sale, I’m inclined to run with them.

I have a couple questions about Calibre:
1. Why fill out the metadata–title, author, ISBN, etc–in the Calibre application if Amazon KDP requires you to enter that info when you publish anyway? If I fill it out in Calibre AND KDP, does it mess things up?
2. The folder that Calibre created after it built my ebook contains four files, each with a different extension (jpg, mobi, opf and zip). The only one I upload to KDP is the mobi, right, or do I upload all four?

Thanks again for your very helpful tutorial!

Comment by Guido on July 6, 2011 at 11:15 am

Mike,

I am glad to hear the tutorial has been helpful to you and that you have been able to get solid results out of it.

Think of the meta-data that go into Calibre as fallback data. While every distribution outlet will ask you to enter the data also, these are used for their online search engine, etc. The data inside the book itself will help organize books on your ebook reader, for example, and give you additional information. This information may not be displayed at this time but as technology progresses, chances are that one day the information will be used.

As for the files in the folder, yes, you only upload the .mobi file to Amazon. The other files are included more for reference and archival purposes.

First of all, thank you so much for this detailed guide. I bookmarked it and plan to come back to it for future e-book formatting. I know that e-books will become increasingly sophisticated as time goes by, as will e-readers. It is a good thing to have a stable way to ensure that formatting works. I love the possibilities, as I want to turn some of my basic e-books into visual feasts for the eyes. I appreciate what you have offered here and know it is great information for anyone who wants to format an elegant e-book.

That said, I have two quibbles with your assumptions. First of all, I can appreciate what you are offering only because I took a foundational HTML class and have been learning Adobe software in classes for the last six months. HTML is logical and I was surprised at how easy and empowering it is. But it is not realistic to say that anyone can learn this easily in 30 minutes. You discount all the years you have spent learning the basics of the computer, and learning to think with programming logic. For those of us who are not as tech savvy, even looking at the first example of HTML can be head spinning. It’s taken a step-by-step instructor-led environment for me to even begin to understand code. I know I’m a beginner, and I plan to take the next level HTML class when it is offered, as there is so much more to learn. It will take me many hours of practice and trial and error to apply this knowledge to my e-books. It will be worth it, and I will be able to do this much more quickly after learning on the first one. I will be referring to your article as I learn, but it will take me much longer to do it and not as quickly or easiy as you suggest.

Second, I have had only positive experiences with Smashwords, including increasing royalty payments. I published my first e-book in 2009 with them, and received my first royalty payment of $34.53 in July of 2010. My last quarterly royalty was for $424.66. My books are non-fiction, which has not reached the heights in sales that fiction has, but is growing. Smashwords formatting guide helped me prepare something decent for that stage of the e-book infrastructure, and also helped me format something decent for Amazon, and actually laid a foundation for my understanding of how your formatting can take me the next level. No, Smashwords does not offer the elegant level of formatting you recommend, but it means that I can get my e-books out at a level that gets me started, with the skills I already possess (word processing). Of course I’ll be improving my e-books, and I won’t just depend on Smashwords. Over 20,000 people have downloaded my free e-book from Smashwords, Apple, Barnes & Noble, Amazon, Sony, Kobo, and Diesel in the last year, and that would never have happened without Smashwords. It’s exciting to watch it all evolve.

The infrastructure is evolving, so I want to take advantage of all opportunities to publish and distribute my e-books. A company one has never heard of today might be a major player tomorrow. A primitive format in the developmental stages of an industry might still have value even as more elegant formatting evolves.

Thank you for showing me another way to improve my e-books.

Comment by BKS on July 9, 2011 at 7:28 am

Thank you for the information. You clarified issues and techniques that had stumped me and , almost, made me give up plans for epubing my work. Thanks, again.

Well I managed to make an ebook… somewhat. There’s a couple of small issues buggin me.

I can’t seem to get a title page to appear correctly in that it would appear as such on its own page and centered:

Title
Author

I’ve tried using h1, h2, and page break commands but it doesn’t show up correctly in the final epub document.

Other than that, not bad for a first try.

I’ve also been doing some further reading and most people suggest having mimetype, containers, and all other kind of files included with zips and such. Do you not do that for your books?

Comment by Guido on July 22, 2011 at 4:13 pm

Adam,

The approach would really depend on what you would like the comic book to look like. The important thing to remember is that currently text cannot overlay images in e-books and text can also not float around images in e-books. While some readers support it with a bit of trickery at this point, it is not compatible with the majority of e-book readers.

Therefore, there only solution is really to have an images and then text underneath, like a caption.

I do not recommend usage of h1 or h2 tags, as described in my tutorial. They often have unwanted side effects that can be a little hard to manage.

To create a centered title, simply create a separate style for it, declaring font size etc along with centering. margin-top allows you to move it further down ion the page. Then put your title in the HTML part, kind of like this

<p class=”title”><span class=”centered”>THIS IS MY BOOK</span></p>

I’m not sure why anyone would recommend adding mime info etc in ZIP files. What do you do with ZIP files anyway? They probably mean the actual ePub file. Yes, that information is in there but it is automatically generated by Calibre and I do not have to worry about that at all.

I use <br/> occasionally to create a very controlled and tightly spaced empty line break – especially in centered paragraphs where I would have to includ ethe centering tags with every line otherwise.

I also use <p>&nbsp;</p> on occasion when I need some space but the occasion doesn’t warrant creating an entirely new style for it. As a rule of thumb I try to avoid them but sometimes it really is the easiest and most convenient way to create a line break.

Comment by bmagna on August 2, 2011 at 12:40 pm

Thanks for your response, Guido. Again, this guide has been extremely helpful. With my first book, I used someone else’s template and then gummed around with the html until it looked right (the equivalent of duct tape and chicken wire, really). I never considered that what looked right on the Kindle might show up screwy on another device. I’m now in the process of redoing the formatting on the book and creating a clean template that I can use on future projects.

Thanks and best,
Brad

Comment by Guido on August 2, 2011 at 12:57 pm

Feel free to ask me if you have any questions or problems.

Comment by lgifford on August 3, 2011 at 9:14 am

Hi Guido – First, thank you very much for your very helpful guide. Unlike the others, I’m struggling with the html, though, and since I haven’t tinkered with html since the late 1990s, I’m having a little trouble.
For instance, this, in the styles:

in the ‘Detect chapters at (XPath expression):’ field, and this dialogue already has

//*[name()=’h1′ or name()=’h2′]

in the ‘Insert page breaks before (XPath expression):’ field. This doesn’t help.

Comment by Guido on August 3, 2011 at 11:51 am

In the “Structure” enter //h:p[re:test(@class, “chapter”, “i”)] and set the “Chapter marks” entry to “none”

Combined with the “Table of Contents” setting of //h:p[re:test(@class, “chapter”, “i”)] that does the trick for me.

Comment by lgifford on August 3, 2011 at 1:46 pm

It does – thanks, Guido.

Comment by lgifford on August 4, 2011 at 3:22 am

Guido, I’m having a strange little problem today that didn’t happen yesterday. I searched-and-replaced for all the apostrophes in Word, making sure that they were correctly curly.
But today TextMate refuses to recognise them when I try to search-and-replace ‘ for ‘
(Incidentally, how do I tell TextMate which are left-hand quotes and which right-hand quotes?)

Comment by lgifford on August 4, 2011 at 7:50 am

Guido – I solved the search-and-replace problem: you have to paste in the search item into the ‘Find’ field, rather than typing it in, in TextMate.

But meanwhile, the contents list is still proving distinctly buggy. Today I started practising on a new file. I couldn’t get the contents list to show, most of the time (though it was accessible through the Go menu), but some of the time it would turn up at the end of the book, or one item on the list would turn up.

I can (I think) get the contents list to show by checking the item ‘Put generated Table of Contents at start of book instead of end’ in the MOBI Output section of the Convert Books dialogue, but this puts the table of contents after the cover but before the title page, which looks a little strange.

Comment by Guido on August 4, 2011 at 10:14 am

I never put the table of contents in the front of the book. It is archaic, a relic of print books where people would use the front of the book to quickly go and find where they want to get to. You don’t do this in e-books any more. Instead you use the navigational menus. And since no one “reads” a table of contents, it only makes sense to put it in the back of the book here it is out of the way and does not interfere with free reading samples, which are usually culled from the front of the book.

Comment by lgifford on August 4, 2011 at 12:48 pm

Good sense. Whatever, I now seem to have two sets of contents, at the beginning and at the end, but while my title, author name and chapter headings look grand on testing the file as a webpage, when I make a .mobi the title, author name and chapter headings are the same size as the rest of the text.

Comment by lgifford on August 4, 2011 at 12:57 pm

Oh, and there are great yawning gaps between the paragraphs. I wish I could take the .mobi of something like The Hunger Games, which is beautifully formatted, and see how the html was set up.

Comment by Guido on August 4, 2011 at 1:06 pm

The text size problems stem from issues in the software Kindle reader. It looks differently on the actual device.

As for the spacing that is controlled through your paragraph styling, just as I describe in the tutorial.

Comment by lgifford on August 4, 2011 at 2:45 pm

You mean this?

[CODE]
p
{
text-indent: 1.5em;
margin-bottom: 0.2em;
}
[/CODE]

That’s in there. I can’t see any difference, having gone over the code line by line, between one that works and one that doesn’t.

Comment by Guido on August 4, 2011 at 2:52 pm

I would have to look at your full code to determine why you have the spacing issue. If you wish, I can format the e-book for you. Here is a link where you can find some pricing information for my services – http://guidohenkel.com/ebook-services/

Comment by lgifford on August 4, 2011 at 2:55 pm

A very kind offer.

Comment by Don Grant on August 11, 2011 at 2:33 pm

First let me say thls is awesome, you have saved us a lot of headaches and time, thank you.
Only issue we had was with iBook on Apple. Seems cant use the tags in Calibre metadata and the TOC had to be built in Sigil with H headings.
When we went from Calibre epub to ibook we had the following error message
ERRORITMS-9000 “Unmanifested file found:9780983186823 .epub/META-INF/calibre_bookmark.txt” at Book
ERRORITMS9000:”DemiseoftheSoccerMoms_iBook_0804011_split_029.html(19):
unkonwn element “ii” from namespace “http:/www/w3/org/1999/xhtml”” at Book

But by leaving out tags and TOC from Calibre and building TOC in Sigil book loaded fine

Comment by Guido on August 11, 2011 at 2:43 pm

Without seeing the actual code that is being generated it is hard to say what is going wrong there. It looks, however, as if a tag had been accidentally misspelled, as “” is not a valid HTML tag.
It is most definitely not the meta tags in Calibre. I am using them in every single book I format without any problems. The problem is more likely Sigil, creating an incompatible output file, but again, without seeing the actual file it is really all just guess-work.

Comment by Don Grant on August 11, 2011 at 7:56 pm

Interesting. I would agree except our first attempt was without Sigil and that is where error message occurred. Could it be because we were updating a book already on ibook and error was on their part. Not a big deal but at least if happens again I know how to correct it

Comment by BKS on August 14, 2011 at 11:50 am

Your series is greatly appreciated. I had beaten my head against the “conversion wall” until I was about to give up. Many thanks.

I need to center some full page illustrations in my ebook – at the begining of each chapter. How would that code look like?

I saw that there are several Kindle books out, that are practically scanned versions of old, illustrated books – antique children’s books for example. It includes the possibility of zooming in and looking at detail – which I was told was only actually possible with iBooks. I am glad the person, who told me that, was wrong on this point. But how would I actually program this? And is there anything I need to be careful about when it comes to the zoom-in/zoom-out?

Thanks in advance, Guido!

Comment by Guido on August 19, 2011 at 10:45 am

Centering images is explained in the tutorial somewhere in conjunction with the little pinstripe vignettes.

As for images that can be zoomed, to the best of my knowledge that is not possible on the Kindle – at least not in the mobi or ePub format. Even on the iPad it cannot be done using a regular ePub file format. Can you name a book that has this feature? I am pretty sure these will be programmed apps and not ebooks per se.

yes, I saw the info on how to center images in the tutorial. I was just not sure if full page illustrations are handled the same, or what size one would take for it, considering the zooming.

I bought a book in the German Kindle Store that is called “Der Struwwelpeter, oder lustige Geschichten und drollige Bilder” for 99cents. It is based on an old book that I know from childhood – the pages seem to be scanned it. And I can zoom right into the images.

Point is only, that I use an iPad with an Kindle app. I do not own a Kindle myself, so I cannot check how things look there. Unfortunately.

If you wanted to include a full page image into your ebook – as huge as possible – what size would you take?
I really hope this is not a totally stupid question with an obvious answer, but I am kinda stuck on it. It would be totally nice if you could help me out here.
Thanks.

Comment by Guido on August 19, 2011 at 1:41 pm

I’ll grab that book and take a look. I wonder if it’s actually the Wilhelm Busch version of the book. I’ll have to check it out.

Anyway, if you want the best results, make the images 600×870 pixels. That is the full displayable area on a Kindle and also looks good on an iPad.

To be more precise: I need to center not only full page illustrations, also some text (just single sentences). But not only horizontally, but also vertically.
As if having a Chapter Title standing all alone in the middle of an otherwise empty page. (using pagebreak)
Is that possible?

Thanks for the size. Wow … that is awfully small!!!
I am pretty sure the images in the book I have are larger. It even carries a note that it is “optimized for larger screens”.

I can give you the link for the book, if you want. There is another version out, for 9,99. I bought the 99cent version specifically to check out how they did the images … It had a look inside option, that the expensive one did not have.

Then I would need to work around with another centered image … An image with white space on top or a large margin. Dang.

Comment by Guido on August 19, 2011 at 1:58 pm

Including white space in the image won’t help you – you could do that with a CSS style easily.

The problem is that every display is different and you will not know how much space to include. A Kindle device has a different screen than a Kindle reader on the iPad, which has a different screen size than a Kindle reader on an iPhone, which has a different screen size than Kindle software on a PC where users can adjust the window to any size they wish.

That is the reason why it is not possible to vertically align content. The environment is simply too unpredictable and HTML/CSS has no support for it.

As for larger images, you can make them larger, of course, it is your call, but keep in mind that large images create larger e-book files, which will take longer to download. In addition, Amazon will charge you for that download filesize of you book is priced above $2.99

Comment by Guido on August 19, 2011 at 2:03 pm

I got the book and I’m running it in the Kindle reader here but I see nothing about zoomable-images. What exactly are you referring to and how do you zoom those images?

Yes, I understood I cannot center vertically. I just wanted to make sure that the objekt is not glued to the top page, thus the (stupid idea) with the larger image – obviously there are better ways of doing this …

Normally I would not bother about this, but just with this one book it matters a bit.

Hmmm … I made screenshots of the 100% display on my mac screens with Kindle app. Images are smaller than I thought. No zooming possible there, either. Looks unprofessional with the different sized images next to each other, but … ok.

I checked on some sizes:
662×827
610X851
636X851
well, you SEE in the layout that the images of the scanned pages have different sizes, but looks terrible. I assume the 9,99 book is better layouted.

I can only zoom right in on the iPad, not on my normal screen. So that is probably why the images appear to be bigger. They are not much larger in size than the number you mentioned above.

Getting one of your books now to reimburse you for your investment (smile).

Comment by Guido on August 19, 2011 at 3:08 pm

The zooming seems to be an iPad reader feature and is not part of the actual ebook. Whenever the iPad has to scale down an image to display it, because the original file was larger than the display allows, it would probably let you zoom in so you can see the original size image.

As I said, that is not an e-book feature. It’s a feature of the iPad software.

Hi Guido. Sorry to bother you again (though I rather suspected I might need to be in touch again at this point!). I have completed the formatting of my partner’s epic poem (the search-&-replace process you suggested (to include span tags) worked a treat).
I’m now trying to work out how to add more than a single file to Calibre, for conversion. You’ve said in a previous post that your trial use of a separate CSS file was successful, but I can’t find instructions for adding more than a single “your new book” file (apart from the cover, of course). What’s more, Alex’s book consists of a central narrative poem, and 30-odd additional poems which – at the moment at least – are separate files, linked at relevant points by a href tags. (A quick look at the excerpt on his website might explain this more clearly than I can.)
So, there are those 30-odd files, plus a stylesheet, to incorporate into the bundle. Can you tell me – is this going to be possible? and if it is, could you indicate how I should go about it?
Many, many thanks if you can help.
Jane

Comment by Guido on August 28, 2011 at 11:08 am

You will have to put them all in one file – something you should have done from the beginning, probably, because it would have made your processing a lot easier and smoother.

Thanks, Guido. I really appreciate your responding so quickly.
So, just to confirm, the CSS will need to go into the head section?
And I’ll need to include all the linked poems at the end, where they will look as if they are just added as further pages after the main narrative?
Hopefully I can still use links within the narrative so the reader can hop to the relevant poem and then get back to where they were?

Comment by Guido on August 29, 2011 at 1:00 am

The CSS portion goes into the HEAD section, yes.

As for the poems, I am sorry, but I am not following what you are saying. What are linked poems? Are you referring to a Table of Contents? If that is the case you might find this blog post that I wrote earlier this week interesting.

In essence, all your source goes into one file. First the HEAD section, then the BODY section containing all your text. With the exception of images, you do not want to have any additional external files.

Once you do that, Calibre can automatically build a table of contents for you so you do not have to worry about linking the poems. Calibre can do all that work for you.

Oh dear, sorry, Guido. I fear this is becoming boring for you and for anyone else who might be tuning in here. I really don’t want to monopolise things.
Thanks for the link to your recent blog post – I had read it, and Alex and I had decided that his poem doesn’t need a TOC. To try to clarify: he has written an epic-length thriller poem (no chapter breaks), and at intervals there is a link away to other (short) poems which, for example, elaborate on the character currently being introduced. The reader is then taken back to the point they left in the main narrative. This works fine on the extract which appears on his website, and he has written the book on the assumption that ebooks are able to replicate the effect.
So I’m here on the technical side, trying to make it happen. Whether it will work in practice remains to be seen. I have all fingers and toes tightly crossed!
I’m going away now to leave you in peace, and work on putting everything into a single file. I may be some time, as someone once famously said…

Comment by Guido on August 29, 2011 at 11:44 am

You can easily link away from the main text into a poem and then link back. Yes, that is possible, but perhaps the more pertinent question is, should it? I would spend some time to very seriously think about if this linking was born out of necessity on the website or if that is truly how you guys want the narrative to flow – with links – or if it would not be better to actually embed the poems in the text.

First of all, thank you for saving my sanity. Even with your step by step guide, this was not an easy process for me. Without this guide, I believe it would have been impossible.

My TOC still doesn’t show up in the actual doc, you have to click the ebook menu for it. But I think I’m okay with that. My main question is, how do I include clickable links within my book? Links to my blog, other ebooks I have for sale, etc.?

Sorry if this has already been addressed. I tried to go through all the comments, but I might have missed it.

Thanks again!
Sarah Elisabeth

Comment by Guido on August 29, 2011 at 2:47 pm

Links are create using anchor tags. The code below, for example, will link to the front page of my blog.

When I pull the finished book up in Nook, the title and byline are nicely placed, etc., but they look just like Chapter heads, both the same size, no matter what numbers I put in. What am I doing wrong?

I followed all this diligently but all my ‘ and , turned into ? What went wrong?

Comment by Guido on October 4, 2011 at 4:15 pm

Sounds like your special characters have either not been converted into named entities or that they have been messed up while copying from one app into another one. At which step in the process did they turn from quotes into question marks?

Thanks for replying. I really appreciate this and this guide. The ? happened when I turned it into and epub, but on reflection, I realised that I hadn’t changed them into named enties because I didn’t quite understand how to do it. I was using notepad and it didn’t have the function you mentioned. Do I find and replace all the ” with the corresponding names you gave?

Comment by Guido on October 5, 2011 at 5:10 pm

Yes, exactly. In part six of this tutorial I have the most common ones listed.

I worked it out. I left off the ; at the end of the code. I didn’t realise it was part of it. It’s been fun, though I have a headache. Now I just have to work out how to make that nice heading go into the centre.

Comment by Guido on October 5, 2011 at 10:14 pm

Feel free to send me the file via email. I’ll be happy to take a look.

Thanks for all this Guido, now my book looks better than a lot of the ones I buy.

Comment by Guido on October 6, 2011 at 4:00 pm

You have no idea how happy that makes me. Thank you so much.

Comment by Ian on November 1, 2011 at 5:09 am

Hi guys,

Are there any alternatives to Microsoft Word. Word is a horrible piece of software in my opinion. Talk about over complicating and having a mind of its own.

Any takers?

Thanks
Ian

Comment by Guido on November 1, 2011 at 9:41 am

It depends on your platform. I’m on a Mac and Apple’s Pages is the perfect word processor for me.
However, if you’re a writer ,you may also consider something like Scrivener. It is not a word processor per se but a specialist software for writer -http://www.literatureandlatte.com/scrivener.php
I’ve written all of my books in Scrivener and for me it is the best and most well-rounded writing software on the market.

Comment by SolidZane on November 3, 2011 at 1:00 pm

Wow… I clicked over from ywriter at the suggestion of the creator. I’m nowhere near ready to publish, but I read through every page and I really like what you have to say. I will definitely be bookmarking and returning when the time comes to finish my book. Thanks for all the help!

After being pointed here by David Gaughran’s ‘Let’s Get Digital’ publication, I used the whole series of guides to put my illustrated book on to the Kindle. A few hiccups along the way as it was all new to me, like, after dowloading a text editor I needed to update my version of java and also download some plugins (e.g. XML etc…). Also I had to tell Calibre what code to expect (i.e. Cp1252) by going to Preferences, Advanced, Plugins, File by Type Plugins, HTML to ZIP.

To be honest, without this guide I would have been completely lost. Another huge thank you from me.

Thanks for an excellent series of articles. I am reasonably competent at HTML, so with your guidance I was able to sort out all the small problems that I had. In particular, replacing the italics with tags gave me some problems, because I had several consecutive paragraphs in italics, and the system didn’t like that. But it’s sorted.
The only problem I have is that having put everything into Calibre, it is not showing chapter headings correctly. I am confident that the HTML is correct (I used both p styles and span styles) and it works fine in Mobi. So I don’t want to change the HTML if that will damage the Mobi version. Should I have two versions of HTML – only for epub with just the span class, and one for Mobi with the p class?
Thanks for your help.
Rachel

Comment by Guido on November 10, 2011 at 9:43 am

One version should cover both formats. That’s how I work a lot, so there are no real compatibility issues. If you have your HTML tagged with p and span tags, you should be fine across both platforms.
The problem may just be the Calibre viewer. I’ve never really used it because when I started using Calibre the viewer was not working properly. To preview ePub versions I always use Adobe’s Digital Editions (http://www.adobe.com/products/digitaleditions/) which is available for free and seems to be the most reliable ePub viewer I have been able to find.

Hi – thanks for the prompt response. I did that, and it doesn’t work (but it’s fine in Kindle!). Maybe I’ll just do it again and see if it works better. But in the Adobe Digital Editions it won’t link to chapters (but will page through) and the heading style for the Chapters isn’t right – but all fine in Kindle (which I did after the epub version. How odd!)

Thanks for your help, though – much appreciated. If you have any brainwaves, please let me know.

Rachel

Comment by Guido on November 11, 2011 at 9:32 am

Rachel, feel free to email me your HTML file and I’ll be happy to take a quick look at it.

It’s really kind of you to offer – but I thought I should try again before giving up and potentially wasting your time. I solved it by first separating the pages in Sigil. I had tried this previously, but couldn’t find how to preserve the cover aspect ratio which looked awful in Adobe. In the end, I put the HTML into Sigil (without the cover page) and then put this into Calibre, where I added the cover page.
I have one remaining issue. I can’t get it to show my Title page or my Copyright page (or Acknowledgement page) in the table of contents. They have H3 headings (which I have checked are included in the XPath expression) – but they just don’t show. I added semantics to start with (in Sigil – I don’t think you can do that in Calibre?) and thought that was the problem. But I’ve removed the semantics, reproduced the TOC (which is fine in Sigil) but still no joy.
Any suggestions? You really are being amazingly helpful!
Rachel

Comment by Guido on November 12, 2011 at 9:43 am

The Sigil steps seems horribly extraneous. It should not be necessary. If you format your HTML correctly, Calibre will be the only software you will need to do everything you are trying to do.

It is unfortunately impossible for me to determine what might be the problem without taking a look at the HTML file.

However, the cover does not go into the HTML file, actually. It is part of the meta-data. It also doesn’t need a TOC entry, because all software and devices I’ve seen have a “jump to the Beginning” kind of navigational menu entry that takes you there.

I am not sure why you would want the copyright page to be included in the TOC, but that is a matter of taste, naturally. Nonetheless, it should not be a problem at all.

Sorry I can’t be more helpful from afar.

Comment by Ron on November 12, 2011 at 4:40 pm

What a great series! Thanks to you, I’ve taken the plunge and began finishing a few book ideas.

I was able to get an experimental book formatted and displayed on my Kindle One and my Nook 1st Edition. The Kindle shows the table of contents, but the Nook doesn’t. I made sure that //h:p[re:test(@class, “chapter”, “i”)] was in Level 1 setting for both MOBI and EPUB conversion in Calibre (version 0.8.26). Am I missing something else?

Thanks again for this great series on formatting!

Comment by Guido on November 12, 2011 at 7:57 pm

Hard to say. I would double-check the ePub file in something like Adobe Digital Editions to see if the TOC shows up there.

Comment by Ron on November 13, 2011 at 4:24 pm

The TOC showed up on the left side bar, but not in the document itself. Is this correct? Perhaps I’m confusing the TOC display with the way Kindle shows it as part of the document.

Comment by Ron on November 13, 2011 at 4:27 pm

As a side question, how does copyrighting work when submitting a book to Amazon, or Barnes and Noble? Are there procedures that you take to copyright your books before releasing them to the public for purchase?

Comment by Guido on November 13, 2011 at 5:03 pm

Ron, that is exactly how it should be. In the digital age we no longer have TOCs in the front of the book as part of the content, they way it was in the print age. These days, TOCs are part of the meta-data, that are accessed through the software’s menus.

As for copyright, no you do not have to do anything. Your work is automatically copyrighted the moment you type the words in your computer. You can register your copyrights officially with the government (http://www.copyright.gov/help/faq/faq-register.html) but that will only do you good if you truly intend to legally defend your rights and sure for damages sometime in the future.
Regardless, however, you can register this at any time, even after you already published your works.

Guido – you have been amazingly helpful. I do know that in theory it shouldn’t be necessary to go via Sigil – but it has no problems with the HTML, and nor did the Mobi version. It was only the chapter headings, but I’ve sorted it all out now, and the Kindle version is launched! Thank you so much for your help.

The only remaining puzzle is that having done all this wonderful work, I then started to look in detail at Smashwords so that I could upload to different formats – and they only accept Word documents! So all that wonderful formatting (and unnecessary faffing about) has been a bit of a waste.

I presume other people have been able to use their epub versions, so I don’t know what I’m missing here!

I am looking at the test files in iBooks and Kindle and they are BEAUTIFUL! So much better than what I usually get, when I buy a book. It hurts to think that I will need to make a doc for Smashwords – because being in Germany, this is the only way to get onto some of the platforms.

Thanks again, Guido. I am mentioning you in the aknowledgemends!

As you are spoiling us here, I dare to ask one more question. It would just be a nice to have, nothing essential.

With the TOC as you defined it for us, I only get links if I actually define a title for the chapter – and I would love to have something different for the Impressum, while still making it show up in the TOC.

My chapters start with a large top margin and bold 2em font, which looks a bit extreme for the Impressum, where I usually only have a small logo (.png) on the top of the page and write the necessary data below. I normally do not even write “Impressum” – even if that is what should show up in the TOC.

Could you think of an easy way to do this?

Thanks, Guido

Comment by Guido on December 10, 2011 at 11:20 pm

You can always create a separate style that is invisilbe. That way you can have a description in it that will appear in the TOC but will not be visible on the actual page.
p.TOConly
{
visibility:hidden;
display: none;
}

Insert these TOConly-style paragraphs in the book at those points where you want the TOC entry to point to.

Now you will have to tell Calibre to include these paragraphs when building the TOC by changing the “Table of Contents” setting to

I just checked, Guido, and unfortunately the “invisible” styles are in fact included in the TOC but also still appearing in the text – although thankfully I can assign a different style. At first I thought it might just be the preview, but I went the whole way and tested the finished epub and mobi files.

I centered them now, just so it does not look too weird in case I do not get to make them disappear. Other than that I just had to include the pagebreak.

ok … I actually included the code in the body for “Weitere Titel”, but it is not showing.

Comment by Guido on December 12, 2011 at 4:09 pm

You must be doing something wrong. I’ve been using this technique for many books and it works just fine for me. In order to post code and make the tags visible, use the < entity instead of the less-than sign to open a tag, like this

well, I centered it because I could not make it disappear …
And I cannot figure out where my mistake lies.

Comment by Guido on December 12, 2011 at 4:54 pm

Send me your HTML file by email real quick.

Comment by Colleen on December 14, 2011 at 11:44 am

Hi Guido,
let me add my thanks also. I have to admit, I wanted to format the easy way via Word’s filtered html and Mobipocket but once I saw the code generated, I quickly changed my mind. So between your guide, Elizabeth Castro’s HTML with XHTML and CSS book and a brief stop in Amazon’s Kindle Publishing Guidelines pdf to check supported HTML tags, I coded the CSS in Dreamweaver CS5 and ran it through Calibre then checked it in the Kindle Reader for PC. Unfortunately my double quotes and em-dashes were missing. Then I ran the html document through Mobipocket and everything was there with one exception – the main title was not larger despite the style. Should I just leave it then and upload to Kindle or try to figure out where I went wrong with Calibre and the coding? Does it matter whether one uses Calibre or Mobipocket if you do your own CSS? Thanks.

Comment by Guido on December 14, 2011 at 11:54 am

I am not really that familiar with Mobipocket, so I do not know how it would affect your styles, if at all.

Comment by Colleen on December 14, 2011 at 12:21 pm

What I don’t get is why the document looks fine when put through Mobipocket but have missing double quotes and em dashes in Calibre. But thanks.

Comment by Colleen on December 17, 2011 at 2:14 pm

In case someone else is having the same problem… What I ended up doing was a copy-and-replace with the same bit of HTML for em-dashes and quotes, again in Dreamweaver. For whatever reason, that did the trick and the result looks fine in both Mobi and Calibre. Go figure

Comment by Ron Nash on December 30, 2011 at 11:04 am

Hello Guido,
Rather than learnijng this HTML language, my friend, a computer tech, ask me the following question. Why can’t I writed my e-book in word, do all editing chapter heads and such and then save it not as a document, but a .pdf file and upload it that way. He said it should appear the same way you are teaching with HTML. It would be a file that would open on an e-reader. He said that any time you download an e-book it automatically comes as a pdf file. Is this the straigt of it, or do I need to learn the HTML programming language.
Thanks, for your help and response to my post.
Sincerely,
Ron Nash

Comment by Guido on December 31, 2011 at 11:56 am

Ron, while many eBook readers can read PDF files, it is not a good choice for eBooks. PDF files are not free-flowing documents that are necessary to create the best possible presentation on these devices. What you want is an eBook that adjusts to different display sizes and capabilities. PDF does not do that. In addition, PDF support on devices is very spotty. There are many PDF features that these devices cannot display, or display incorrectly, creating garbled output.
If you do not wish to learn HTML, you can always hire someone like myself to do the eBook formatting for you – http://guidohenkel.com/ebook-services/

I’m about to embark on my first ebook, and glad I read this before just following the info on Amazon’s website about using Word.

The book at the moment is handwritten so before I begin copying it into the computer, I wanted to ask a question which I haven’t seen answered in the comments (apologies if I have missed it though).

What software/workflow would you recommend I follow?

I am proficient in html and have access to Pages, Word, Dreamweaver and InDesign.

I was tempted to use Dreamweaver or text edit to avoid some of the ‘search and replace’ stuff, but obviously I then lose out from the auto-checking features of one of the word processors.

I would love to know what you think.
Thanks again,
Best regards
Dave

Comment by Guido on January 8, 2012 at 9:52 am

From the software options you listed, Pages would be my choice. It is lean and mean and has everything you need to get your book to the manuscript stage.

Comment by David D on January 9, 2012 at 2:39 am

Hello Guido,
I’ve really enjoyed your guide – it has been a huge help for creating my ebook, thanks.
I do have a question, though.
I am producing a novel which is non-fiction and makes use of a few literary quotes (eg. a Bible quote). Because of this I am ‘double indenting’. In other words I like to block the quote in italics with broader margins on the left and right to set it apart from a usual paragraph. So, I have the usual style for the document, but then have the quotes indented even further.
The code looks like this:
p {
text-indent: 1.5em;
margin-bottom: 0.3em;
text-align: justify;
}

In a web browser this appears fine and I get my desired result (ie. 4.5em left and right margins).
Unfortunately Kindle is not recognising the margins and is only suppressing the usual 1.5 text-indent (by setting to 0em), while correctly using italics on that particular block of text.
In short, it seems as though you cannot set the margins within the ereader (in this case Kindle/Mobi) as it only seems to recognise the ‘text-indent’ style when formatting paragraphs.
Do you have experience with this? Is this correct?

Thanks for your help
David

Comment by Guido on January 9, 2012 at 7:53 am

The Kindle has various flaws when it comes to margins. For example it cannot do right margins or padding at all. In addition an indentation of 4.5em will take you probably to the middle of the page on the Kindle because em-calculations on the Kindle are not working properly and are at least twice, if not three times, as wide as they should be. Other than that, indentation should work. I’ve been using it myself on various occasions to set apart quotes.

Comment by David D on January 11, 2012 at 10:24 pm

Hello again,

In calibre there are 3 options (among others) for doing the Kindle/Mobi output: Kindle, Kindle DX, and Kindle Fire. Ideally, what should we be uploading to Amazon?

Thanks
David

Comment by Guido on January 12, 2012 at 11:05 pm

I always use the “Default Output Profile.” To be honest, I have no idea what the other ones do.

Comment by Josh Irving on January 16, 2012 at 9:38 am

Hello Guido,

Thanks for all your help. Just one more question

2. November 8, 2004

I put that in pre tags, hope that’s right!

It doesn’t seem to work, I tried using span type chapters and it doesn’t work (I changed the code “//h:p[re:test(@class, “chapter”, “i”)]
” to @span but it didn’t work.

So I’m trying to make the date above smaller separately from the chapter number preceding it.

Am I on the right track here? Or is the P class tag overriding it?

Thanks,

Comment by Josh Irving on January 16, 2012 at 9:40 am

Added <p>

Hello Guido,

Thanks for all your help. Just one more question

<p>p class=”chapter”>2. November 8, 2004

I put that in pre tags, hope that’s right!

It doesn’t seem to work, I tried using span type chapters and it doesn’t work (I changed the code “//h:p[re:test(@class, “chapter”, “i”)]
” to @span but it didn’t work.

So I’m trying to make the date above smaller separately from the chapter number preceding it.

Thanks for the guide. Another solution to the TOC problem above is to put //* in the ‘Detect chapters at (XPath expression)’ field in the Structure Detection section.

As this has taken half a morning to figure out it would be great if you could amend your blog entry for other readers. It appears to happen because Calibre inserts it’s own line of input in that field, in my case: //*[((name()=’h1′ or name()=’h2′) and re:test(., ‘\s*((chapter|book|section|part)\s+)|((prolog|prologue|epilogue)(\s+|$))’, ‘i’)) or @class = ‘chapter’].

Tested this twice with the output html from your tutes.

The other things that seem to be missing from the guide is page break info (unless I’m missing something) and how to force the TOC to the front. I know you don’t like that, but some do.

Actually just looked it up on the Calibre forum: “If you want a TOC at a particular location in your document text, create one by hand. So we strongly recommend that you leave the default as it is, i.e. with the metadata TOC at the end of the book.”

Actually if I’d just read the line before: “When converting to MOBI, calibre detects the metadata TOC in the input document and generates an end-of-file TOC in the output MOBI file. You can turn this off by an option in the MOBI Output settings. You can also tell calibre whether to put it and the start or the end of the book via an option in the MOBI Output settings.”

Thanks for the guide, Guido. I used it, with slight alterations. (I prefer the more modern em tag to the i tag, for example.)

The resulting HTML file produced a better EPUB than I could figure out how to make on Sigil, with the latest editions I could use on my outdated PowerPC Mac. (Note that both Calibre and Sigil have updated editions I can’t use.)

Unfortunately, though I converted everything into the HTML entities as you suggested (though I usually prefer using the numbers), the special characters did not display properly when I converted either the ZIP or the EPUB to a MOBI file with my edition of Calibre.

Also, when I tried saving the EPUB file to disk, it saved it as 3 separate files. It looks like I can delete the other two, but I found that odd, since by all accounts I’ve found, Calibre shouldn’t do that. (Yes, I’m hitting “Save to Disk,” not “Send to Device.”

Comment by Guido on January 18, 2012 at 10:11 pm

The named entities are unrelated to Calibre and should display correctly either way. If they don’t I am assuming you did something wrong. Load the HTML file up in a web browser and see how it behaves there.

Calibre always saves multiple files – four in the most current version. It saves the eBook file, but in addition to it also saves the cover as a separate file, along with a meta-data OPF file and a ZIP file. You can ignore all these, except the respective MOBI or EPUB files, which contain the actual eBook.

Comment by Tarin on January 23, 2012 at 11:07 am

Hi Guido, I am back again and you are awesome, I hope you are well boss, things seem to be working well, but I am stuck on something, again. Do I have to add code to include the front cover of the book and if so where abouts exactly do I put the code in the code style sheet thingy?(yes very technical I know :-P)

Comment by Guido on January 23, 2012 at 11:52 am

If you are using Calibre to build your final eBook, no you do not have to code the cover into the ebook. Calibre will automatically add the cover you are seeing in your meta-data screen into the eBook.

Comment by Marcia Smith on January 27, 2012 at 8:27 pm

I’m very frustrated and disheartened. I’ve been working on getting a short story up on Kindle for longer than I care to admit. After trying it through Mobi to Kindlegen your blog was recommended to me. While I know a little html it looked quite daunting but I dug in.

I did customize the styles and made some h ones of my own because of how I want my story to look.

It looks GREAT on web browser. (And everything worked there) In Calibre after much trail and error and re uploading I got the TOC to work by using your chapter class display none code. I did this because not every place I wanted included is a chapter per say. One prob right away in the Calibre viewer was it took all my centered headings and moved them stage left.

It very much seems that Calibre takes our hard work, overrides it and pays no attention to our CSS style sheet. Still this was the closest I’ve ever come so I decided to look at it in Kindle previewer. There, all the text of where I put the hidden chapter marks showed up!!!
And the recurring problem I’ve had all along of the inside cover image (600 x 800) keeps running of the page on the right and bottom. And it said I had no TOC or correction it said I had no NCX file and the TOC which did properly list them did not work at all.
Why is this so hard? Kindle makes it sound easy.

Now I think I have to get rid of the hidden chapter display none code and go back and redo everything as an h tag and use that in Calibre. But I still can’t figure out why all my centered text keeps getting moved to the left. Is it Calibre? I do not want spaces between my paragraphs so I reset that there.

None of the links work in Kindle previewer however I believe I read that they won’t work there.
Ugh!

Comment by Marcia Smith on January 27, 2012 at 8:46 pm

*Not just my centered headings. My centered text, too.

Comment by Guido on January 27, 2012 at 10:55 pm

I am not quite sure why it isn’t working. There could be many causes for this. Calibre doesn’t really do anything to your styles and settings. I simply takes them and transfers them, so the issue has to be in your HTML/CSS source already. If you email me your stuff I’ll be happy to take a look real quick.

Almost completed my Dad’s books. Thank you so much for the brilliant tutorial and your help!

Incidentally I just found out that you can save the chapter TOC settings in
Preferences / conversion / common options, so now all you have to do is open the Convert Books tab and close it again immediately. Nice, they must have been listening to you

Here is another happy user of your blog. My gosh, thank you for this. You really are heroic in your help. MY QUESTION IS:

When I change [ellipses, en dashes, em dashes, smart quotes, and single smart quotes] as per your recommendation to [&hellip, &mdash, &ndash, “ &rdquo, ‘ and &rsquo] they appear in the book as &hellip, &mdash, &ndash, “ &rdquo, ‘ and &rsquo. For example,

&hellipI think Emily Brontë&rsquos sister, Charlotte, would say about Gothic Spring, &ldquoWhether it is right or advisable to create characters like Victorine, I do not know. I scarcely think it is.&rdquo &ndashDayna Hubenthal, author of the novel, &ldquoPersephone&rsquos Seeds&rdquo

YOU ANSWERED IT LIKE THIS: Actually, looking over your sample code again, I can se the problem right there. You are missing semi-colons.

The entities you have, like &hellip are incorrect. They need to be … with the semicolon at the end. &rdquo needs to be ” and so forth.

I also see that you have the word “Brontë” in your text. You will have to change the accented character also. It will have to become “Brontë”

That should fix the problem. Guido

Guido, you are an angel. Thank you so much for your generosity and your help. I will definitely buy one of your books. Any one with this kind of clarity of thought, will be a compelling writer. Very appreciative, dayna

Hi there! I was pointed at your guide by the romance author Courtney Milan, and wanted to pop in and thank you for the very clear, easy to follow steps. I’m a techie, and a Mac user, and I already had Calibre–so I’m pretty sure I’ll be able to take care of everything you’ve described here.

In my mobi file, I get lovely caps for the first few words at the top of the chapter, as I want. On my epub file, looking at it on NookStudy on my Mac, I don’t get the caps. Here’s the command I used: Text you want in caps case

Any ideas why I’m not getting it on Nook? Otherwise everything worked great!

Sorry, me again, just saw that the command didn’t show up properly when my first comment posted. Let’s try this:

Comment by Guido on February 17, 2012 at 11:59 pm

You won’t be able to post code directly. You will have to change the opening bracket of each tag to an entity, like this for example.

&lt;p class=”test”>

Comment by Guido on February 18, 2012 at 12:02 am

A quick word regarding the Nook software reader. I would not recommend this for anyone to use. The Nook reader software is broken and buggy beyond belief and comprehension. It does not render your eBook in any way that is even remotely close to what it actually looks.

I recommend using Adobe Digital Editions instead, which is available for free and a much more compatible ePub reader.

Dear Guido, this has been great help. Thank you so much for sharing. It works brilliantly, and I’ve just decided to enlist your services for my next big project – the least I can do to pay you back in some way!

Feel free to delete my string of comments and corrections and only leave those that are pertinent to your readers!

Comment by Guido on February 18, 2012 at 10:09 am

The font-variant property is not something that is generally supported by eBooks currently. While it works in some software and devices, it does nto work on others because it is not part of the traditional MOBI and EPUB specs. Only the latest incarnations of eBook formats support features such as this.
You are using an incompatible/undocumented feature and therefore get unpredictable behavior.

Hello
Fantastic tutorial. Really got me into CSS.
I only have one problem, every time I check my work on the Kindle Previewer, it never recognizes the table of contents.
NCX View works
But it says “Table Of Contents Missing”
Any ideas?
Again, wonderful tutorial.

Comment by Guido on February 22, 2012 at 10:05 am

Evidently, the TOC has not been build properly in Calibre. Have you made sure to set your parameters properly in the “Table of Contents” section of the “Convert eBook” dialog of Calibre?

Hello
Thanks
It was on the TOC of Calibre that I hadn’t checked a box, the first box, which is Force Calibre to make the TOC.
I do have the TOC now, Amazon website previewer, Adobe, my Kindle, and Calibre all show TOC, but the Amazon Previewer on my laptop still says Missing TOC.

Have noticed that, when you use
p
{
text-indent: 1.5em;
margin-bottom: 0.2em;
}
This indents everything, including images and Chapter Headings.
So, when I come to centering Images and Headings, they are 1.5em too far across the screen.
How can I correct this, so that only the text has been indented across, and the images and heading are not, but are correctly centered.

Thank you SO much for this tutorial!! I really appreciate the time it took you to write it up for us. It has been invaluable to me. You have my kind gratitude.

Comment by Shawn on March 6, 2012 at 7:44 am

Guido,

Thank you for the excellent formatting guide.
I am just beginning to look at self publishing and without any formal training, am finding it all quite a challenge including using monsters such as OoWriter! However I am amazed how much useful information people like you and others freely provide, for the use and joy of all.
I wish you all the best in your endevours and I shall keep an eye on your most informative blog from time to time.

Thanks so much for creating the software AND a tutorial! wow, you invested a lot of time and effort and caring into providing FREE tools to people who need free stuff the most: starving artistes! I really appreciate the fact you’ve kept Calibre free. I’ve just released my first book and will learn how to use Calibre to make the conversions the best they can be. Once I sell a few, I’ll definitely come back to donate to your cause. We have to support one another, right?

In the meantime, all I can offer is a tiny bit of proofreading. At the top of this page, the 9th and last installment, you wrote:

This is the eighth installment of a series of articles. To read the previous one, please click here

I suspect you did a copy/paste from the previous page (that’s what I’d do!) and then just forgot to change “eighth” to “ninth.”

Thanks again for supporting us Indie Authors with your quality tools.

How are you at Twitter APIs? haha, I’ve been approaching Twitter tool developers asking for a tool to filter OUT by list — that is, rather than including in my view of Twitter everyone who matches a string, I’d like to EXCLUDE from my view of Twitter everyone who matches a string (and I’d like to make the string either a list I’ve created or a search string). That is, filter out my list of X and see my stream with just “everyone except X people.” Two developers so far have said they are trying to work on something already. One from Ireland said it should be ready by end of summer. I am but one of MANY Indie Authors who’d like to filter my stream to see it without all of the fellow Indie Authors I’ve reciprocate-followed. I also heard from non-authors who’d like that tool. I’ve asked the Twitterverse at large probably once every other month for over a year I keep hoping! So do others

Well, you’re doing an outstanding job! I just got the software installed and am trying to fix my book so Amazon will make it look nice instead of like crap. The ePub from Smashwords’s Meatgrinder actually looked okay, but Amazon’s conversion process totally ruined my book’s layout/formatting. All the paragraphs run together which is probably as easy as one little CSS fix and I’ll be done…but I’ll still let Calibre do it for me

And I’ll still donate a bit of thank you for writing these lovely tutorials because you pointed out how to do stuff I understand and would even have known if I had ever thought of it but it would never (forex) have occurred to me to use “invisible” attirbute to make a graphics chapter heading still work as a source for TOC generation! Awesome sauce with a cherry on top!

What an absolutely thorough and fantastic guide in every sense, I really wish I had found this before!

I have spent many frustrated hours attempting to bring my unruly formatting under control and whilst I did finally manage a presentable format, I was still left with so many niggles that refused all my attempts at being put straight.

Brilliant set of articles and I shall certainly recommend them to anyone I read or hear of struggling with similar issues.

This guide has been an absolute lifesaver. I’ve managed to get everything exactly how I want in my ebook, but I’m having one final issue.

When I load the finished ebook onto my kindle, it opens to Chapter 33, instead of the first page. I’m not sure if this is an issue with my HTML or an issue with Calibre. Any suggestions would be appreciated.

Comment by AnnikaHowells on May 6, 2012 at 4:44 am

Never mind. Figured it out. Just suffered a moment of panicked stupidity. Crisis averted! Thanks anyway!

Thank you very much for this amazing guide. I used your advice (as well as some other tips from around the web) to create an ebook version of a series of blog posts.

I’m having a weird display problem with the mobi version of the ebook: The ebook has endnotes, with the links in each endnote back to the original text. For 2 of the 13 endnotes, when I jump back to the text from the note, the first line of text on the kindle screen starts with a bit of code like:

p height=”1em” width=”0pt”>

This happens on a regular Kindle and in the “Kindle Previewer” app for Mac but not in the Kindle apps for iOS or Mac.

Any idea what could be causing this?

TIA

Comment by Guido on June 3, 2012 at 9:44 am

Hard to tell from a distance. I would have to see the actual HTML code for all of this.

I emailed you the files. I’d appreciate any time you can spend on this.

Comment by Larry on June 5, 2012 at 2:51 pm

Is your series Take pride in your eBook formatting available as an ebook? It would be useful to have as a resource on an ebook reader.

Comment by Guido on June 5, 2012 at 2:57 pm

No, I am afraid it is not at this time. I worked on an eBook version some time ago but have stopped working on it, as I could not make the time.

Comment by Carmen Grau on July 10, 2012 at 12:38 am

Guido, thanks a lot for this guide. I have followed all the steps and after two days of trial and error I’m happy with the results except for two things. The first one is that I can’t see any page breaks when I view the book on Calibre or the Kindle app on my computer. I included the page break command on the paragraph chapter, like this:

Then, on calibre, am I supposed to click on “none” chapter mark on the Structure Detection? I’ve done this but still, it doesn’t work.

The other problem I have is with special characters. I replaced all the mdash, ellipsis, etc. on Word, like you explained. Then on Notepad++ I found and replaced all the special characters for á, é, í, ó, ¿, ¡, etc (I write in Spanish). This worked. I also replaced the dashes, quotes and apostrophes with their corresponding name tags, but this didn’t work. On the browser and calibre viewer they appear as &mdash, &ldquot, &rdquot, &apos, and &euro. What am I doing wrong?

Thanks in advance and sorry if you have already answered these questions. I’ve gone through the others’ comments but didn’t find the answers I was looking for.

Comment by Carmen Grau on July 10, 2012 at 7:18 pm

I figured out what was wrong with the mdash, etc. I was missing the semi-colon. Sorry about that… I did find a comment by someone else here with the same problem. I still have the page break problem, though. Help please.

Comment by Dan Scheffler on August 14, 2012 at 10:28 am

Hi Guido

I have formatted my book and it looks great, thanks very much! One hitch: the photos I have in the text show up in the preview mode of Calibre, but not on my Kindle when I load it. The cover shows up on the Kindle – perfectly. Here is an example of a description for one of the pics:

Could you please help?

Comment by Guido on August 14, 2012 at 10:31 am

You may have the path wrong for the images.

Comment by Gary on August 21, 2012 at 1:45 am

Thank you very much for the tutorial. It’s been fantastic and my manuscript looks perfect.

The only thing I’m wondering about is how to get my table of contents centered on the page? Calibre put it in perfectly, but it’s all left aligned.

Any help is appreciated. Thanks.

Comment by Gary on August 21, 2012 at 5:48 am

Sorry for a second comment, but I was just wondering if you knew how to create a start location for the “beginning” of the book when people download it? I’m talking about a .MOBI file for Kindle.

At the moment it just opens at the table of contents instead of Chapter 1.

I have put my table of contents at the front, as per Amazon’s request. I’ve thought long and hard about the pros and cons and decided I want it at the front.

Comment by emp on August 22, 2012 at 12:51 am

Hi Guido,

Thanks so much for this online guide. It’s been very helpful.

I have a few questions that I seem to be having a problem with:

1. For some reason the Table of Contents isn’t generating for me. I input what you say into the field but when I open the file it’s not there. I’m not sure if there’s other stuff I have to add in those fields?

2. How do I create page breaks in HTML for non-chapters, like About the Author, Copyright, etc? Right now the dedication looks like it’s right about Chapter One.

3. Is there a way to create spaces between certain paragraphs? (For example: I have my author page, which I’m not indenting, and then a line after that I have info on website, etc–I would like a space between those two but writing isn’t doing anything.)

Thanks for any help on this stuff!

Comment by Jon Westcot on September 13, 2012 at 11:25 pm

Hi Guido:

A couple of questions arose today, which I shared with JW Manus. She was stumped, so I thought I’d ask you.

First, do you know where the epub file derives its notion of “page” from? I load my document and the created epub claims it has 410 pages. I do know it has 187,000+ words, so it may be that the page count is just a function of word count divided by an average word-count-per-page value.

Second, at “page” 56 and at page counts that are multiples of 56, the renderer (in my case, both a Nook Tablet and the Nook-for-PC software) force an odd page break where none should exist.

Third, when using your schema of adding an HTML to Calibre, how does one also add in image references? I could not seem to find a way to accomplish this.

Fourth, when using Calibre to generate TOC, is there any way to also have this inserted into the document? I could do it by hand if necessary, but I don’t have a clue where to start.

Thanks, and sorry this got so long!

Comment by Paul on October 5, 2012 at 12:08 pm

Guido,

I read your full article very carefully and am thankful for time time you took to write this all out. Thanks for all your time.

I’ve read that there are some byte size restrictions in epub files so that individual html files can only be a certain size. I know that size is pretty big and does NOT include images so for the most books, it’s not an issue. So my question is this:

After doing all your things and then exporting out of Calibre, does it separate each chapter into it’s own html file? If not, would having only one html file for the entire book create any lag as the reader reads it on their devices?

Over the weekend, I plan to run a test of a sample book by following all your rules. I’m curious as to how long the process will take me.

Also, I will probably use JEdit as you suggest as it’s cross-platform. I am a Dreamweaver user, which I know is cross platform but I like the idea of having a free cross platform solution as well.

Many thanks again,

Paul

Comment by Guido on October 5, 2012 at 1:00 pm

Part of the EPUB format is defined by the fact that every time you insert a page break, you are essentially looking at a new HTML file, inside the book. This doesn’t affect that you still create a single HTML file as a source, since, as you correctly suspected, Calibre is chopping it up into pieces as it creates the actual EPUB file. And yes, after having formatted over 500 books have not once encountered a book where the HTML file size became an issue.

Comment by Carolyn Crane on October 10, 2012 at 12:34 pm

Guido, I have been using your guide religiously and I have been so grateful for it. I recommend it to everyone! You are awesome for doing it.

Quick question: I have heard all this stuff about things changing with the new Paperwhites and the Kindle fires, too. I see you did a post on this regarding images.

I have heard font sizes are a problem – I am guessing this guide is okay in light of that because you are using the “en” sizing bit. (sorry, I’m very tech challenged but that is my assumption.)

But I have also heard there is an image or library problem with going from prepared html docs to calibre on these new kindles. (the cover doesn’t show up, or something about the books marked strangely). I kind of don’t understand the whole thing. Maybe this doesn’t even apply to the formatter.

I guess my question is a yes or no one: in view of the new paperwhites and new touch kindle stuff, is this method still working for you in your formatting on such devices? I don’t have one of these machines to test on, and I understand the downloadable tests aren’t reliable.

Thank you !!!

Comment by Guido on October 10, 2012 at 12:46 pm

Carolyn, I have not heard anything to the contrary. I have neither a Kindle Fire, nor a Paperlight, but I have not heard of any issues like the ones you mentioned.

Comment by Carolyn Crane on October 11, 2012 at 9:26 am

Okay, just FYI, I had something done by this method tested on a Paperwhite, and all is well. Yay! Thanks again.

Comment by Surria on October 11, 2012 at 3:05 pm

Guido, you are truly wonderful for putting up this guide. I read through it today and I was astounded by the work and time you put into this. Thanks are not enough.

I will be purchasing one of your books to support you and as a thanks for doing this. I will most definately be using this guide as I format my own books in the future.

You are my hero of the day!

Comment by Florian on November 7, 2012 at 1:51 am

Thank you very much for the tutorial. It’s been fantastic and my manuscript looks perfect. I also purchase one of your books to support you.

Yet strangely in the TOC only the first half of the chapters are linked correctly. When I click at any chapter in the second half nothing happens. Do you have any idea?

Comment by Guido on November 7, 2012 at 7:52 am

Sorry, but without looking at the actual HTML code, I am not sure what could cause this particular problem.

Comment by Daniel Medley on November 13, 2012 at 3:20 pm

Man, this tutorial is great. One thing I wanted run by you, though. I followed the steps you’ve outlined, using Calibre to convert my html doc to .mobi for Kindle. Although the file renders perfectly in the Desktop Kindle Previewer referencing all available devices, the Online Previewer shows some wackiness with the left margin.

There are whole blocks of text where the left margin is indented a couple of ems further in after a new line.

I’ve gone over and over the html file and css. I’m pretty familiar with html and css. I’ve ran both through the W3C Validator and everything checks out. I, for the life of me, cannot figure out what could be wrong.

Since the .mobi displays perfectly on Kindle for PC and the Desktop Previewer, I’m wondering if the issue could be with the Online Previewer?

If you have any ideas, I’d be one happy camper.

Again, thanks.

Comment by Guido on November 13, 2012 at 3:51 pm

The online previewer is completely whacked. It renders half the stuff incorrectly.

Comment by Daniel Medley on November 13, 2012 at 6:29 pm

I found that by removing the padding in the .css file, corrected the problem. Everything looks as it should in both the online and desktop previewers.

Again, thanks for this awesome guide.

Regards
DLM

Comment by Daniel Medley on November 13, 2012 at 7:31 pm

I’ve been hearing that KDP is rejecting .mobi files created by Calibre. I’ve also heard others say that it’s not Calibre in particular, but .mobi files that are not properly coded in general.

Have you heard anything about that?

Regards
DLM

Comment by Guido on November 13, 2012 at 8:03 pm

The only thing I’ve heard is that they were at one point rejecting KF8 files created in Calibre, but I’m not sure if that is even the case anymore.

Guido, this guide is awesome, you’ve just helped me format my first e-book and it looks great. Incidentally, do you have any ideas on HTML code for a title page and acknowledgements page before the first chapter heading?

Cheers,

Antony.

Comment by Eamonn on December 6, 2012 at 5:57 pm

Guido,

Thank you so much for taking the time to do this HTML formatting guide, it has really, really helped me.

Can you think of any reason why my cover image would not show up in the epub? It looks fine in Calibre, but I’ve checked with Digital Editions and Nook PC and it just shows a blank where my cover should be.

Never mind. Figured out it was because my cover was CMYK not RGB. Fixed that and everything worked fine. Thanks a lot for this great series. Now that I have the basics, I’m looking forward to doing something fancy.

Comment by Larry on January 17, 2013 at 12:55 pm

Notice Alisa asked why Calibre generated TOC labeled each chapter as “unamed” – but didn’t see any answer. I’m encountering the same issue, despite experiments with the code. Converting HTML to MOBI. Any ideas?

And then I tell Calibre to look for all chapter paragraphs using this XPath expression

//h:p[re:test(@class, “chapter”, “i”)]

And that’s it. Perfect TOC entries.

Comment by Larry on January 17, 2013 at 3:03 pm

Well, that did it, many thanks!

Comment by Bruce Sun on January 23, 2013 at 5:33 pm

I have tried Calibre many times to convert the pdf of my book, which has many many small images plus tables and charts. The pdf file has all the ToC and links for bookmarks and crossreferences. First of all, Calibre does not do the conversion to epub or Mobi properly at all. It separated the text from the omages and the tables were all messed up. I finally created an image-based pdf of my book (I turned each page of the book to a png file then merged them back to create a single pdf. I then created the ToC (3 levels) for this pdf file manually. Of course, there is no way to do the bookmarks and crossreferences at this point. Calibre, at this point, was able to convert the entire image-style pdf to ePub and Mobi successfully, but with no ToC. How can I ask Calibre to take the ToC from the pdf (Image-based) input file to the ePub and Mobi it generates???
By the way, I have tried to convert from the original word file of my book to HTML files using WORD. It did not work very well because of of all the images and tables.

Comment by Guido on January 23, 2013 at 6:27 pm

PDF files are entirely unsuitable to be converted into eBook files. Word processor files work sometimes if you have been extremely careful how you put it together, religiously using styles, or else it will completely break as well. But that is exactly why I have created this tutorial, because there is no shortcut to creating good eBooks – other than hiring a professional like me, perhaps.

I’m reading reports that Amazon is no longer accepting Calibre-converted files, and that the Kindle Fires are not reading current Calibre-created .mobis properly. Just wondering what you know about this and what you suggest. Thanks!

Comment by Guido on January 25, 2013 at 9:57 am

This affects only books that have been created in Calibre as KF8 files. Amazon accepts MOBI files generated by Calibre just fine. As for Fires not reading MOBI files properly, I have never heard of that. I would suspect it is more likely to be related to poor formatting in the first place and has nothing to do with Calibre.

Thanks, I’m glad to hear that, since I find Calibre so easy to use. Although I have heard from several people who were told explicitly by KDP in emails that they no longer supports any third-party conversion software. I will try with Calibre, but I’m curious…what are your thoughts about simply uploading your well-formatted html document to KDP? They say they accept those and convert on their end.

Sorry…one other question. If you use Calibre to create MOBI files, can theys till be read on Kindle Fires and other, newer Kindles?

Comment by Guido on January 26, 2013 at 5:50 pm

Yes, of course.

Comment by Paul on February 18, 2013 at 12:16 pm

I’ve been using your method for a couple of months and it works well. However, I came across an issue today. For the auto-generated ToC, is it possible to increase the spacing between the individual chapters? I only have 5 chapters in my book and the page just seems jammed up. Wondering if there is a setting, I’m assuming somewhere in Calibre, to provide more line spacing or a line break.

Comment by Guido on February 18, 2013 at 12:25 pm

I haven’t looked closely into this, but it should be possible to modify the style that Calibre is using for the TOC and add additional spacing there. Since you only have 5 chapters, you could always hand-code the TOC also and then tell Calibre not to include the auto-generated HTML TOC.

Comment by Paul on February 18, 2013 at 2:00 pm

If I’m converting to .mobi, do I just put that hand-coded ToC at the beginning of my file? I obviously want it so that when someone is using the kindle app, that when they click on the ToC button, it takes them to the page I created. That’s mainly the reason why I let Calibre auto-generate it.

Comment by Guido on February 18, 2013 at 2:21 pm

Yes. Just create a separate page with the TOC and hotlink the entries directly using <a> tags like you would in any HTML documents.

Comment by Emily on February 21, 2013 at 5:53 pm

HI! Thank you so much for this amazing tutorial. I’ve learned so much and have a great looking mobi ebook. It looks great in a browser, on kidle pc, and calibre reader. However, I can not view it on my android. Also, the mobi file looks good in web browser, great in calibre viewer, but will not even open/appear on nook pc, android nook, or an actual nook reader. What the heck did I do wrong? I”m hopeing there is a simple answer withough having to start over.

Comment by Guido on February 21, 2013 at 6:27 pm

You did nothing wrong. MOBI files are for use with the Kindle only. The Nook uses the EPUB format.

Comment by Emily on February 21, 2013 at 7:04 pm

OOps! I mean that the epub, won’t open in the nook pc reader or on my sister’s nook. it will open in Adobe Epub reader, browser window, and calibre epub reader.

Comment by Emily on February 22, 2013 at 6:13 pm

Nevermind, nonen of us knew how to transfer files apparently. Working on all devices now!

Thanks! My book is coming along splendidly.

Comment by Philip Morgan on March 7, 2013 at 2:57 pm

Great guide Guido
I have converted my book and uploaded to Kindle, I also spent ages creating a clean Word doc for Smashwords. While uploading that I found you can now upload Epub to Smashwords This is where my problems starts. All links and generated TOC work fine on Kindle, the Epub file works fine on a computer Calibres readers. but the Epub file fails on uploading to Barnes and Noble. The error message I get is: “attribute “name” not allowed here; expected attribute “accesskey”, “charset”, “class”, “coords”, “dir”, “href”, “hreflang”, “lang”, “rel”, “rev”, “shape”, “style”, “tabindex”, “target”, “title”, “type” or “xml:lang”:
This message repeats file 9 files :tsom_split_012.html – 020.html. My book has 9 chapters and 9 internal links, bit unlucky they happen to be the same, so I assume there is a problem with one or the other.
Barnes and Noble say the Epub file must comply to http://validator.idpf.org/
even thought the file seems ok on Calibre software this site rejects it. Any ideas?

Comment by Guido on March 7, 2013 at 3:43 pm

This indicates that your HTML has some minor issue somewhere. Oftentimes it is simply a misplaced tag or a missing tag. Without seeing the actual HTML, however, it is impossible to determine what is going on. My guess would be that your <a> tags are not formatted correctly. Instead of using the “name” attribute to link to them, use the “id” attribute instead.

I’m about to publish a new book on Amazon, and I’m leery of downloading Calibre’s latest upgrade. I’ve never had a problem uploading Calibre to Amazon before, but, as I posted above, there have been some reports of issues lately.

Am I better moving forward with v. 0.9.9 which is what I used successfully last time or upgrading to the latest version?

Thanks, as always, for your help and advice!
Joanne

Comment by Barbara Shoff on April 6, 2013 at 5:27 pm

I have written a non-fiction how-to and the TOC has multiple sub entries that I want to link to specific words within chapters so the reader can click on specific topics and go directly to the answer. Do you have suggestions for doing this?

Comment by Dan on May 1, 2013 at 9:17 am

I’ve gone through the guide and formatted my book, and so far it looks great. The only question I have is, when converting it in calibre to a mobi output for Amazon, do I choose old, new or both?

The kindle previewer is acting very strange, and will not allow me to change the font face. But I have a feeling it is an issue with that program.

Comment by Guido on May 1, 2013 at 11:00 am

Dan unless there is a very specific reason for it, I seen no point in using the KF8 format. For the most part MOBI is fully capable of handling novels and what’s more important, it is supported on all Kindle devices. Keep in mind that KF8 is supported only on a few selected versions of the Kindle.

Comment by Dan on May 1, 2013 at 12:18 pm

Thanks. I chose the “old” mobi version.

I’ve read a lot of post saying Amazon doesn’t accept calibre mobis. Have you experienced any issue with this? Just curious.

Thanks again.

Dan

Comment by Guido on May 1, 2013 at 1:42 pm

That is only half the truth. Amazon does not accept KF8 MOBI files created with Calibre. They accept standard MOBI files just fine.

Comment by Dan on May 1, 2013 at 2:13 pm

Aaah, that makes sense. And I’m glad, because my book looks beautiful. Thanks for replying so quickly to my questions, I really appreciate it!

Hi Guido – just one more question for you, if you don’t mind. I am formatting an ebook that has a table in it, 5 Columns, 8 rows. I used the relevant “”
and and coding but when I convert to epub and mobi formats, its all a mess.

I mean “mess” in that in the calibre reader the grid comes out fine and the text is aligned to the left like I told it to be readjusts well. In the Kindle PC reader – the grid looks odd with paragraph indents that look ugly.

For both readers the text goes off the reader on the right hand side if the user sets the font “too large”

My CSS for the table is:

p.table
{
text-indent: 0em;
margin-bottom: 0.2em;
font-size: 0.5em
}

and seems to be being ignored as the text is the same font size as the rest of the book.

Any ideas on how to handle best? I considered putting in a jpeg but considering everything else you’ve written here that seems like an “ugly” handling.

Thanks so much

Comment by Guido on May 15, 2013 at 3:48 pm

I would have to see the actual HTML code but what immediately jumps at me is the fact that you’re using a table. Tables do not work on the Kindle. They will always be garbled and messed up on anything but the latest Kindle tablets. It is sad that Amazon has never addressed some of the serious flaws and shortcomings in the Kindle firmware, but there it is…

Comment by Tom Sharp on June 6, 2013 at 2:37 am

Thanks Guido for the informative article. My problem is simple. When i convert my epub to mobi in calibre the title page is always missing. My title page comes after cover but before credits page. Is this a bug? Have tried updating calibre and all combinations of settings.

Comment by Guido on June 6, 2013 at 7:53 am

Not sure what could be causing this. I’ve never used Calibre to build a MOBI file from an EPUB, I’m afraid, but I don’t really see any reason why it would arbitrarily drop pages. Are you certain it is gone and not that the previewer just opens on the page after it?

Comment by RF on June 8, 2013 at 10:07 pm

Hello,
I’m entirely new to the e-book idea, I do not even own an e-reader! how ever being a published author is a life long dream. i am currently formatting my book using your steps. One question I have not been able to get answered clearly from anyone (or been able to find the answer to on my own) is this, Can I legally use song lyrics in my book if I credit the artist at the end? Or do I need to get permission from the artist first? If this is the case, what if the artist is deceased? Any help you can offer in answer to my questions would be greatly appreciated!
Thank You,
RF

Comment by Guido on June 8, 2013 at 10:56 pm

Sorry but I am not familiar with the legal implications in that case, and I would rather not speculate to be honest.

Comment by Omer on June 14, 2013 at 8:34 am

Hey man, thanks for the guide. I have a question though, I converted the zip to EPUB no problem, TOC working and everything. However when I convert to MOBI from either format, my chapter headings get way bigger than they’re supposed to be, despite being the correct size elsewhere. Any advice?

Comment by Omer on June 14, 2013 at 8:51 am

hey man just a heads up I got it working, used another program. Thanks for the guide though, helped me a ton.

Comment by Martin Grundy on June 15, 2013 at 9:53 am

Fabulous! Thank you, Guido.

I work daily with HTML and CSS but in a website context. I learned a lot from your 9 articles especially about the use of the “em” measurement and not specifying a font.

There is no substitute for experience and your knowledge of what HTML syntax does and does not work will be invaluable.

I have one question. My novel quotes from another book. I want the quotations to be in a different font. For example, the main text in printed format might be Times New Roman and the quotations might be Arial. However, since I can not define a font, how can I achieve this?

I did think of putting the quotations in italics, but I find large chunks of italics hard to read. I could use a slightly smaller text size. I could also put some sort of delimiter in. Do eBooks Support the <hr> HTML tag?

Comment by Guido on June 15, 2013 at 10:53 am

You can still use the font-family attribute, but use the generic font settings, such as serif, sans-serif and monospace, like this

p.newfont { font-family: monospace; }

As for the HR tag, yes it is supported but the appearance of it is highly unpredictable, I found. You could always make a small line image yourself and then print that instead.

Comment by Martin Grundy on June 18, 2013 at 1:35 pm

I have a small suggestion. Recently I had this experience on my Kindle – I reached the end of the text, but I could not tell if it was the end of the book. Some books have inconclusive endings, others have an epilogue after the story proper has finished, so it can be difficult to know.

With a printed book, the back cover is still in place and no pages have fallen out, so you know when you have got to the end. But with an eBook, it may not have downloaded properly, or the originator may not have uploaded it properly, so it can be tricky to determine whether or not you have the whole thing. (Not all eBooks have a chapter index you can check.)

So here is my suggestion. After the last sentence in your eBook, have a final chapter heading of “The End”. That way, ever reader will know that there has not been a technical glitch somewhere along the line.

Comment by Martin Grundy on June 18, 2013 at 1:37 pm

*every* reader, not *ever* reader, sorry.

Comment by Guido on June 18, 2013 at 1:54 pm

Most authors I have been working with have either “The End” at the end of the book or some asterisks to indicate the end of the text.

Comment by Martin Grundy on June 18, 2013 at 3:59 pm

Do you have an alternative to calibre? I get an error message when attempting to save to disk and I can find no reference to it via Google. It reads “calibre, version 0.9.35
ERROR: Not allowed: You are trying to save files into the calibre library. This can cause corruption of your library. Save to disk is meant to export files from your calibre library elsewhere.”

Comment by Guido on June 18, 2013 at 5:49 pm

I’ve never seen that error message. Did you try to change the path where you want to save your files to? It sounds to me like you’re trying to save into a directory that Calibre views as own its library directory. If not, ask the guy who wrote Calibre. He is very active on the Calibre support forum.

Comment by Martin Grundy on June 19, 2013 at 10:23 am

Thanks, Guido. The Calibre forum gave me enough of a hint to work it out. Somehow, the whole of my Mac was the Calibre library, so I could not save anything. The answer was to relocate the library to a sensible sub-folder.

I have found it necessary to go back and make adjustments to some of my completed books but only have the mobi files available. I converted the file to htmlz in calibre but was jedit would not recognize the encoding. Any suggestions? I would prefer it if I did not have to start from the original manuscript.

Thanks Guido. I am totally blown away by how easy these steps actually are. I am going to print out every page of this series and see if I can do this on my own with my first novel. I had been looking into ebook formatting services, but after reading through this, I have a feeling this is something I might be able to pull off on my own. It sure would save me a few dollars. And we all like to save money after all.

Cheers,
Michael

Comment by Liron Yankonsky on August 31, 2013 at 2:16 am

Best guide I found, and I searched EVERYWHERE… (=

Thank you so much! I like to know how things work “under the hood” as well, and it totally makes things less intimidating.

And now that this step is done, it’s time to begin the eBook publishing and marketing [=

Amazing article! I’ve followed your instructions to the letter and am very impressed with how awesome my book looks now! However, I’ve run into a few issues when it’s actually converted to the epub and mobi.

First, when I had the extra stuff in the tag about the version and everything, calibre insisted on putting that stuff in the final file. Not sure how that’s happening, but once I took all that stuff out and just had at the beginning and at the end, it worked perfectly. Is that stuff needed for one of the uploading sites or something?

Secondly, and more distressing, I can’t seem to get my text to get any bigger than 1.5em. I set up my class tags exactly as you suggested, and the text is indeed bigger when I look at the clean html file in a browser, but as soon as it’s converted to mobi or epub, it scales down to 1.5em. Any suggestions?

Other than that, I couldn’t be happier! This is by far the clearest, most helpful guide I’ve found, and huge kudos to you! Thanks again!

One thing you omit: how to create a table of contents that links to each chapter. I suspect I’m going to have to look up how to make a hyperlink that goes to a particular point in the document, and then make sixty hyperlinks from the contents to the chapters and from the chapter ends back to the contents.

This has been marvelously useful, though, thank you very much!

Comment by Guido on November 27, 2013 at 12:40 pm

It is covered, I believe, in the last part of the series where I explain how to set up Calibre, as Calibre can automatically build the TOC for you.

Comment by Philip Curran on December 2, 2013 at 2:04 pm

Thank you for writing this, it’s been a tremendous help.

Comment by Lee Dunning on January 25, 2014 at 9:35 pm

Holy furball! I followed your instructions and everything worked! My ebook looks fabulous and it was totally painless to get set up. THANK YOU!!

Phenomenal guide. Thanks for taking the time to put this together for us. I discovered it while reading David Gaughran’s “Let’s Get Digital…” book.

My question involves hanging or floating quotes. I have a couple of places in my manuscript where I paragraph or two represent a letter that the PoV character is reading. I like to represent this by increasing the indent on both left and right sides (as well as italicize) so it’s clear something different is going on.

What are your thoughts about using the “blockquote” tag? To your knowledge is it rendered properly on multiple formats? If not, how can I best achieve this look?

Many thanks.

Comment by Guido on January 29, 2014 at 2:36 pm

<blockquote> is not part of the original MOBI specs ad I do not think of the early ePub specs either, so I would not consider its use because it will not display properly on the early Kindle generations and other eBook readers.

The easiest way to do this is to use the DIV tag instead. Create a styled div and call it blockquote, if you wish, to achieve the same effect.

Guido, what a great guide for a technophobe like me. It’s a gift you have, the ability to explain things so clearly. Thank you very much for all the work you put into this tutorial.
A future post for displaying photographs on an ebook page — position, size, etc. would prove very useful, especially as devices’ displays improve. I have a guidebook with color photos in the starring role I’d love to convert to ePub, as daunting as that sounds right about now. Also in my historic novels I use photos predominantly as well.

First of all, I want to thank you for your wonderful generosity, and your fine work in providing us with this most awesome resource. I managed to create a beautiful looking Preview E-Book as my first project. It looks great in the Calibre Viewer as well as the Adobe Digital tool. Kindle is another matter though. The book cover does not appear when viewing the books from the Kindle Library. There’s just a picture of a blank book. The cover does show once you open the book to read it though, and the interior of the book shows flawlessly.

Do you have any thoughts as to why this is happening? I even changed the cover type from jpg to png. No difference.

Have you heard if there is any truth as to the rumors that Kindle will not accept E-Books from Calibre, or I have I misinterpreted this?
Once again, many thanks for all of your work. Totally awesome!

Thanks,
Rick

PS: When filling out the comment I entered my blog address, but the blog is locked at the moment until I feel it is ready to go live. Blog will be for the promotion and selling of my short stories and books as well as a meeting place for writers and illustrators.

Comment by Guido on February 5, 2014 at 1:56 pm

Rick,

The missing covers seem to be a software glitch of the Kindle software. It won’t happen once the books is uploaded to Amazon and delivered to the device through their system.

It is not correct that Amazon will not accept books built with Calibre. It is a rumor that got twisted along the way. The reality of it is that Amazon will not accept KF8/AZW3 files created with Calibre. They insist you use KindleGen for that. If you stick with A MOBI file, however, Amazon accepts your book just fine.

Once I have several short stories ready, I will have to get an illustrator to do the cover art. Do you have any recommendations on how to get some decent cover work done at a reasonable rate? At least until I generate some income from my short stories.

One thing I seem to be having a problem with is transparent gifs, specifically when I compile to the Kindle format. I’m told that Kindle now supports transparency, but my transparent chapter headings (and other transparent images) always show up with a white background when I view the manuscript on the desktop Kindle viewer and the iPad Kindle app.

Do you have any advice for making sure my transparent images stay transparent? The white background is ok, providing the reader is using a white background. But when they choose sepia or black, all bets are off.

Thanks for any advice you can offer!
Nat

Comment by Guido on February 12, 2014 at 11:29 am

To the best of my knowledge, the Kindle still does not support transparent images. The Kindle Fire, perhaps, but none of the eInk devices do.

Thanks, Guido. I guess I’ll be stuck with the white background for now.

The only other issue I seem to be having with the process is that when I produce the MOBI file with Calibre, then use “send to Kindle” to get it onto my device, it shows up on the device (and in my Amazon library) as a “Document” rather than a “Book”. This worries me because I don’t want it showing up as anything other than a “Book” when I publish later this year.

Is this just an artifact of using “send to Kindle” that I won’t encounter when I actually publish, or does it sound to you as if something has gone wrong in the process?

Comment by Guido Henkel on February 12, 2014 at 2:56 pm

I’ve never used the “Send to Kindle” feature, but what you describe might be a setting in Calibre. I always load books onto my Kindle manually for testing.

Either way, however, I would not worry about it because once you publish it through Amazon I am certain it will properly categorize as an eBook.

Guido, I notice that this last installment instructs us to embed a 600X800 pixel cover image into the ebook. But a later comment of yours added to part VI (in Sept of 2013) reads, “At this time I would make a cover no smaller than 1024 pixels wide. Since the current generation of iPads has a resolution of 2048×1536 pixels, that is the resolution I would go for if you want to stay on the high end.”

I assume the larger mentioned size is more current, but moving beyond assumption, let me ask three questions:
1. What is the size at which you’re creating your (to be embedded) cover images today?
2. Do you still use the same, single image file for both the ePub and mobi files?
3. Does this mean that, provided the aspect is preserved at 3:4, all the legacy 600X800 pixel readers have no problem shrinking a larger image to fit their screens? (I’m not sure if ‘preserve aspect’ is a Calibre option for Mobi creation as it is mentioned above for ePub creation.)

Comment by Guido on March 8, 2014 at 2:57 pm

1024 is still the size I’m using these days. Anything above that blows up the size of the eBooks to an unreasonable bulk that, in the end, the authors have to pay for. Since there is very little benefit in having even larger covers, I don’t see why they should be penalized, since the majority of eBooks are still sold for eInk devices with lower resolutions.

I do use the same images for both formats.

The aspect ratio is virtually irrelevant because you never know which device/software your book will be displayed on an each device has a different resolution and aspect ratio.

Comment by Terah on March 8, 2014 at 7:42 pm

I converted the html file to epub and tried to read it in the Calibre reader and it still shows it in html. I also tried to read the epub file on the Adobe Digital Editions and it did the same thing. I’m missing something very important, but not sure what it is. Do you know?

Comment by Guido on March 8, 2014 at 8:56 pm

I am not sure what you mean by “it shows it in HTML.” Do you mean it still shows the actual HTML tagging?

Comment by Terah on March 8, 2014 at 11:12 pm

yes

Comment by Guido on March 8, 2014 at 11:15 pm

In that case it would seem you have somehow skipped the building step or it was somehow corrupted. Feel free to send me your HTML file and I’ll take a quick look to see if anything stands out right away.

Thanks, Guido, for your quick answers to my questions. One answer prompted another question. If aspect ratios are virtually irrelevant, should we still be selecting ‘preserve cover aspect ratio’ from the ePub output section as instructed above in the tutorial?

Comment by Guido on March 9, 2014 at 10:29 pm

Yes, because you do not want the cover to be distorted. You want it to be scaled proportionally.

Thanks again, and I can’t believe I forgot to ask this: at what dpi do you make this (to be embedded) cover image? I’ve heard everything from 72 to 170.

Comment by Guido on March 10, 2014 at 7:52 am

dpi is completely irrelevant. It is a measurement for print output that determines how your pixels are translated into print dots. For images on computer displays the measurement has no relevance at all.

Your guide is amazing. I have one problem that I believe is specific to my Kobo Touch, the base Kobo model. Let me see if I can describe what’s happening.

What I’m looking for, and what I see in professionally created books from the big publishers is something like this:

Cover page – Cover image takes up the entire space and no page #’s at the bottom
Dedication page – Has “Dedication” at the bottom and no page numbers
Chapter 1 – Has “Page 1 of 14″ at the bottom, counts up properly, no page numbers along the left side
Chapter 2 – Has “Page 1 of 18″ … etc.

What’s I’m seeing when I convert using both Calibre and Sigil:

Cover page – Has white space at the bottom and “Page 1 of 350″ at the bottom
Dedication page – “Page 2 of 350″ and a page number along the left
Chapter 1 – Has “Page 3 of 350,” counts up improperly based on page numbers on the left side (So for instance, 1.5 pages = 1 page)

This is a problem I see with a lot of self-published books, and it’s one I can’t seem to get rid of using either of those programs. I’ve googled until my fingers fall off, and I can’t find anything addressing this issue. I tried making one HTML per chapter/section and linking them together in an over-arcing HTML. It didn’t work. I’m going to keep looking, but I was wondering if you have any ideas on how to fix it. It’s so frustrating, since I totally agree that the final product should be professional–and it looks so unprofessional on this device.

First, this guide is the most valuable resource in all of self-publishing, as far as I’m concerned. I’m very much looking forward to the book.

Question about entities:

I’d like to use symbols for page breaks, and there are lists of named entities for things like card suits, crosses, arrows, etc. If there is a named entity, will it be universally supported? (At least by e-readers etc.) Or do I need to be cautious with symbols?

Thank you! It’s unbelievable how much you’re giving this community.

Comment by Guido on March 21, 2014 at 3:48 pm

For the most part they are uniformly supported, though the Kindle does have some omissions. The easiest way to find out, really is to use the entity and load it up in the Kindle software reader. If it shows up correctly, it will work on virtually all eBook readers from my experience.

Can you offer any guidance for those of us who also wish to publish through CreateSpace? They’re requesting a PDF file, but when I run the HTML generated using your tutorial, the font sizes are way too large in the resulting PDF, and this is dramatically increasing the page count.

Any advice?

Comment by Guido on March 29, 2014 at 11:55 am

There is a huge difference between an eBook formatting and a print layout. While you can use an eBook formatted book as a source for print layouts, the idea to just use the original HTML file and auto-generate a proper print layout from it, is every bit as bad as trying to take a word processor and export an eBook from it. They are two very different beasts that require very different approaches.

Everything has been flawless until I tried uploading my EPUB to iTunes. I get multiples of the following error from an EPUB validator, marked as being on “line” 11 (in multiple “positions”). I wonder if it means anything to you:

You have an error in your HTML tagging, evidently, but without seeing the actual code I am not able to tell you exactly what happened. Somewhere you have a span that’s supposed to be centered but is mangled with some weird character in the tagging.

Comment by AB Sweat on April 16, 2014 at 11:11 am

Hi Guido! Adding my thanks for this to everyone else’s! My beautifully rendered ePub file, which I made using your guidelines, has passed all three major validators uploads to B&N. Unfortunately, Smashwords direct ePub uploader won’t accept it. I get this error: “The book file you uploaded is in a format we do not support, or it has a filename extension we do not recognize. Your file appears to be a “application/x-zip-compressed” file, and has a “.epub” filename extension.”

Their support tech is telling me to unzip it, which I am struggling to do. Are you familiar with this issue at all? I know how you feel about Smashwords, and I agree. However, to list for free I need to distribute through them.

Also, have you finished your ebook on this subject yet? Can’t wait to buy it!

Comment by Guido on April 16, 2014 at 11:28 am

I wouldn’t upload an ePub file to Smashwords to begin with, because it still has to comply with all their ridiculous “style guide” rules, while severely limiting your exposure because they do not create all the other distribution formats from ePub files. Therefore I would submit a properly formatted Word document and go with that.

Comment by AB Sweat on April 16, 2014 at 5:45 pm

Thanks, Guido! I wanted to post an update in case anyone else encounters this. Turns out, all I had to do was switch my web browser (from internet explorer to google chrome) in order for the upload to go through. Go figure.

Comment by Saira Ali on April 25, 2014 at 3:33 pm

Hi!

Thank you so much for such a thorough tutorial.

I do have one question, and I apologize if it’s been asked and answered in comments already, and I missed it. I have a preferred font I’d like my book to display in, but I want to also allow readers to be able to override that if they want to. Is there any way to give a font “hint” to ereaders, so that it will default to my house font unless the reader changes the font setting?

Thanks!

Comment by Guido on April 25, 2014 at 3:49 pm

Yes, eBooks support general HTML font hinting, but keep in mind that most eReaders do not have much to offer in terms of alternate fonts.

Hi Guido, it’s wonderful how you give the complete workflow step by step here. This will be such an excellent resource to use as I submit ebook files over the next 18 months.

I really hope I can learn this workflow process of formatting my books. I hope I can do it! I seem to get worse with computers as time goes on, not better.

You didn’t mention about ‘chapter breaks’, or how to include clickable links at the front & back, i.e. to give my website link for a ‘new release mailing list’ for readers to sign, or for reviews, etc.

Read through this series and loved it. Now, I am ready to convert my file from Textmate into an html document, but I don’t know how.

How do I do this? (Did I miss something in the series on this?)

Thank you
-Michael

Comment by Guido on May 27, 2014 at 2:47 pm

I just wanted to let everyone know, that I have just published a book called “Zen of eBook Formatting” that is now available. It covers the aspects from this tutorial in a lot more detail and also adds a hole lot of additional info, details and advanced techniques to the mix. Here is a link with a bit more info, including a look at the Table of Contents of the book.

I’m formatting my fourth book now with your excellent guidelines, but am suddenly running into a problem with the cover. When I convert with Calibre and load the mobi file onto my Kindle Paperwhite, the cover doesn’t show up in the carousel. It does show up if I click cover or page backwards to it. Any ideas? I’m using Calibre 1.48, the latest I can use with OS 10.6 and my covers are the same size they’ve always been.

Thanks, Joanne

Comment by Guido on August 24, 2014 at 3:33 pm

This seems to be a bug in the Kindle Software viewer. Occasionally it does not display the covers for books that have been manually loaded into the reader.

I’m trying to format a blockquote. This is what I set up in my CSS at the top of the document.

p.blockquote
{
margin-left:2em; text-indent:0em;
}

But as I say, it’s also not identifying my ToC correctly. I have my chapters like this (which I’ve always done). I just noticed I don’t have a chapter definition in my CSS though. I’ve got this int he document: ONE What should I have on top? (And why is it coming out right in mobi?)

Hi again, Guido. Don’t know if you’ve had a chance to look at my html, but I seem to have fixed the chapter and blockquote problems! I now only have two errors, but I don’t know where to look for them in the html. When I go to the line/position it suggests, there’s nothing there corresponding (also not sure how’d I’d fix them.)

A good series of articles well worth reading for those who need a quick guide to HTML. Time has marched on however, and Calibre has been updated to include an editor which is simply brilliant. Not only that but it will now make a reasonable job of converting MS Word doc and docx files to epub format. This saves a huge amount of time messing about with text editors, especially if you’ve included different styles, images and effects such as lists, tables, links, footnotes, subscript and superscript
One thing I agree about is that MS Word makes a dreadful mess of HTML, so it’s still worth going through Guido’s guide to get an understanding of what’s needed.
My technique is:
1. Write the book in MS Word and use styles to get the appearance you want.
2. Save the document as a docx file
3. Import the docx file into Calibre
4. Convert the file to epub format and add meta data and table of contents
5. Right click and go into the Calibre editor
6. Use the tools to remove unused MS Word styles, embed any unusual fonts you’ve used and tidy up Word HTML
7. Check the html and use what you’ve learnt from Guido to fix things like bulleted lists (MS Word makes a real mess of those)
8. Tweak the CSS file – e.g. to insert graphics for text separators
9. Save and validate the file.
10 That epub file can then be sent to Amazon AND Smashwords

Comment by A.J. Brown on October 5, 2014 at 10:31 am

Good afternoon, Guido. Like everyone else who has commented, I have found this series extremely helpful and I greatly appreciate the amount of time and thought you put into it.

I’ve gone through and formatted my file and I thought everything was fine.

I used Jedit to do all of the HTML coding. I then used Calibre to do the conversions. When I checked through the Epub version, I noticed there were square symbols (black ones with question marks in the center) in the places my quotes, single quotes and dashes should be. I went ahead and did a conversion into MOBI as well to see if maybe it was just the Epub version, but it did it as well. Then, for comparison’s sake, I went ahead and did an RTF version. The black squares with the question marks became clear square symbols in the RTF. I’m very green at creating anything with HTML and I have no clue what caused this. I’m pretty sure I did something wrong, but I’m not sure what. Do you know what would cause these squares to appear instead of the quotes, single quotes and dashes?

Thank you for any thoughts you have on this.

A.J.

Comment by Guido on October 8, 2014 at 10:31 am

It would appear you did not convert the special characters to named entities.

Comment by A.J. Brown on October 8, 2014 at 5:23 pm

I think you are right–no, I know you’re right. I just reread through the blog posts. Can you give me an example of how to write the code for the special characters? For example, you mention the ellipses and you give the entity: … Where would I put that code? At every ellipses or at the beginning or middle or end of the style sheet?

I’m publishing my first book and I have to say that I have been following your guide religiously. I cannot thank you enough. I’m at the end of the process now. I just have to view it and I have a question, when you state this-

“For first checks I always use the software versions of the Kindle or the Nook reader or Adobe Digital Editions.”

Is it the kindle app you use or some other software? Because I can’t seem to upload my files to the kindle app for first checks. And if it is the kindle app how do I do that? I really can’t seem to figure that out.

Okay I figured out why why I couldn’t upload my files. I was using epub for the kindle app. When I coverted the book to mobi it was fine. The only thing is the table of contents is at the end of the book. How do I move it to the front right after the cover?

Comment by A.J. Brown on October 15, 2014 at 6:54 pm

Never mind. I figured it out.

Comment by Gretchen on October 24, 2014 at 6:00 am

First, I just wanted to say THANK YOU for the awesome guide! It really is excellent!

Secondly – I have a question about front material. Do you have some template code you can share with us? I’m having trouble getting the page breaks and centering to work on things like the title page, dedication page and copyright page. Thanks!

You have made an absolutely major contribution in helping so many (myself included!) with eBook formatting. And then too to interact with so many seeking help: we are all indebted to you, THANKS!!

I have for days been trying to work out what I am doing wrong, basically in browsers, eg this message and in many readers I have tried (including Calibre, Kindle Previewer & Adobe Digital my ePub file) most html marking is still there/shows and I don’t know why.

Viewed in a browser (as here) or in readers the text displays with much of the HTML markings (!!) as follows:

CHAPTER ONE

text-indent: 0em;Birth and death: singular, separating, solitary events recalled only by others and placed around otherwise imperfectly remembered life.
Greg first learnt something of the circumstances of his impending birth through his older cousin Ellen’s recounting of events years later:
‘Greg, I remember it so well, just as if it was yesterday.’ Ellen spoke chuckling (principally to herself) during a shared luncheon.
‘I was just a child then. Aunt Emily, your mom, was having dinner with Aunt Nan and my family in the big family dining room at Donegal Avenue.’
Greg had never known or seen the house at Donegal Avenue, but had heard of it often enough in different family contexts over the years. Greg had already created his own sense of that home. It would have been a grand precursor to birth – large, imposing, with dark furniture and oil paintings; moneyed and aloof.
‘Suddenly, your mom stopped eating: ‘The baby’s coming’.
There was a flurry of excitement and expectancy around our dinner table, all precipitating a halt to the evening’s dinner.’
Moments otherwise lost; now however forever caught for Greg, witnessed and passed on from past and for future safekeeping; Greg becoming a belated interested observer and participant in life before birth. Ellen linking Greg’s present to his past and at the same time reminding Greg that, although born alone (as we all are) and bred as an only child, he remained part of a large disparate family with aunts, uncles and cousins transcending and peopling generations. Greg’s family recollections interlocked with Ellen’s continuing chatter.
‘If I remember correctly Greg, it was Auntie Nan, not your dad . . . he was probably away at the farm . . . ‘ (The farm would have been several hundred miles away) ‘. . . Nor my dad . . .’ (Greg’s Uncle Albert) ‘. . . nor mom; yes it was Nan who then gathered up your mom to take her, an you, to the nursing home.’
Greg envisaged it all. Mother with impending child briskly, efficiently whisked away by efficient Aunt Nan, a nurse and midwife, to the nursing home, the Queen Victoria Maternity Hospital, Johannesburg, then a welcoming shelter, now defunct. A referenced starting point for Greg whose mother, aunts and father had all separately pointed out on numerous separate and various occasions, saying words to the effect of:
‘That’s where you were born!’

I wanted to tell you that I found the problem that turned my em dashes into three short dashes – it was a Calibre setting after all! Namely “unsmarten punctuation” in “Look and Feel” – no idea how I missed that before. Sorry!! Don’t I feel silly now…

But I have another question: As far as I can tell from the Calibre html view of the epub in “Edit book”, Calibre converts all of my painstakingly inserted entities (for ellipses, curly quotes, em dashes, …) right back to the typographical versions.

Is there a way to prevent this – and if not, what is the benefit of going through the entire entity-replacing rigmarole?

Thank you again!!

Comment by Guido on December 18, 2014 at 10:38 pm

Glad you found the problem, Sylvia, but no, Calibre should not be doing this either. It may be, however, that the “Edit book” function does that. What do you need “Edit book” for anyway?

Comment by Sylvia on December 19, 2014 at 3:02 am

I was merely checking to see what the converted ebook looks like – though I see now there’s no need to go through the “Edit book” option. I didn’t actually change anything in “Edit book”, however, only look at the file…

Is there a way to look at the html ion the coverted epub another way, so I can check whether the entities are still there before I open the file with “Edit book”?

Comment by Sylvia on December 19, 2014 at 3:50 am

Checked in Sigil – and yes, the entities in my converted epub are really gone.

I quote: If the `keepxmlentities` parameter is provided and is a truth value, the core XML entities (&, ', >, < and ") are left intact.

That’s what I want! But how do I set this parameter?

Comment by Guido on December 19, 2014 at 6:54 am

The ePub file is actually a ZIP file. You can unpack it with an Unzipper and you will see all the individual files that make up the book, including the HTML files, which you can then load up in a text editor.

Calibre should not, by default, replace these entities. Once again, it would appear as if you have some setting selected that should not be active.