Pandoc/MMD/LaTeX/PDF options

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac

Fri May 01, 2020 12:30 pm Post

Hi,
Yet again I find myself about to give up on Scrivener due to the complexity and number of options.
If I am using Pandoc/MMD and want to create a PDF, what compile options should I use? There is no Pandoc -> PDF option.
Should I:
- Convert to plain text, and use Pandoc to convert to PDF?
- Use MMD -> LaTeX, and compile to PDF afterwards?
-Use MMD, and manually use Pandoc afterwards to convert to PDF? Does this stop me using any raw LaTeX in my document (I'm still trying to find out if I can use MMD to put figures and equations in my document)?

For either of these, how do I find out what else I need to do in terms of metadata, post-processing?

thanks,
Emma

User avatar
nontroppo
Posts: 1246
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Fri May 01, 2020 3:30 pm Post

I assume your post here of a slightly later date means you have solved your questions?

It is certainly the case that many roads lead to Rome, and it is hard to say that one road is better than the others. In general the MMD/Pandoc workflow gives you the most flexibility, where you can either use Styles and other Scrivener conveniences (Lists, links, tables, cross-references) that get converted for you, or just type the MMD/Pandoc syntax directly using a ->MMD compile workflow.

You can process the MD file yourself with a script, but you can automate this as Scrivener can call the script for you (post-processing pane in the Compile format editor).

You can mix and match raw LaTeX alongside MMD/Pandoc markdown or Scrivener Styles without issue. You could also do at least your figure referencing in Scrivener, although it can't handle equations at least if they are done in LaTeX, so I think your choice of fig-nos and equation-nos makes sense...
Last edited by nontroppo on Fri May 01, 2020 3:49 pm, edited 1 time in total.

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac

Fri May 01, 2020 3:43 pm Post

Thanks, yes, I think so. I'm compiling to Markdown, then using a post-processing script to use Pandoc to convert this directly to PDF.

I assume that if I want to output to LaTeX rather than a PDF in the future, that I can do so using Pandoc (i.e., MMD to LaTeX manually or in post-processing)?

thanks

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac

Fri May 01, 2020 3:47 pm Post

Actually I do have an additional question about Styles - I'm familiar with HTML/CSS, and in the documentation I think it says that Scrivener styles can be converted to Word styles.
What about PDFs? I've had a go at applying a style to some text, but it seems to be ignored during the conversion process.

I need to create a thesis title page - all large, sans-serif, centre-aligned text. What's the best way to do this, using Styles or otherwise?

many thanks

User avatar
nontroppo
Posts: 1246
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Fri May 01, 2020 4:06 pm Post

elw2u16 wrote:I assume that if I want to output to LaTeX rather than a PDF in the future, that I can do so using Pandoc (i.e., MMD to LaTeX manually or in post-processing)?


It is as simple as changing the pandoc command to --to=latex and --output=mywork.latex — when you make a PDF in pandoc or MMD, they actually make the LaTeX internally then call the tex commands to make the PDF. I always output to LaTeX and build the PDF myself (I call the latexmk command, in my case scrivomatic does it for me). The benefit is you get more log details, and so you can more easily fix mistakes like missing references or other issues.

elw2u16 wrote:I need to create a thesis title page - all large, sans-serif, centre-aligned text. What's the best way to do this, using Styles or otherwise?


This is slightly more challenging. Scrivener styles are really just named containers and Pandoc can convert them, but it needs to know what to put where. For both Pandoc and MMD, you do this by editing the latex template. Pandoc has a templating language, so you can use metadata which gets used to build the custom sections (this is how I get my authors+ affiliations+contributions markup working). There are many premade templates (just search for pandoc thesis). Some LaTeX templates use metadata, but another option is a custom environment.

An even simpler alternative could be just to embed raw latex to do this for you.

User avatar
nontroppo
Posts: 1246
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Fri May 01, 2020 4:16 pm Post

Here is an example:

https://github.com/tompollard/phd_thesi ... thesis.pdf

That uses this raw latex in a markdown file for the thesis title page:

https://raw.githubusercontent.com/tompo ... le_page.md

You could try something similar...

Many more options can be found here: https://github.com/jgm/pandoc/wiki/User ... -templates