Friday, November 21, 2014

Fixing a epub non-conforming error for Smashwords

The book I just released on Smashwords had a few errors in format. They're now fixed, but it took a few tricks.

1. The index wasn't coming up properly. It worked in both Libre-Office and Word, but not in the conversion.
2. There was a mysterious '1.' appearing in front of each chapter.
3. There were mysterious conversions between normal font and superscript. This was due to some embedded error in the document, that even the "nuclear option" didn't fix.

To fix the mysterious superscripts, I wrote an RTF file and then manually parsed the contents. There were several places where things like \cs15\super\... were appearing that shouldn't.  I manually removed them, stopping at the \rltch. \rltch appears to stand for a division and removing that causes things to disappear. (Least I sound like superwoman, Alberta Einstein, or Lady Lovelace, RTF is a regular context-independent language. Blocks of code are delimited by squirrelly brackets '{' or '}'. So all I had to do was find where it was correct and make the bad places look the same as the correct ones!)

To fix the index. I put the RTF file in word and then removed the hyperlinks, one by one. It appeared I'd double linked one item. It thoroughly confused the conversion program.

The mysterious '1.' was the final thing. It turned out there was an extra line in the Header 3 that was used for each chapter.

By the way, the technique of manual creation of the index contents and linking to "Bookmarks"  that is described in chapter 20 of the smashwords style guide works better than the automatic table of contents creation in the new libre office.