Error compiling to epub3 format: asterisks & italics

I’m using Scrivener 3.2.2 (14632) on a Macbook Pro running MacOS Monterrey V12.6. My source file includes the line:

Two feds stopped by this morning to harass me. How’s *your* day going?

The line is in italics.
When I compile to PDF, it compiles correctly, as written. But when I compile to .epub3, it looks like:

Two feds stopped by this morning to harass me. How’s \your* day going?*

The line is in italics except for “your* day going?*”

When I make the asterisks normal font instead of italics, it compiles as intended (though the asterisks are not in italics).

Looks like messed up markdown…

Just a guess, but do you have this setting checked ?
(I think you shouldn’t)

P.S. That is a screenshot from the Windows version, but hopefully the setting is in the same place.

No, that box isn’t checked. Here are my settings:

I would suspect that Markdown is getting confused. The point is a single asterisk before and after a span of text makes it italic. If we take your sentence without the whole sentence being in italic,

Two feds stopped by this morning to harass me. How’s *your* day going?

it will compile to this:

Two feds stopped by this morning to harass me. How’s your day going?

By putting the whole sentence in italic in the Scrivener doc, the asterisks interfere with what should be in italic and what shouldn’t.

*Two feds stopped by this morning to harass me. How’s* your *day going?*

gives you

Two feds stopped by this morning to harass me. How’s your day going?

with the “your” in non-italic. So, if you want it all to be in italic, but you want to mark out the “your”, you’ll either need to use something other than asterisks, or use bold:

Two feds stopped by this morning to harass me. How’s your day going?

HTH, :smile:

Mark

Mark, thanks. What makes this line challenging is, it’s a text message from one character (Raúl) to another character (Porter). The compiled line is in italics to indicate it’s a text message, but Raúl has added asterisks around ‘your’ for emphasis, since he can’t put part of the text message in italics.

I’ve got a workaround, namely, make the asterisks non-italics. The results are satisfactory.

Charles

1 Like

Just sayin: to my knowledge, people use caps, in this very case, when texting.

As I think it’s best not to mix RTF→Markdown with straight Markdown markup, that is probably easiest. Otherwise:

*Two feds stopped by this morning to harass me. How’s \*your\* day going?*

gives:

Two feds stopped by this morning to harass me. How’s *your* day going?

Which is what you wanted, but I’ve not tried putting \*……\* in the middle of an RTF-based text.

Mark

Update: all this should be unnecessary. If it is, the bug is real.

One option is to type some other symbol instead of * (something that doesn’t trigger markdown syntax and isn’t used for anything else) and replace it with * in a Compile replacement rule.

Oops … that would leave the text bracketed by the symbol in italics, so I think I’d use a style for the purpose.

This won’t work if the overall italics formatting of the sentence is styled, but if it’s not, when it comes time that you want regular text in the midst of italics, type the shortcut for a character style called “regular” (for instance), then type the word your (or whatever you need).

Then, in Compile, override that style, being careful to make it regular text, and put * in the style’s prefix and suffix.

1 Like

Thanks, everyone, for your help! So far no one has explained why it compiles as intended to PDF but not to epub.

Because two different compile processes are involved.

When you compile to PDF, Scrivener compiles it to RTF, it’s native format, and then uses the basic Apple PDF generator, or whatever PDF generator is used on Windows, to create the PDF.

ePub is a variety of HTML, so when you compile to ePub, Scrivener creates a Multimarkdown file which it passes to the Multimarkdown engine included within Scrivener which converts it to HTML. So anything enclosed in single asterisks becomes <em>……</em>, the HTML code for emphasis, i.e. italic. So if you want an actual asterisk in your text, you have to escape it by preceding it with a backslash.

As a said in my last post, I’m not sure about putting elements of Markdown code into an RTF-based document, where elements of RTF style like italics need to be compiled to Markdown by the compiler… my projects are either for compiling to RTF or to Markdown and are not mixed. You could try putting \* before and after the “your” and marking them with Format → Preserve Formatting to see if that works for ePub. If it does you’d need to set up a replacement in your PDF-compile format to replace the \*s with nothing.

:smile:

Mark

1 Like

Mark, thanks for the detailed explanation! I learned something.

Charles