LaTeX double-backslash in Scrivener

I have a simple document with the following top-level text items:
Test 1
Test 2
Test 3

My understanding is that I should be able to insert “raw LaTeX” using HTML comments. I have an existing “test” latex input document which is included correctly using LaTeX’s input function.

However, this doesn’t seem to work in the meta-data document, where I want to do something like

Test title\\Subtitle

The compiled latex document has a bunch of ‘extbackslash’ which I can’t seem to avoid. And HTML comments end up interpreted totally wrong in the output latex.

I am on Scrivener 2.2, using MMD3 and MacTeX July 2011.

Am I missing something obvious?

Can anyone help me determine exactly what I need to do to get a double-backslash (or other LaTeX) processed literally in Scrivener?

The Meta-Data document in Scrivener is special, it gets used to generate the MMD meta-data block and might get combined with anything you have in the compile settings meta-data pane. I wouldn’t recommend putting anything in there other than MMD meta-data, and if you are trying to put HTML comments into meta-data fields, I don’t believe that works as these are not processed like the rest of the text is.

What happens if you move that into the Introduction document?

If you want a place to put preamble bits, the best thing to do is use MMD3’s input features, which are described in the MMD documentation in the meta-data section. Basically you put your boilerplate .tex into external files and declare them by name with “LaTeX Input” meta-data keys. These boilerplate files can either be in the compile output folder (name the folder with “_mmd” on the end to inhibit Scrivener from overwriting the entire folder every time), or in your ~/Library/texmf/tex/latex/mmd. The latter is the best place for boilerplates you use often. So if you have a file named ~/Library/texmf/tex/latex/mmd/mypreamble.tex you would put:

LaTeX Input: mypreamble.tex

As a line in the Meta-Data document in Scrivener (or in the compiler).

Yes – that worked. I think the problem was that I was expecting meta-data such as Project Title to have TeX respected in the output; it’s clear this isn’t the case. I’ll try to work around the limitation.

Are you needing a differently formatted sub-title? Just guessing from your initial example. If so, try using MMD’s Subtitle meta-data field. That’s what it is there for, and most of the provided MMD .tex boilerplates will use it for the LaTeX subtitle if provided.

Title: Main Book Title Subtitle: The Subtitle of the Book Author: Etc. Date: 2012-01-23

There are a number of special meta-data fields in MMD that will be intelligently used by the LaTeX system. Copyright is another one off of the top of my head.