MMD3 and XSLT

So far I used MMD2 with customised XSLT files to produce LaTeX/PDF output. I installed MMD3 on a none production Mac and learned, that the “default mode” for LaTeX output is straight forward but rather limited. What I couldn’t figure out so far is how to configure Scrivener and/or MMD3 to use the “advanced mode” (=using the XSLT files)? Does it need a certain entry in the meta data?

Have you installed the helper scripts into your ~/Library/Application Support/MultiMarkdown folder? I’m pretty sure that if you do that, Scrivener will automatically work in XSLT mode. I’ve not tested this yet though, as I have not had the time to replace such an integral tool that has so dramatically changed. How Scrivener will handle this in the future is yet to be decided, but there might be a checkbox somewhere that enables advanced mode.

I really wish there was a way to better customise the inline results of the built-in LaTeX generator though, as it is blisteringly fast.

Yes, those helper/support files are installed. If they weren’t, Scrivener would use its internal MMD files, correct? :wink:

I did a little bit more testing and found a solution. Scrivener calls the helper file “mmd2LaTeX.pl” to produce the LaTeX output. In MMD3 this file contains the command to use the “direct” LaTeX mode. Fletcher kindly also included the file “mmd2tex-xslt”, which uses the XSLT mode.

I made a backup of “mmd2LaTeX.pl” and then filled it with the code of “mmd2tex-xslt”. This works!

There was only a small hickup. You need to put quotation marks around the path pointing to the XSLT files: “$xslt_path/…/XSLT/$mode”. Otherwise the part “Application Support” will cause problems.

The checkbox you mentioned could just decide whether to use “mmd2LaTeX.pl” or “mmd2tex-xslt”.

Hope my findings will help.

Found the same “hiccup” on this end, but still haven’t seen a full LaTeX file out of an .md file, or out of scrivener.

Was there anything else you had to do to get the full LaTeX preamble etc?

This is with an XSLT file that works just fine with MMD2 and its old mmd->xhtml->xslt->latex route.

Yes, that is the way the new MMD works. Rather than producing the entire .tex file using a deep chain of dependencies and scripts to do so, it just uses input files for the preamble and footer stuff. That way if you want to tweak the MMD output just a bit, you don’t have to go into that huge XSLT maze to change one little thing, like the base font size for the document. Now you just edit the .tex file used as the input for the preamble. There are some demonstration class sets linked from the github page, also, that would be useful to see as an example. But you can build your own preamble and footer files, and using the new “LaTeX Input” meta-data field, and build document classes from scratch.

The other thing that is different with MMD3, in this regard, is that there is no explicit “Format:complete” flag any more. A document is processed as full if it meets certain meta-data criteria. The presence of a “Title” would be enough to trigger full document mode. So if you are processing .md files without any meta-data, they will come through in snippet mode.

Hi Ioa,

I did eventually figure that out, but my question was referring to the comment about explicitly using the mmd2tex-xslt script from mmd3 on an xslt that had worked in mmd2. I’m going to try to migrate my format over to mmd3 eventually, but it didn’t do as described so I was wondering what other steps were required to make that xslt-specific script work.

I have to find another method to convert

headers to a scenebreak marker. Currently I have the

tag substituted with a \scenebreak macro (centered #) when it’s not directly following an

(chapter title), and the scene title discarded because it’s only there to get that

in there. But that’s another question for another day. I just want to get something printed at lulu while they still have that one free proof copy promo going :slight_smile: