Great! Thanks for posting the solution for anyone else that may need it.
So one thing that you may want to fix, it looks like you are using -f markdown_mmd
, which is what you would need if you were generating MultiMarkdown from Scrivener, but if you tick the Use Pandoc syntax checkbox at the top of the Processing pane, you probably don’t want it set that way.
The “base header level” metadata should be inert with Pandoc. It does have a similar mechanism (basically this setting would treat top level headings “#” as second level headings “##” for purposes of conversion, meaning top level becomes <h2>), but it is driven by a command-line flag. As for where it is coming from, I’m not sure, but the two places in Scrivener it would come from are the Metadata tab in compile overview, or the same named pane in the Format designer.
It’s not a big deal, but I would love to get rid of it. I also think I could have pandoc produce a very acceptable pdf, if I could only add one additional line of latex…
I agree, I much prefer indented paragraphs to spacing. This is fortunately very easy to fix. Just edit the compile format, and in the Metadata pane, add a key for indent
and set its value to true
.
If you’re curious as to what that actually does, particularly if you want to change the indent amount, or simply make it so Pandoc doesn’t generate LaTeX that way for any documents going forward, read on.
Pandoc customisation
So where does ‘indent’ come from and how can you tweak it? Pandoc is very customisable! Here’s a simple way to try it out, which will override the default LaTeX output (including PDF) for all Pandoc output. You can read more about this in the Templates chapter—if you wanted different output templates for different projects, then you can do that as well.
$ mkdir -p ~/.pandoc/templates
$ pandoc -D latex > ~/.pandoc/templates/default.latex
In the resulting file, you’ll note a lot of Pandoc-specific conditional template code that is pretty easy to read around. Basically for this specific thing you just want to find where it is overriding the default LaTeX look and remove that bit. What you’re looking for should look like this:
$if(indent)$
$else$
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
$endif$
So that is how you can look for a document variable, (indent: true
in this case) and modify the output of the preamble. You could also just delete this entire section and leave paragraph policy default no matter what.
But that’s going to be useful if you want to tweak any aspect of the output, naturally. There are further things you can do, such as creating your own filter (Lua scripting), which gives you complete control over the syntax level output as well—i.e. what happens when you italicise something in Scrivener can be changed from \emph{text} to your own macro, etc.