## Scrivener -> MultiMeltDown -> LaTeX

Jo
JohnAtl
Posts: 5
Joined: Sat Apr 02, 2011 11:04 pm
Platform: Mac
I'm porting a project from LaTeX in another editor to Scrivener, hoping I can get more clarity in writing without all the extraneous LaTeX code lying around. I used Scrivener 2 for a couple of years a few years ago. I'm now climbing the steep slopes of Scrivener 3, MMD, pandoc, and LaTeX. Trying to piece together an academic writing (citations, bib, figures, etc.) workflow based on bits and pieces from disparate websites.

Scrivener -> PDF is working fairly well, though my citations aren't replaced with APA-style citations, nor is a bibliography generated (wasn't expecting either one).

Scrivener -> MMD->LaTeX is a mess, as it insists on generating dozens of chapters, and Parts for each major division. Even when I select Article as the LaTeX style. This is an annoyance, but don't need it fixed, as I need pandoc to handle the refs (as far as I know).

Scrivener -> MMD -> pandoc -> LaTeX is broken, as figures are included with illegal commands:

Code: Select all

\includegraphics{Paradigm.png width=891px height=508px}

What's my best course of action?

Problem 2: In LaTeX I used subfigures to create a 2x2 block of figures (as you've probably seen, fig 1a, 1b, etc.). Is there a way to do this with Scrivener->MMD->pandoc->LaTeX?

Question: do I need pandocomatic and scrivomatic?

Thanks

nontroppo
Posts: 911
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One
To answer your last question first, no you don't need pandocomatic/scrivomatic, they simply make automated compiling easier (say you want two sets of LaTeX settings/templates for different needs like CVs, letters, articles, books etc. this can be configured with a single line in Scrivener's metadata), but will not solve problems you are having that are more closely linked to the core workflow. Get the core workflow working first, then you can refine later.

Conceptually, you do not need to think you are using "MMD", as Scrivener 3 supports Pandoc directly (the fact the compile target is called MultiMarkDown is just due to history from Scrivener 2, technically it should be just called Markdown IMO). Pandoc has more robust support for bibliographies (you can use CiteProc to generate bibliographies before LaTeX is invoked or BibLaTeX itself as you prefer), and more flexible syntax overall. It also has a large active academic LaTeX community and helpful support group.

First off make sure you have Pandoc enabled in your compile format:
Screen Shot 2017-12-18 at 09.38.01_SMALL.png (20.26 KiB) Viewed 591 times

Problem 1: Regarding your problem with figures, I cannot reproduce this. If I use this Pandoc markup in Scrivener:

Code: Select all

![The city of Isidora, from Italo Calvino’s Invisible Cities](ISIDORA.jpg){width=50%}

I get this in my LaTeX:

Code: Select all

\begin{figure}\centering\includegraphics[width=0.5\textwidth,height=\textheight]{ISIDORA.jpg}\caption{The city of Isidora, from Italo Calvino's Invisible Cities}\end{figure}

In Scrivener 3 you can also link images from the binder and use a caption style (§21.4.1 user manual), which generates the Pandoc markup for you directly, and if you scale the image in the editor, Scrivener will again generate the correct pandoc markup for you which gets converted into LaTeX correctly (at least it does for me).

Problem 2: This one is thornier. The simplest solution[1] is that you use RAW LaTeX in the editor for subfigures; this gets passed through Scrivener+Pandoc to LaTex without modification so will work (see raw_tex and raw_attribute in the Pandoc manual to see how to do this). Another solution is to use pandoc-crossref which supports cross-referencing pandoc figures with an enclosing <div> as subfigures: https://github.com/lierdakil/pandoc-crossref — There may be other solutions[2] if you ask on the Pandoc Google Group (lots of Pandoc+LaTeX users and they are often very helpful). Pandoc supports subfigures in the LaTeX reader already, but not the other Pandoc readers yet; but this is being developed (https://github.com/jgm/pandoc/issues/3177)...

-----
[1] well the simplest solution is to make your figures multi-panel in your graphics editor which is what I do; at least for biology with many panels manual placement in an image editor is always far more optimal...
[2] for example ScholDoc is a fork of Pandoc that supports subfigures, but development on Scholarly markdown is much slower than Pandoc itself: http://scholarlymarkdown.com/Scholarly- ... oating-env