How to write LaTeX directly inside Scrivener?


How do we write LaTeX code directly in Scrivener to meet advanced formatting or structuring needs? For example I don’t want Scrivener to output \chapter{Abstract}for my Abstract section since that would use use chapter numbering. Instead I want it to output \chapter*{Abstract}, so I wrote the following replacement rule:

!# $@ #! --> \chapter*{$@}

However, this does not work as intended. The output is this:


I also tried HTML escaping as I read somewhere that should work: <!- \chapter*{$@} -> but it doesn’t work. How do I make this work?


The simplest solution to this problem is addressed here:

In summary, don’t try to adjust the header of the Scrivener doc, but put the latex into the text, with HTML escaping:

Then, compile that file ‘as is’ so the Scrivener doc title doesn’t get used.

Thanks, that works! I wrote originally that I had already tried the HTML escaping, but actually I hadn’t, since I did it wrong: I used <!- LaTeX code -> instead of - so it worked all along!