MMD misinterprets LaTeX-style quotes

Create a new project, and in its file type the following line:

Text'' text’’

(Note that those final quotes are two single quotes, although they may look like a double quote here.) Now export through MultiMarkdown to LaTeX. In the generated .tex file, this text appears as


Those final quotes are still two pairs of single quotes, as they should be, but the two `` pairs have been turned into the beginning and end of a \texttt block. (exporting to MMD leaves them alone; it’s in the step from MMD to LaTeX where they get munged)

Is this intentional? If so, how do I turn it off? (I haven’t found where it’s happening in the xslt files.)

Sorry, forgot to mention: this is with MMD version 2.0.b5.

Is there any specific reason for why you need to specify quotes like this in the MMD source file? SmartyPants will do this conversion for you, letting you use standard “dumb” quotes <-- like that. They will get converted to typographic equivalents when exporting to HTML (and subsequently, RTF), and to `` & ‘’ notation in the produced LaTeX file.

The reason why you are seeing what you are seeing is that the back-tick ` symbol is used to wrap a code block, and it looks like the regexp is doing a greedy search and strip of further interior back-ticks, resulting in the first part of your example getting wrapped in a \texttt{} block.

So to disable this, you would have to strip out the Perl code that is parsing in-line code blocks.

Or, since you are using beta 5, you could put these sections that require direct quoting into HTML comments, which will get passed straight into the LaTeX file without intermediate translation.

<!-- ``test'' ``test'' -->

Would then appear precisely as that. Useful if you are only thinking of LaTeX export. Obviously if you are going to be requiring HTML or RTF export, that will not do, as it will be hidden from view.

MMD is doing the right thing here (just as regular Markdown would).

As AmberV mentioned, you are telling Markdown to put the <Text’'> into a code block, which it then obediently did.


Yes. I have a couple of large, ongoing projects written with LaTeX. I’m experimenting with using Scrivener as a writing aid for a new project, but I’m not going to convert those existing projects – for one thing, there are too many external dependencies. When I’m editing source that’s going to go through LaTeX, though, I’d really like the source code to use the same markup as much as possible. In particular, I don’t want to have to use one form of quote mark for some projects and another form for others. That’s just too error-prone.

Scrivener’s editor isn’t oriented toward LaTeX (just an observation, not a criticism – that’s not its target), and I use TextMate for most of my editing. With TextMate’s “Edit in TextMate” service, I can click in a Scrivener edit window, hit Ctrl-Cmd-E to transfer its text to TextMate, edit it, and save it back to Scrivener’s window with Cmd-S. (Not quite as seamless as I’d like, but easy enough to deal with.) That way, it doesn’t matter whether I’m using Scrivener or a TextMate project to organize the text. It all works the same way. (Yes, I’m using clean-text-allow-latex.xslt in the MMD->LaTeX translation, so that I can embed ordinary LaTeX macros in the text; MMD just doesn’t have the flexibility that I need.)

Okay, thanks. As I said in my reply to Amber, I’m trying to using TextMate to edit text, and Scrivener to organize it. MMD’s orientation is different from mine, so it might not be the right tool.

I’d agree with your observations. Scrivener was never meant to be a LaTeX editor, nor was MMD for that matter. MMD is designed to be an engine for turning Markdown files into a variety of formats through the automated usage of XSLT files and the clean XHTML that Markdown produces, and to provide some extra syntax that MD itself does not support. Markdown was always meant to be a front-end, easy to read way to assemble XHTML documents. So you could extrapolate that to MMD and say that it is meant to be a front-end easy to read way of assembling a variety of document formats, LaTeX included; but never meant to be an alternative way to edit LaTeX files. The pass-through support is largely there for special cases where MMD/Markdown syntax does not support a feature, not so much as a way to augment existing LaTeX files.

Scrivener, on the other hand, was never meant to be anything other than an RTF editor. The MMD support is largely a bonus, and it allows Scrivener to become a multi-format pre-assembly engine. You might have better luck using Scrivener’s plain-text export, rather than MMD exports. Then you would just keep your raw LaTeX files in Scrivener, and you could have them separated into usable chunks with preamble material at the top. I’ve never tried that, but theoretically it should work. But if your source documents are already LaTeX—there is no need to use MMD.

That’s what I’ve done, having finally figured out that MMD wasn’t the right tool. This project is a book, so it has a top-level file that does all the setup, then includes each of the chapters from its own file. So Scrivener now holds all of the chapters.