Some questions about Scrivener > MMD

  • I have a document with many paragraphs starting with a number (they are numbers of verse lines the text is referring to). MMD transforms all these paragraphs in a numbered list. What is the easiest way to prevent MMD from doing so, and to make it read these numbers simply as numbers, and not as a list code?

  • in Scrivener, under Format > Convert, there is an option to change bold and italics into MMD syntax. But is there a way to do it the other way around: to change MMD syntax into bold and italics?

  • sometimes , I want to insert some LaTeX syntax into my Scrivener document. This should be put between !<-- […] -->; but Scrivener stubbornly changes --> into an arrow. How can I prevent it from doing so? There is no such replacement under System Preferences > Language & Text, nor under Scrivener > Compile > Replacements, nor do I use a an application like Typinator. Nisus is doing the same, but Mellel not. So it’s not system wide. Where could this replacement mechanism be hidden?

Is it a requirement that you must use MMD syntax for the numbering? For instance, “1)” would dodge the problem completely. If you need the “1.” format though, then the way to override parsing without dropping to pure verbatim is to backslash the syntax. So “1. Something” would not parse as a list element. Obviously you wouldn’t want to stare at that all day, or type those in, so using a Replacement during compile would be best to sort that out.

A Regex search for ^(\d+?). to $1\. should do the trick.

Compile. :slight_smile: Or at the very least just run the text through a Markdown service or something.

Make sure you do not have em-dash substitution enabled in Corrections, or it a full arrow glyph—one single Unicode arrow that you can delete with a single backspace? If so, I don’t know how that is happening. It’s not coming from Scrivener, but it’s weird that it’s not system-wide.

Isn’t that one of the additional substitutions available under Corrections Options | Edit Substitutions? It is on Windows anyway, I have no idea about on the Mac…

Yeah on the Mac it’s different. We actually added that whole feature to the Windows set, because with the Mac, text level substitution is system-wide, it’s not coming from Scrivener at all. That is what he was referring to have verified checking in System Preferences (Control Panel, basically).

Ah, okay. Good to know, especially since I’m planning to switch to mac later in the year and would be looking for that.

Thanks a lot, Amber! Regex is still an unknown world for me, but the search you suggested did indeed work perfectly!

The arrow-issue remains to be resolved, but sooner or later I’ll find the solution.

About this arrow: does the --> turn into a proper arrow (one character) or an em dash followed by an angle bracket? Also, at what point does this happen? I’m presuming it’s at some point in the compile process.

What follows is speculation.

So, looking at your original post, you had the latex escaping as:

!<-- {..} -->

If that was a typo in your post you should stop reading now. If not, and you have been using that, the exclamation mark should be after the angle bracket:

<!-- {..} -->

I did some fiddling around in MMD Composer and also Marked, and in both cases if you just have the -->, without a matching <!-- (which would be the case if you had entered !<-- ) then the two hyphens turn into an em dash, giving you the arrow.

Ah, good catch, I missed that displaced exclamation point.

Here is what it does:

[code]^(\d+?).

^ Match must start at the beginning of line
( Start storing what is matched in a variable
Also: a grouping mechanism, but we don’t need
it for that here.
\d Look for a digit

  • Modifies the last match, saying you must
    find at least one or more… digits in this
    case.
    ? Modifies the quantifier (+) to non-greedy.
    Basically: scan forward for the next part of
    the match, not back from the end of the line
    which is how RegEx usually works, outward in.
    We don’t want to capture everything from the
    first digit to the last period on the line.
    ) Stop storing match data into the variable.
    . Find a literal dot. Dot is otherwise a wild-
    card that will match any single character.
    [/code]

So it finds any line starting with one or more digits, and then keeps scanning forward, only considering those lines that start with one or more digits that are immediately followed by a period.

Meanwhile, we store the digits into a variable, which is the $1 in the replacement value, followed by a literal backslash (you have to escape it since it itself is used to escape characters), and then a reapplication of the dot.

Making the arrow as a single object can be accomplished (using Windows… dunno how it will do with Mac) by entering an em dash and Alt 16… --► Looks better if you highlight and embolden the emdash.

May not have come across in this post, but it works in Scrivener. And of course, I haven’t tried it in compile either. Another Dave, perhaps…

Cheers!

CD