Scrivener 2 + MMD3 guide

I’ve written up my approach to integrating MMD3 with Scrivener at wp.me/pgbT-kq

Comments and corrections appreciated.

Quite easy, actually. The way the support package works is that it places helper scripts in an expected override location that Scrivener checks whenever you compile. It looks in ~/Application Support/MultiMarkdown/bin, and if it finds the necessary scripts, proceeds with using that instead of its own embedded copy. Thus, to revert or temporarily switch between MMD3 and 2 (something I find myself doing, as some of my more complex projects have not been “ported” to MMD3), simply rename the MultiMarkdown folder to something else temporarily. Then Scrivener will lose track of it and go back to using its own—or if you have a custom MMD2 folder, swap them in and out of Application Support to switch versions.

You can reference those section heading based labels reasonably easily. If you want a numeric cross-reference to your subsection Why computers drives me mad then use the placeholder:

 ... to understand why, see [](#whycomputersdrivememad)

That will then compile into a reference in Latex. The manual will tell you more about the various options.

You can also create shorter or more specific labels by adding square bracketted text in the Scrivener section title, after the ‘real’ title: I use this in training manuals where each chapter has an Overiew:

Overview [ovchap1]

Which can then be used:

... as I said right at the beginning in [](#ovchap1) ...

Thanks for the tips. I’ve updated my blog accordingly.

Thanks! It’s a nice post, I’ve set this link topic to sticky.

Where do you place your Latex footer and Latex input files?

They should go into your texmf folder, wherever that is. With the MacTeX distribution it’s in your user Library, so:

~/Library/texmf/tex/latex/mmd

Is there a log of what is happening (which commands called where) to generate the .tex compiled file? Has anyone used a homebrew[1] installed MMD3 with any success?

Also for those who are using the MacTex 2011 basic install (a minimal set of packages, much less cruft), you need to install additional packages (layouts, glossaries, xfor, etoolbox, tabulary at the least), before the MMD compiled tex (using MMD-memoir anyway) files will work…

Thanks, Ian


[1] Excellent OS X package manager: mxcl.github.com/homebrew/

In MMD3 the conversion is done entirely inside the MMD binary. It goes straight from plain-text markup to .tex code, there aren’t any of the SmartyPants, xsltproc, etc command chains any longer. So if you want to see how that happens, you’ll need to know a little C and download the source code.

Thanks Amber, so Scrivener I assume calls ~/Library/Application Support/MultiMarkdown/bin/mmd2LaTeX.pl? This perl script call multimarkdown, and thus whatever is in my path is what actually gets used. So I should be able to use MMD3 installed via homebrew if that is what Scrivener is using, and editing that perl script could be used for hand-tweaking text before conversion?

Do you know what the plans are for migrating Scrivener to MMD3? I assume the problems with image captions etc. would be fixed then…

Yup! That is in fact something that I do myself. I use custom meta-data for title IDs when necessary, which means I end up with a bunch of empty brackets in titles from the compile suffix. I use a regexp to clean them out before handing things off to the rest of the code.

Captions are, as far as I know, settled. Right now most of my time is helping Windows get prepped, so it’s a bandwidth issue.

Hi AmberV, does captions being settled mean this fix made it into scrivener (beta I’d assume) already, or that it will be fixed when Scrivener does migrate to MMD3?

Thanks as always for your help!

It means that Fletcher has decided to leave captions as they were originally designed for MMD3. It means that until Scrivener uses MMD3 and is updated for it, you shouldn’t use the inline image + “caption” method.

Hi All, the current beta of Scrivener now uses MMD3 — do you have any details about its implementation that would be useful for us who love to live on the edge? 8)

Okay, I’ve put together a quick-and-dirty PDF of the new MultiMarkdown chapter from the user manual WIP. It has been in overall greatly expanded and should hopefully be a better resource for people looking to use the system.

Preview MultiMarkdown Chapter

A note on content: all annotations left in. Most contain Mac-only text (this section is now cross-platform), but a few are tip boxes. There are a few sections that are Mac only; I just left them all on. For Windows, ignore “Preserve Formatting”, RTF, XSLT Post-processing, and Updating MultiMarkdown.

Wonderful documentation, thank you AmberV!!!

Hi guys,

is it possible to use Scrivener Links to replace sec_title in a command like:

see

so that changes on the titles directly will be corrected in the cross reference?

thanks!

Not automatically, because Scrivener doesn’t make the assumption that the text of a hyperlink is supposed to be the name of the item it is linked with. There would be no realistic way for it to know that “Orange Cat” should be updated to “The Orange Cat” on compile, but that “read the supplementary data” should not be changed to “Meerkat Territorial Patterns”.

However, you being human are much better suited at looking at those two and seeing which should be updated. So you can simply right-click on a hyperlink that is out of date and use the “Update Links to Use Target Titles” menu command. If all of your hyperlinks are title text, then you can just select large chunks of text and update them all at once.