And it works: I get my docx perfectly formatted But without equations…
My question: how to improve this workflow to include LaTex equations?
As I understand, my workflow at the moment has the following logic:
write sth in scrivener > export to pure markdown > send this markdown to bash script, which generates (via pandoc) docx file.
I spent hours on trying different options to include latex equations, and failed.
Especially, I’ve played with Pandoc Multimarkdown outside the scrivener: created a sample file with equations in the form of:
$$ x^2 = 15 $$
which has been correctly converted from markdown to docx by pandoc. Unfortunately, when I put this into Scrivener doc, it doesn’t show up as equation. So, I’m stuck…
I would appreciate Your help on this workflow. Especially some tips on eg.:
should I move from Multimorkdown export to eg. Pandoc > docx offered by Scrivener? If yes: how can I implement elements of my bash script (eg. calling my library, citation styles or MS Word template)?
or should I write my equations in some other format in Scrivener?
or tweak my current export settings?
I’m aware that the solution may be somewhere in this discussion forum (apologies than…), but after so many hours I simply give up.
Scrivener allows you to tell the Compile command to treat designated styles as raw LaTeX markup. See Section 24.5.3 in the Scrivener manual. That will pass your equation (or other) markup straight through to whatever post-processing tool you prefer.
I would say that the challenge here is not getting your equations out of Scrivener, but getting them in to Word, which uses its own proprietary equation tool.
Scrivener also supports MathType equations, but in my experience the results of importing those into Word can be mixed.
For Pandoc, you want to make sure that Pandoc is properly parsing the maths for you (don’t specify it as raw LaTeX). It should do this by default as long as you markup correctly, you can see in my example workflow using styles:
This should create simple inline/block syntax that Pandoc will convert to Microsoft’s proprietary maths in Word, while still remaining compatible with HTML/LaTeX outputs too…
By the way, Pandoc V2.8+ now has a neat option to specify groups of settings (a simplified version of pandocomatic), and this means you can use Scrivener’s compile formats to drive different outputs, see some examples here: