Hello everybody,
is it possible to customize the Latex Export of Scrivener when using MMD? I prefer using Koma-script (scrartcl).
Thanks a lot,
Chris
Hello everybody,
is it possible to customize the Latex Export of Scrivener when using MMD? I prefer using Koma-script (scrartcl).
Thanks a lot,
Chris
Absolutely. First, do you have your own installation of MMD or are you using Scrivener’s bundled version? If not, it’s a good idea to update as the bundled version is a little old and has some bugs. Follow the directions supplied here. Once you have the MMD folder installed in your Application Support folder, open up the XSLT direct and duplicate [b]article.xslt[/b]
to [b]article-koma.xslt[/b]
, then open that up in a text editor. You’ll see XML declarations which define key portions of the LaTeX preamble; enough to change the document class and so forth. Next step is to tell your documents to use this XSLT. In Scrivener’s File menu, choose MultiMarkdown settings, and add a field called [b]LaTeX XSLT[/b]
. The value for this field should be [b]article-koma.xslt[/b]
. Now when you compile to LaTeX it will come out the way you like.
Once you’ve figured that much how, you might wish to poke around at some of the other XSLTs in the distribution. [b]xhtml2latex.xslt[/b]
is an important one as well as [b]memoir.xslt[/b]
. Most of the variants include these as base generators and then modify or add to them.
Hey Amber,
thank you for your answer. I played around a little and things are not as easy for me as I hoped. I do also not have any html-knowledge…
I need a scrartcl and scrreprt with natbib and german language support.
\documentclass[12pt,oneside,a4paper]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
The article class in Scrivener uses memoir.xlst as a basis which uses xhtml2latex.xslt first. So the MDD file is first converted via xhtml2latex.xslt and this is then included in the memoir.xslt.
Could it be that I first need to create a scrreprt and scrartcl.xslt from memoir.xslt, right? This would take some time…
Has anyone already worked with KOMA so far?
Here’s my scrartcl.xslt. To make this work, you will also need a patched version of xhtml2latex.xslt, to avoid a conflict with the Babel package. Scrivener seems to export the Smartypants (?) language as MMD meta-data, which does, unfortunately, override the \language command, which is already defined in Babel The language meta-data is listed in the MultiMarkdown documentation, so this behaviour probably qualifies as a MultiMarkdown bug.
My XSLT file still loads memoir and xhtml2latex.xslt, but it does also override the definitions that are incompatible with Koma-script.
Thanks for following up with this, signinstranger.
Christian, one other thing you’ll want to do is add:
<xsl:import href="natbib-support.xslt"/>
To [b]scartcl.xslt[/b]
, around line 38, right beneath…
<xsl:import href="memoir.xslt"/>
…as you requested natbib support, and add your preferred cite style and options for including the natbib package in the “latex-document-class” section. From the [b]article-natbib.xslt[/b]
, this is specified as:
\usepackage[round,sort&compress]{natbib}
\setcitestyle{super,open={},close={},comma}
Hey signingstranger and Amber.
Thank you very much for this fast feedback. That certainly saved me a lot of time once come over this matter:
I get the following error message:
warning: failed to load external entity "XSLT/scrartcl-natbib.xslt"
cannot parse XSLT/scrartcl-natbib.xslt
First I only place a copy of scrartcl-natbib.xslt and the “hacked” xhtml2latex.xslt into my default MMD folder /Library/Application\ Support/MultiMarkdown/XSLT. Then I recalled that Scrivener has it´s own MMD Folder /Applications/Productivity/Scrivener.app/Contents/MacOS/MultiMarkdown/XSLT where I changed the 2 files. I still get the same error message.
I also tried to run the MMD-Test-Suite but it says:
/Users/chd/Desktop/Inbox/MMD-Test-Suite/runtest.pl
Can't exec "./MarkdownTest.pl": No such file or directory at /Users/chd/Desktop/Inbox/MMD-Test-Suite/runtest.pl line 16.
I took a look at the script and as I use a “common” path for the installation. If you guys can help with this, I am glad, otherwise I will drop Fletcher a line.
Best regards,
Chris
Hello everybody.
I am still struggling with the latex export to have it the way I want to. For the last weeks and the ones to come I will focus on finishing my text and deal with the formatting stuff later on. Thanks for all the help, but I am somewhat short in time so the less I procrastinate with scrivener and the more I write, the better it is.
Best regards,
Chris
Apologies, I could have sworn I responded to this, but evidently not. The first error does indicate that it cannot find the file, but that rather it cannot execute it. It has a syntax error in it most likely. Would you mind pasting the entire XSLT here in a code block?