Place ToC between two Scrivener documents?


I’m writing my thesis in Scrivener with MMD and compiling to LaTeX for layouting. However, I have stumbled into a problem I don’t know how to solve.

The first part of my thesis should be something like:

  • Front page
  • Abstract
  • Acknowledgements
  • ToC
  • Introduction

How do I achieve this structure when I have all content inside Scrivener? Scrivener automatically compiles everything down to a single LaTeX file in the order specified by the binder, but how do I put a ToC between two Scrivener documents (e.g. between Acknowledgements and Introduction)? The “latex input” meta data is only good for inserting custom LaTeX content before and after all Scrivener generated LaTeX as far as I can see, but not between.

That’s correct, the meta-data key for inputting .tex files is intended to be used around the MMD content (what Scrivener is generating), not within it. If you look at the plain MultiMarkdown file that Scrivener creates, it should be more clear as to why that would be impossible. But that shouldn’t hamper things too much because you can insert LaTeX code from within the MMD content area, but wrapping it in an HTML comment. For example, try typing the following into a text document in the binder:


You will probably want to set that document to “Compile As-Is” in the Inspector, so that it does not get its own title. So of course, using that same principle you could insert your own \input{…} commands wherever you like. It’s a useful trick for getting around the limitations of MMD being a very abstract system. If there is not syntax for something specific you need from LaTeX, you can key it in directly, and if you do that often enough you can make a Replacement macro that turns an abbreviation into code.

Thanks. I want to avoid inline LaTeX as much as possible, but if that’s the only I guess I have to use it.

Understood! I try to avoid as much as possible as well. One of the reasons why I like to use Scrivener’s Replacement feature to generate the LaTeX is in case if I ever wish to create another type of document with the source material. If I have everything as embedded LaTeX that becomes more difficult, but if I use some kind of generic code that I make up, like “<$tableofcontents>”, then I can have Scrivener turn that into whatever I want when I compile. In a way its a bit like a form of extending MMD.