Help with embedded LaTeX + a big question

Two problems, looking for solutions.

Problem 1
I want to be able to write in Scrivener, with LaTeX citation keys, tables, equations, etc. I’ve parsed these forums and am slightly confused about all the solutions found. I want to be able to write into Scrivener, using regular styling (if possible), and to compile using regular compile styles and have LaTeX stuff figure itself out. Not sure how I can do this.

I have pandoc and have used it before. I have basic command line knowledge. I am on macOS. My Scrivener knowledge is slightly above noob level (I finished the entire tutorial project and am in the process of reading the user manual).

Please help!

Problem 2
Take a look at these articles:

What are the benefits of Scrivener over Text Editor + MMD/LaTeX + pandoc?

Citations, tables, figures, formatting (using pandoc’s “–reference-doc” parameter), and other things are doable with the combo listed above. Scrivener killer features like split panes, binder, and compile are replicable as well. So, what makes Scrivener better? What makes it worth the $67 over the free combo listed above?

Thanks in advance!

[size=150]Problem 1:[/size]

There are a plethora of ways to do something in Scrivener, and this can either be liberating or discouraging! I can only offer my opinion, and I would argue the “best” trade-off use of Scrivener combined with markdown outputs comes from using the Hybrid approach described in the Manual (§24.1). My workflow depends on this “mode”, as does AmberV’s production of the Scrivener manual itself. If you know you are only going to output to LaTeX then you can use the LaTeX template, but my personal view is this restricts you in the future. Markdown can compile to LaTeX, but gives lots of other outputs too. As an example I normally always output a PDF via LaTeX (as it looks nicer), and simultaneously a Word DOCX for when a collaborator needs it. Pandoc makes it trivial. So if I were you this is what I’d do:

  1. Use styles for everything: strong, emphasis, underline, inline-code, inline math, captions, code blocks, maths blocks, admonitions etc. My sample workflow gives you an idea of what this looks like. I’d use Scrivener’s built-in tools for footnotes, links, lists, tables & cross-references. The caveat is numbering equations, which if you need it to be robust, I’d switch over to use pandoc-crossref for all cross-referencing.
  2. For any embedded LaTeX not supported by markdown conversion, use block and inline formatting to let the markdown engine know it should pass this out for LaTeX outputs only. I would make this a STYLE. This means if you compile to DOCX/text/HTML those bits are cleanly removed, but pass through for LaTeX. Pandoc does allow you to just use raw LaTeX directly without needing to mark it up, this is quicker, but less flexible for multiple outputs.
  3. Compile to Multimarkdown with Pandoc enabled in the post-processing pane. Use the Style pane to create the correct markdown (my sample workflow, and AmberV’s Scrivener manual project can serve as a reference).
  4. In post-processing, enter the Pandoc command to generate LaTeX or PDF directly (enable pandoc-citeproc if you have a bibliography). You can provide your own templates.

[size=150]Problem 2[/size]

I’ve grown to love Visual Studio Code (better IMO than Atom), and such tools now provide an insane amount of configurability, and for VSCode the LaTeX and Markdown extensions are both really really good. If I was forced I would adapt to use them (using folders+files to reproduce the scrivener binder hierarchy). But the flow of Binder + Outliner + Inspector + Editor for both hierarchy management and research-materials cannot be reproduced in text editors. Renaming and moving a section across the full hierarchy may requires some folder+ file manipulation in an editor (though the file management features are really good in VSCode), it is more flexible with Scrivener. You can apply metadata in a consistent manner (which chapters are first-draft, second-draft or final for example, all viewable in the editor), which is feasible with file naming or perhaps a file metadata extension, but not so easy. For research materials, if they are already in another management tool like DevonThink, then I think there would be an argument that DevonThink+VSCode could be close in workflow. But all this just “flows” better for me in Scrivener, and I admit I am “locked-in” to Scrivener willingly to get this smoothness. I personally wish the source was stored as text in the project rather than RTF (and I could use Git; though snapshots do work well for me too), but that is a quite minor trifle. Now perhaps you don’t use lots of research materials, and write “straight” without much rearrangement of sections, at which point the IMO clear management advantage of Scrivener is weakened. Or perhaps you don’t mind juggling different PDF viewers, reference software, graphics programs, file management tools and browsers alongside your writing environment, again muting the advantage of Scrivener’s integrated environment. Oh, we didn’t even mention the great Scrivenings Mode, this justifies Scrivener almost single-handedly compared to a text editor IMO :wink:!

Summary: modern text editors are awesome, but still cannot reproduce the integrated flow to see your writing at different scales together with your research and rearrange it at will.

Thanks so much for the detailed answer!

The Scrivener workflow listed is very helpful. It’s clarified a lot of my questions about this kind of workflow within Scrivener

Your explanation of Scrivener compared to text editors + utilities is a good one as well. I would like to note you can easily replicate Scrivenings (which is really a killer feature IMO) using this command:

cat [file names] >

However, Scrivener is much more convenient.

I’ll continue to explore both options and will see which one works best.

At best, that’s a weak facsimile of Scrivenings, not an easy replication. The whole point of Scrivenings is that it happens dynamically and automatically – you don’t have to worry about hand-assembling your various component documents together. This becomes especially evident if you have a document hierarchy more than one level deep.

Very true. However, I could always write a bash script/Automator service/AppleScript to automatically pull all the files from different layers to create the “Scrivening”. Then, once I’m done editing/viewing the “Scrivening”, I could split it and overwrite all the other files, again using a script of some sort.

Would be messy to set up for sure, and not nearly as convenient as how Scrivener does it. But a whole lot cheaper.

[size=150]Problem 1:[/size]

[*]Use styles for everything: strong, emphasis, underline, inline-code, inline math, captions, code blocks, maths blocks, admonitions etc. My sample workflow gives you an idea of what this looks like. I’d use Scrivener’s built-in tools for footnotes, links, lists, tables & cross-references. The caveat is numbering

I am very interested in the same topic. Would you mind providing a link to where I can find your sample workflow for LaTeX, Markdown and Scrivener. Even better would be a template with all the styles necessary for a Markdown - LaTeX - Math workflow.


Have you had a look at the Non-Fiction Format for Latex built-in to Scrivener (New Project selector)? This demonstrates a direct-to-latex style-driven workflow [1]. For a markdown->LaTeX workflow, you can have a look at the Scrivener manual itself, whose Scrivener source project [2] is available to download from here: … ser-guides

My workflow is detailed here: … ple-output

All these three sample projects use the Hybrid approach, either [1] direct-to-tex [2] via multimarkdown or [3] via Pandoc. You can pick-n-mix whichever route you want; I think Pandoc is more extensible and flexible, as it can transform more markup to more outputs and can run transformation filters irrespective of output (i.e. bibliographies and cross-referencing can work for HTML/LaTeX/DOCX/TXT or any other format, unlike MMD or Tex), but if you never need anything other than Latex, then you may prefer keeping everything in Scrivener with no other dependencies…