I spent the weekend converting two books, originally in RTF format (NisusWriter), into the MOBI (Kindle) and the ePUB (iBooks) formats. I’ll just share the issues I’ve met and the solutions I’ve found, in case anyone finds them useful. I also have a couple of questions to Keith, or to someone who knows more that I do on these matters.
First, I worked on Book 1, compiling from Scrivener to MOBI. Everything looked fine, but whatever combination I used of original layout, formatting options in Compile, and “overriding” the formatting options, the output MOBI text was right-aligned. Right or wrong as it may be, Amazon does not like this. Trying to isolate the problem, I followed the ConflictCatcher method (remember?) and began to delete portions of text until the output file was left-aligned only. Then I added bits of the deleted portions, until text was right-aligned again. Deleting and adding, adding and deleting, I came to the point when adding a single letter caused the whole book to become right-aligned.
Then it occurred to me that I wasn’t obliged to compile directly to MOBI: I could compile to ePUB, feed the ePUB to KindleGen, and let it convert to MOBI. Result: The whole file was left-aligned only, both on the Kindle Previewer and on a Kindle PaperWhite. I also opened the ePUB file with iBooks on an iPad, and the text was left-aligned. And when I changed the iBooks preferences to Full Justification, text was both left- and right- aligned.
Question to Keith (if you have time to waste): I used exactly the same formatting options for both conversions. Are there differences in Scrivener’s conversion routines to ePUB and to MOBI?
With Book 2, the experience was quite different. Having learnt the trick, I did the same Scrivener > ePUB > KindleGen > MOBI conversions. But while the MOBI version opened perfectly in the Kindle (left-aligned only), the ePUB version wouldn’t open at all in iBooks. The error message was something like “Incorrect Format”. I checked the ePUB file with the validator at epubconversion.com, and the report was that the “content.opf” file was missing. Apparently, KindleGen was able to produce the “content.opf” file from the ePUB version while converting to MOBI, but iBooks would not open the ePUB version if it lacked “content.opf”.
The solution was to use Calibre. I uploaded the MOBI file and asked Calibre to convert it back to ePUB. This ePUB version validated with no errors, and it opened in iBooks on the iPad.
Another question to Keith (is you have any more time to waste): What can the reason be for Scrivener not producing the “content.opf” file? Here I’m mainly asking for advice. The structure of Book 2 in the Binder was a bit complex, with chapter subsections nested within the chapter. While compiling for ePUB, I noticed that a nested file should not begin with its title, or the title would appear twice in the MOBI file after conversion with KindleGen. Can this relatively complex structure be the reason why Scrivener’s ePUB file lacked a Table of Contents, and was impossible to open in iBooks?
PS. Actually I have one more question to Keith: In section 24.11.3 of the Scrivener Manual (version 2.5) you write, “Preserve Formatting only preserves Adjusts how the Format > Formatting > Preserve Formatting feature works”, and you refer to sec. 22.4.4, which is about MultiMarkdown. Does Preserve Formatting also applies when one compiles to other formats, e.g. MOBI or ePUB?