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



202 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!