Take pride in your eBook formatting (Part IX)
Posted by Guido ·Feb 7
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.
Lastly, if you enjoyed this series and found it helpful, please feel free to support my efforts by purchasing one of my books. You can find them here at Amazon, Barnes&Noble or on the official Jason Dark: Ghost Hunter website.
Part I • Part II • Part III • Part IV • Part V • Part VI • Part VII • Part VIII • Part IX




277 comments
Comment by EJ Wesley on February 11, 2011 at 6:48 am
Hey Guido! Read your guest post on Konrath’s blog, and enjoyed it so much I had to come check out your blog.
All I have to say is, “hell yeah!” The information you’re laying out here rocks. Thank you so much for sharing in such great detail. This is getting stashed away in my favorites.
Wish you much success!
EJW
Comment by Guido on February 11, 2011 at 8:52 am
EJ, thanks for the feedback. I’m always happy to hear when people find the information helpful and can put it to actual use.
Comment by Coral on February 11, 2011 at 6:00 pm
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.
Comment by Robert J. McCarter on February 25, 2011 at 3:24 pm
Guido,
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.
Thanks,
Robert
Comment by Guido on February 25, 2011 at 3:30 pm
Robert, I am glad this has been helpful.
Comment by Ed Robertson on March 11, 2011 at 8:39 am
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.
Comment by Ed Robertson on March 11, 2011 at 1:02 pm
Thanks for the response. It doesn’t seem to like the margin tags; every other bit of CSS is working fine. I’ll try to find an alternative.
Comment by Sophia Martin on March 26, 2011 at 5:24 pm
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!
Comment by V.K. Scott on April 4, 2011 at 3:37 pm
Sophia,
I had the same problem myself. Here’s how I fixed it:
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 you said, removing the padding altogether fixes the problem.
Comment by Ed Robertson on April 4, 2011 at 3:59 pm
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.
Comment by Sophia Martin on April 4, 2011 at 9:59 pm
Thanks, everyone. You were right.
And Guido was very helpful and got back to me about it too. Like, within an hour of my comment! Sigh. I love this community.
Comment by Robert J. McCarter on April 14, 2011 at 7:35 pm
Guido,
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.
Comment by Robert J. McCarter on April 15, 2011 at 3:41 pm
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.
Comment by Douglas Dorow on April 16, 2011 at 9:06 pm
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.
Comment by Douglas Dorow on April 16, 2011 at 9:37 pm
I did, I even just copied what you have here to make sure, still no TOC. Do I need something in the html code for TOC placement? The cover image and chapters came thru OK.
Thanks
Comment by Kathleen Dienne on April 21, 2011 at 12:28 pm
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.
Comment by David Gaughran on April 22, 2011 at 2:18 pm
Hi Guido,
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.
Here’s what my code looks like:
p.headline
{
text-indent: 0em;
font-weight: bold;
margin-top: 1.5em;
}
p.chapter
{
text-indent: 0em;
font-weight: bold;
font-size: 2em;
page-break-before: always;
margin-top:5em;
margin-bottom:2em;
}
p.centered
{
text-indent: 0em;
text-align: center;
}
span.centered
{
text-indent: 0em;
text-align: center;
}
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.
Comment by Emily on May 2, 2011 at 4:16 pm
Sent! Thank you so much, Mr. Henkel. You’ve made my day.
Comment by India Drummond on May 11, 2011 at 4:26 am
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!
Comment by Guido on May 11, 2011 at 7:11 am
Thank you, India. I am so glad that it helped.
Comment by Emily White on May 11, 2011 at 2:40 pm
Guido,
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 ä ü becomes ü and so forth.
For a full list of named entities, check here – http://www.w3.org/TR/WD-html40-970708/sgml/entities.html
Comment by Julianna on May 15, 2011 at 3:00 pm
Thank you very much for the link and the text editing suggestions.
Comment by Heather on May 29, 2011 at 12:23 am
I’m looking at my finished ebook. It’s beautiful.
I’m speechless.
Thankyouthankyouthankyouthankyou.
Comment by Guido on May 29, 2011 at 10:48 am
Congratulations Heather! You made it and it was easy, after all, wasn’t it?
Comment by Paul Rogers on June 8, 2011 at 4:59 pm
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.)
Comment by D. Ryan LEask on June 20, 2011 at 11:18 am
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.
Comment by Candy Paull on July 7, 2011 at 10:13 am
Dear Guido:
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.
Comment by Adam Geen on July 21, 2011 at 2:47 pm
Hi Guido,
Thank you for the wealth of information here! It’s kind of astounding in all honesty.
One thing I’m curious about is comic books. Or rather an ebook that contains mostly full page artwork but has some prose towards the end. How would that work given what you’ve written here?
Would it be a matter of using the style sheet and html like you’ve described for the prose but then having jpegs at the beginning?
At this point I’m mostly concerned with comics but in the future I’ll be trying my hand at ebooks as well so regardless this info is amazing!
Comment by Adam Geen on July 22, 2011 at 9:50 am
Hi Guido,
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.
Comment by bmagna on August 1, 2011 at 5:58 pm
Fantastic guide, Guido. Fantastic look inside the engine.
Just a quick question:
What’s your take on using line breaks in the form of and  ?
Thanks and Best,
Brad
Comment by bmagna on August 1, 2011 at 5:59 pm
Sorry… that’s paragraph tag –   – paragraph tag; and the br / tag.
Comment by Guido on August 1, 2011 at 6:22 pm
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> </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:
}
p.title
{
text-indent:0cm
text-align: center
font-weight: bold
font-size: 2em
margin-top: 6em
margin-bottom: 6em
page-break-before: always;
is coming up with ‘text-align’, font-weight’, etc black or green, whereas in this (pasted in, where I’d typed in the ‘title’ sequence)
p.chapter
{
text-indent: 1em;
font-weight: bold;
font-size: 1.2em;
margin-top: 2em;
margin-bottom: 1em;
page-break-before: always;
the ‘text-indent’, ‘font-weight’, etc words are blue. (I’m using a trial version of TextMate.)
I’m also having trouble getting Calibre to generate a table of contents, despite obediently pasting in
//h:p[re:test(@class, "chapter", "i")]
into the Level 1 TOC (XPath Expression): field in Calibre’s Convert Books dialogue, sprinkling some dried bat powder on my Mac, turning around three times and singing A Nation Once Again.
Comment by Guido on August 3, 2011 at 11:25 am
The reason the colors change are most likely because you forgot to add semicolons at the end of each line in the first example.
As for your TOC, make sure you also fill in the “Structure” settings in Calibre, as described in the tutorial. That should fix your problem.
Comment by lgifford on August 3, 2011 at 11:35 am
Thanks, Guido. In the ‘Structure’ settings, I’ve filled in
//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part|prologue|epilogue\s+', 'i')) or @class = 'chapter']
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.
Comment by Lassal on August 19, 2011 at 2:46 am
Very helpful guide, Guido! Thanks so much for this.
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.
Comment by Lassal on August 19, 2011 at 1:33 pm
Hi Guido,
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.
Comment by Lassal on August 19, 2011 at 1:41 pm
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?
Comment by Guido on August 19, 2011 at 1:49 pm
No, that is not possible. I wish…
Comment by Lassal on August 19, 2011 at 1:49 pm
cross posting.
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.
Sorry to bother you with this. Curious what you will find out.
Comment by Lassal on August 19, 2011 at 1:51 pm
“No, that is not possible. I wish…”
ohhh …
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?
Comment by Lassal on August 19, 2011 at 2:15 pm
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.
Filesize … additional costs … hmmm … Thanks for the info. Will check.
By the way, here is a link to the book I mentioned:
http://amzn.to/nLpBX6
Maybe you can get it in the US Kindle store too.
Thanks again for your time. Much appreciated.
Comment by Lassal on August 19, 2011 at 2:19 pm
Cross posting again.
You are running the book on a Kindle? Maybe you cannot see it there.
I could send you an email with pictures of my iPad screen if you want … Not sure how else to help.
Comment by Lassal on August 19, 2011 at 2:33 pm
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.
Comment by Lassal on August 19, 2011 at 2:44 pm
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.
Comment by Lassal on August 19, 2011 at 3:38 pm
The iPad software allows serious zooming. See here:
http://dark.lassal.de/hidden/zoom/
not pretty – jpg artifacts all over the place. But you can do it – that is why I got confused in the first place.
Too bad it is not part of the actual ebook.
Comment by Jane on August 28, 2011 at 9:13 am
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.
Comment by Jane on August 28, 2011 at 11:46 pm
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.
http://guidohenkel.com/2011/08/the-table-of-contents-in-the-digital-age/
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.
Comment by Jane on August 29, 2011 at 11:18 am
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.
Comment by Sarah Elisabeth on August 29, 2011 at 1:59 pm
Guido,
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.
<a href=”http://www.guidohenkel.com”>http://www.guidohenkel.com </a>
The href part of the tag is the actual URL and the text between the <a> and </a> tags is the clickable text that will be printed on the page.
Comment by Steven Davis on September 1, 2011 at 4:29 pm
What a great tutorial! Thank you very, very much.
I picked up one of your books as thanks!
Comment by Alisa on September 20, 2011 at 2:58 pm
Hi, Guido, I have another question. I put the following in for a title and byline on a title page:
p.title
{
font-weight: bold;
font-size: 5em;
page-break-before: always;
margin-top:5em;
margin-bottom:2em;
}
p.by
{
font-weight: bold;
font-size: 1.5em;
}
and then in the body I have:
<p class=”title”><span class=”centered”>Title</span></p>
<p class=”by”><p class=”centered”><span class=”centered”>By me</span></p>
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?
Thanks again — Alisa
Comment by Guido on September 20, 2011 at 5:51 pm
Try this
<p class=”title”><span class=”centered”>Title</span></p>
<p class=”by centered”><span class=”centered”>By me</span></p>
Comment by Alisa on September 21, 2011 at 12:19 pm
Hmm, that didn’t help the size issue. I wanted the title to be much bigger than all the other type. I wonder if it would present properly in the actual Nook (I’m using the Nook for PC download)?
Even if it doesn’t work, this has been invaluable — thanks so much! I’ll definitely download one of your books to thank you!
Alisa
Comment by Guido on September 21, 2011 at 2:13 pm
The Nook software reader is broken from end to end. Most of the time it crashes and in many cases it doesn’t render eBooks even remotely right.
If you want to take a look at ePubs, get a copy of Adobe Digital Editions , which can be downloaded free from Adobe’s website – http://www.adobe.com/products/digitaleditions/
It is probably the most stable and reliable ePub reader. All other software readers I’ve tried (Nook, Kobo, Stanza, Calibre) were sadly broken in one way or another.
Comment by Alisa on September 24, 2011 at 9:37 pm
Do you have any idea why the toc in mobi would list all of my chapters as “unnamed”?
Thanks — Alisa
Comment by Tahlia Newland on October 4, 2011 at 4:08 pm
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?
Comment by Tahlia Newland on October 5, 2011 at 3:12 pm
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.
Comment by Tahlia Newland on October 5, 2011 at 8:07 pm
I tried it and they came out as written eg The Drorgon Slayers Choice. I tried it without the and the same thing happened. Help!
Comment by Tahlia Newland on October 5, 2011 at 8:23 pm
Ok, so the &rsquo disappeared from my last comment when it posted, I guess koz I had it in greater and less than signs. Slayer&rsquos choice is how it’s coming out for me.
Comment by Tahlia Newland on October 5, 2011 at 8:43 pm
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.
Comment by Tahlia Newland on October 6, 2011 at 3:21 pm
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!
Comment by Simon Jenner on November 7, 2011 at 12:26 am
A huge thank you from me!
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.
Simon
Comment by Rachel Abbott on November 10, 2011 at 8:40 am
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.
Comment by Rachel Abbott on November 11, 2011 at 6:59 am
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.
Comment by Rachel Abbott on November 12, 2011 at 4:57 am
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.
I wrote a piece about this a while ago but you can still find it here – http://guidohenkel.com/2011/08/the-table-of-contents-in-the-digital-age/
Comment by Guido on November 13, 2011 at 5:06 pm
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.
Comment by Rachel Abbott on November 17, 2011 at 5:20 am
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!
Thanks again
Comment by Lassal on December 10, 2011 at 8:49 pm
Guido, really, this is soooo great!
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
//h:p[re:test(@class, "chapter", "i") or re:test(@class, "TOConly", "i") ]
That should do the trick.
Comment by Lassal on December 11, 2011 at 1:14 pm
Thanks Guido,
:):)
from what I can tell, it worked beautifully!
Comment by Lassal on December 12, 2011 at 4:02 pm
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.
p.TOConly
{
visibility: hidden;
display: none;
page-break-before: always;
}
and later…
Weitere Titel
Same with the Impressum a little later …
Any idea?
Thanks, as always.
Comment by Lassal on December 12, 2011 at 4:04 pm
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
<p>
If you do that, it will correctly print as <p> in your comment.
Comment by Lassal on December 12, 2011 at 4:16 pm
<p class=”TOConly centered”><span class=”centered”>Weitere Titel</span></p>
now I got it. Sorry.
Comment by Guido on December 12, 2011 at 4:30 pm
Why do you center this text? It’s not showing up anywhere but in the TOC, anyway, and the NCX TOC entries cannot be styled.
Comment by Lassal on December 12, 2011 at 4:31 pm
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/
Comment by Carol Newman Cronin on January 4, 2012 at 6:37 am
Guido:
Thanks for this incredibly helpful guide. I’ve been through it with great success and I’m about to republish a much better looking “Game of Sails: an Olympic Love Story” as a result.
One aspect I’d like to see more info about is including links, especially in the post-book sections. It seems like a great way to point people toward more info, but I don’t see it addressed here.
Thanks again for all your great info. I’m not a horror fan but have been recommending your series (and this great pub info) to others.
Comment by Dave R on January 8, 2012 at 5:23 am
Guido,
This tutorial is excellent, thanks for your work.
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;
}
p.quote {
text-indent: 0em;
margin-left: 4.5em;
margin-right: 4.5em;
margin-top:1em;
margin-bottom:1em;
text-align: justify;
font-style: italic;
}
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.
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:42 am
Apologies for the multiple post,
Hello Guido,
Thanks for all your help. Just one more question
<p>pre>
<p>p class=”chapter”>2. <p>i><p>span class=”onepoint”> November 8, 2004<p>/span><p>/i><p>/p>
<p>/pre>
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 Frank Coles on January 18, 2012 at 4:34 am
Hi Guido,
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.”
Source: http://bit.ly/xtObLs
Interestingly Kovid considers Calibre a tool for readers rather than producers.
Also including a how to add the other ‘go to’ sections of the book would be useful. EG, the ‘beginning’ just takes me to the copyright page.
Thanks for what you’ve done so far.
Comment by Frank Coles on January 18, 2012 at 6:20 am
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.”
You go to to Covert -> Mobi Output and check “put genrerated TOC at front” – although Kovid doesn’t recommend it.
Comment by Carradee on January 18, 2012 at 6:34 pm
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
)
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.
Comment by Matt on January 28, 2012 at 6:12 am
Thanks for the guide, Guido!
Comment by Sam J on January 30, 2012 at 11:48 am
Thank you! This guide is excellent.
Comment by Josh Irving on February 1, 2012 at 7:12 pm
Hi Guido,
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
Thanks,
Josh
Comment by dayna on February 12, 2012 at 4:17 pm
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
Comment by Angela Korra'ti on February 17, 2012 at 2:49 pm
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.
So thank you very much!
Comment by Joanne on February 17, 2012 at 7:16 pm
Hi Guido,
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!
Joanne
Comment by Joanne on February 17, 2012 at 7:19 pm
P.S. Also on Nook, the page lengths on the screen are all uneven. On Kindle for Mac, they’re uniform. On Nook, sometimes they stop two-thirds of the way down.
Comment by Joanne on February 17, 2012 at 7:20 pm
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.
<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.
Comment by Jens Hildebrand on February 18, 2012 at 1:58 am
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!
Very best,
Jens
Comment by Joanne on February 18, 2012 at 8:52 am
Thanks! Adobe Digital Editions is much better. It still isn’t showing my caps, though. Here’s the code again:
.caps {
font-variant: small-caps;
}
Comment by Joanne on February 18, 2012 at 9:36 am
And here’s the command in the text, though my son says you don’t need to see that:
<span class=”caps”>Tex you want in caps case
Comment by Joanne on February 18, 2012 at 9:37 am
Oops, after the word case it should close with </span>
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-variantproperty 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.
Comment by Joanne on February 18, 2012 at 12:08 pm
Ah, thanks. Sounds like I should probably just take it out. Though if a format doesn’t recognize it, it doesn’t seem to do any damage.
Comment by Ian on February 22, 2012 at 10:00 am
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?
Comment by Ian on February 23, 2012 at 6:58 pm
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.
Again, brilliant tutorial.
Comment by Ian on February 23, 2012 at 7:13 pm
Hello, again
Sorted.
Kept text_indent 1.5em;
then on another class I created, which is called, p.chapter
I wrote
p.chapter
{
text_indent 0em;
}
This keeps the indents on my paragraphs, but allows me to center my headings and images, minus the 1.5em.
Thanks again.
You have got me interested in CSS and HTML
Comment by Guido on February 23, 2012 at 7:53 pm
That’s exactly how you do it.You create a separate style for centered things and set the indentation to 0.
p.centered { text-indent: 0em; text-alignment: center; }
span.centered { text-indent: 0em; text-alignment: center; }
Comment by Natalie on February 26, 2012 at 3:34 pm
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.
Comment by Marjorie F. Baldwin on April 23, 2012 at 3:59 am
Hi Guido,
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
-Friday
@phoenicianbooks
http://about.me/FridayBaldwin
Now Available: Conditioned Response (Phoenician Series #2)
A SciFi Thriller to Remember–if You Can!
https://www.smashwords.com/dashboard/stats/150558
Comment by Guido on April 23, 2012 at 8:06 am
I think I need to point out that I did not write Calibre. That is someone else’s software. I am simply perusing it in my process.
Comment by Marjorie F. Baldwin on April 23, 2012 at 10:31 am
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!
-Friday
@phoenicianbooks
http://about.me/FridayBaldwin
Now Available: Conditioned Response (Phoenician Series #2)
A SciFi Thriller to Remember–if You Can!
https://www.smashwords.com/books/view/150558
Comment by Samuel Toms on April 25, 2012 at 2:42 pm
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.
You have my thanks and gratitude.
Comment by AnnikaHowells on May 6, 2012 at 12:21 am
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!
Comment by Etan Katz on June 3, 2012 at 8:09 am
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.
Comment by Etan Katz on June 3, 2012 at 1:28 pm
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:
p.chapter
{
text-indent: 1.5em;
font-weight: bold;
font-size: 2em;
page-break-before: always;
margin-top:4em;
margin-bottom:0em;
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.
Comment by Antony Mann on November 14, 2012 at 7:46 pm
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.
Legend.
Comment by Rob Cornell on January 2, 2013 at 4:31 pm
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.
Comment by Rob Cornell on January 2, 2013 at 6:59 pm
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?
Forward
Comment by Guido on January 17, 2013 at 1:37 pm
Without seeing the actual code and Calibre set-up it is impossible to say why this would happen.
Comment by Larry on January 17, 2013 at 2:12 pm
”
Forward
”
Calibre is pretty much default although I have tried variations, same result.
This comes back as “unnamed” but does link correctly, so only the title is missing. I tried adding title=”name” but NG.
I let Calibre find tag h2, attribute class=chapter.
Comment by Larry on January 17, 2013 at 2:15 pm
code I posted doesn’t seem to come thru so here it is without the brackets:
div class=”chapter”> /div div
h2 a name=”Forward” id=”ch01″ Forward /a /h2
/div
Comment by Guido on January 17, 2013 at 2:27 pm
Why so complicated? Here’s what I usually do
<p class=”chapter”>Forward</p>
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.
Comment by Joanne on January 25, 2013 at 8:45 am
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.
Comment by Joanne on January 25, 2013 at 10:11 am
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.
Comment by Joanne on January 26, 2013 at 3:13 pm
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.
Comment by Joanne on March 23, 2013 at 3:17 pm
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!
Comment by J Thomas Beaton on May 15, 2013 at 3:15 pm
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.