The eBook nears after a few detours

Current Draft of Book Cover - Copyright 2015 M. Q. Allen
Book Cover – Copyright 2015 M. Q. Allen

It’s been a longer road than I expected (silly me, I believed Amazon’s FAQs on publishing) but I think I have the eBook recipe ready. A final proofread is still in progress but Prince of Leaf and Stone should be live by end of the month.

The main problems I encountered had to do with getting a TOC (table of contents) in my doc, getting a TOC that comes up from the Kindle menu, getting that TOC to look right, and getting the book to open in the right spot. None of those are showstoppers but getting those right can make a book look more professional.

My experience has been with Scrivener for Windows, which is much less featured than the Mac version, in particular missing a feature that lets you set the start of doc.

Things You’ll Want

You definitely want the Kindle Previewer, which despite it’s name, not only let’s you preview your book, it will convert html and epub files to Amazon’s .mobi format.

You’ll also want Send to Kindle which is both a stand-alone app and something that you can get to from your file browser on a right click, which let’s you upload files to your Kindle (or a friend’s Kindle). Thing to remember: it will only appear on a right click for those file types it can upload (.mobi, .doc, .pdf) and not for others, like .epub.

You may also want KindleGen which is not needed for one-off mobi conversion (Kindle Reader does that) but can be used for bulk conversions. More importantly, if you want to write out .mobi directly from Scrivener, you’ll need KindleGen.

What Doesn’t Work: Scrivener -> MS Word -> HTML

Amazon suggests editing your book in MS Word (Scrivener writes out .doc and many other formats), adding an MS Word TOC, adding bookmarks for where your TOC and start page are, then writing it out as Web page, Filtered (html). You then use Kindle Previewer to convert the html to mobi. This does get you a mobi file and there is a TOC embedded in the document but you don’t see the TOC in the Kindle reader menu nor does the start page get set.

I found lots of kind posts on the web saying this does work or ways to directly edit the html to add the start and toc tag but none of that worked for me. Start and TOC remained stubbornly absent. From the posts I found on this, I’m not the only one who can’t get that to work.

What Also Doesn’t Work: Scrivener -> Mobi

Scrivener can write directly to mobi so I tried that. The table of contents does appear in the doc and from the Kindle menu but the starting position is second page of my TOC. This is apparently an issue of at least 2 years standing, not just an odd quirk of my doc.

The Kindle TOC also puts some but not all of my front matter (copyright, dedication, etc.) under a collapsible header.  No matter how I organize my front matter in Scrivener, it doesn’t seem to group all of the front matter under the header.

Still more failure: Scrivener -> epub -> Kindle Previewer

Scrivener can also write out epub files. Tried that, converted them in Kindle Previewer. Same as the direct mobi path.

What does work: Scrivner -> epub -> edit epub file -> Kindle Previewer

After more research, I discovered that an epub file is easily editable because it is just a .zip file. Rename it to .zip, extract the files– which are all plain text– and rezip it when you are done. It’s surprisingly easy.

What you want to do, according to a forum post here is find the guide part of the file content.opf. This file can be edited with any text editor such as Windows NotePad. You will probably find something like the following at the bottom:

<guide>
<reference type=”cover” title=”Cover” href=”cover.xhtml” />
<reference type=”toc” title=”Contents” href=”contents.xhtml”></reference>
</guide>

Before the </guide> (in html <xxx> is like an open parentheses for a particular object type and </xxx> is like the close parentheses), add the following lines (in bold), replacing body3.xhtml with the chapter you want to start with (you can open the .xhtml files in NotePad or Word or your browser to figure out which one is your chapter one):

<guide>
<reference type=”cover” title=”Cover” href=”cover.xhtml” />
<reference type=”toc” title=”Contents” href=”contents.xhtml” />
<reference type=”text” title=”Text” href=”body3.xhtml” />
<reference type=”text” title=”Start” href=”body3.xhtml”></reference>
</guide>

Actually, I didn’t find a source that said to add both of the bold lines (the various pages I found recommended one or the other) but the first one of the two only seems to fix the front matter grouping problem for me, the second one actually seemed to move the start page.

Full disclosure: this didn’t actually move the start to where I told it to go but it did move it to my title page which is much better than the second page of my TOC. So I’m declaring victory.

The steps that worked for me are:

  1. Write out a .epub file from Scrivener
  2. Change the .epub file to a .zip file and extract it to a temporary directory
  3. Find the content.opf file (which is usually in a sub-directory) and edit it
  4. Add the two extra lines (above) to the guide section and save the file
  5. Make a new zip file
  6. Rename the zip as .epub
  7. Use Kindle Previewer to convert the .epub to a .mobi
  8. Check it out in the previewer (where the start page for me is actually where I want it)
  9. Upload it with Send to Kindle and check it on a real Kindle (where the start page is not where I want it but is in an acceptable place)

This all seems like it is a lot harder than it should be because how hard can it be to specify a TOC and a start page? But there you have it; it is still pretty clunky. And probably buggy: pretty sure the start page should not be different between the Previewer and the Kindle: Amazon has something broken.

You can probably have Kindle Previewer convert the html files directly without making a .epub (i.e., skip steps 5 and 6) but I didn’t try that.

Also, if editing the html is daunting, there is a free program called Sigil that lets you edit .epub files. I didn’t try it because after many hours of messing around, I wanted to write the html exactly as I wanted it.

There are folks who will do all this for you for a fee. I didn’t price it but it shouldn’t be all that much since this process isn’t that hard once you know your way around it.

Advertisements

7 thoughts on “The eBook nears after a few detours

  1. Looking at my code before I head out for our robotics qualifying tournament, I thin there’s an error in the reference text. There should probably be a /> on all but the last line which should be the only one with the . I’ll have to give that a try when i get back (late) tonight.

    1. To my surprise the amended formulation (which I think is more syntactically correct) didn’t change anything. It’s one of the frustrating things about this process: you research something; you find something that seems like it should work; it doesn’t work and there isn’t much feedback to figure out why. In any case, it seems to be working well enough for me now and maybe I’ll look at InDesign, as Alex suggested (side note, was about to add “which I assume is expensive”, then decided to actually check, saw it listed on Amazon as $20- thought wow, that’s much cheaper than I expected, then noticed it was $20 per month or $240 a year. Not outrageous but not for me unless I actually make a little money on this endeavor. I’m just hoping to break even and that one tool would be about a 50% increase in cost, including what I paid for a font and will pay for copyright).

  2. Alex Hurst

    I remember that. It’s a huge headache. I struggled with Word for over a year before I finally switched to InDesign, which is also a headache… but now I can make fixed ePubs and Mobi in a matter of minutes! Saves so much time. 🙂 And the paperbacks look amazing.

    In any case, congrats on your nearing publishing date!

      1. Alex Hurst

        Just while preparing. Once you have style sheets set up in InDesign, its just a matter of importing the text from a .doc file. And you can do so much more, so much more easily.

  3. Pingback: Prince of Leaf and Stone is now live | M. Q. Allen

Comments are closed.