ePub 3

Keith, I wasn’t sure where to post this. This is a low-priority question of understanding about ePub 3 - not a bug, technical issue, support request or feature request. I am still learning how to compile to ePub 3. Previous assistance from you has helped immensely.

Today, I produced a simple test file, then created ePub 3 documents from Apple Pages and from Scrivener (using the default Ebook format). You will know the current version of Pages only produces ePub 3, not ePub 2. Below is the result. The Pages output looks fine, but the Scrivener output distorts font sizes and other font characteristics (e.g., superscripts).

For my test, I did not use Styles in Pages or Scrivener. You previously helped me understand that, with ePub 3 in Scrivener, I need to use Styles to get the fonts to come out correctly. I understand this, and I now know how to do it.

The fact that I don’t have to use Styles in Pages but DO have to use Styles in Scrivener to get the correct ePub 3 output suggests to me that one or more underlying design principles drives the use of Styles in Scrivener. Is this correct? I guess I am just curious, What is it about the Scrivener compile-to-ePub 3 process that requires the use of Styles, whereas in Pages it “just works”?

Thank you for continuing to help build my understanding on this topic.

You only need to use styles if you want to have coloured text or such - for text that looks different. This is because ePub 3 requires HTML5 and Apple provides no rich text to HTML converter (they’ll have built their own for Pages but do not make it available to developers). Therefore, Scrivener has to convert the rich text to MultiMarkdown and then convert that to HTML5. This requires using styles for text that looks particularly different. However, it also creates much cleaner HTML and CSS anyway. (Of course, users shouldn’t need to worry about the internal mechanics.)

If you don’t like this approach, you can just stick to using ePub 2.

EDIT: Some additional points:

  1. The reason the superscript is missing is down to a bug in the version of MMD we use which means that superscript will only work when it follows other characters directly. So, if you superscript ordinals in 1st, 2nd, 3rd etc, that will work - just not superscript on its own. I’ve hopefully worked around this limitation for the next update.

  2. Fonts themselves should not be included in an ePub file, so I would warn against using Pages in that regard. There are a couple of issues here. For a start, Pages is set to “Embed Fonts” by default (click the “Advanced Options” in Pages’ ePub export pane to see this). This is a Bad Idea. To embed a font into an ePub file, you must have permission to do so - by which I mean, you must have licensing rights to that font. Just because a font comes installed on your computer, that does not mean that you are legally entitled to use it in an ebook. In fact, you almost certainly are not. For instance, to embed Arial in an ebook will cost you £170 - that’s how much it costs to licence the Arial font for an ebook. And that is for one book only - if you want to use Arial in another ebook, that will cost you another £170. So you should never embed a font in an ebook unless you have explicitly purchased a licence for that font that covers ebook usage.

  3. Even if you turn off “Embed Fonts” in Pages, Pages still includes the font information in the ePub file, which is a little odd. That might look great in Books on your Mac, which has all of those fonts installed, but on another e-reader it won’t look as you expect. It is almost always best not to include any fonts and to let the e-reader (and the reader) determine the font instead.

  4. Font sizes, indents etc. At the moment, all of this is determined by styles. This is no different from most other (non-ebook) formats if you have override formatting turned on, though. If you turn override formatting on in any other format, you will lose font sizes and indents as they become homogenised by the override format anyway. I may be able to make it so that “as-is” and turning of formatting override works with ebooks to an extent in a future update, but I would still recommend using styles for this as you will get better results.

All the best,

Thank you Keith for taking the time to respond so fully. I appreciate it.

The good news is that in the past week I have made a number of enhancements to ePub 3 support. Although you’ll still get better results if you use styles with ePub 3, as of 3.1 you will also be able to use direct formatting and editor format, just as you can with other formats.

I completely missed this additional comment from Keith in a 2018 thread. It seems like big news, so let me make sure I understand it correctly.

If I format my text in editor with bold, italics, color, superscript, etc, but use no styles whatsoever, does that mean my text will be reflected correctly in the compiled ePub 3 file?