Inserting any LaTeX code in Scrivener


As noted in an earlier post, using math mode in Scrivener is very easy. Using MultiMarkdown – which can be found here – the MultiMarkdown to .tex compiler recognises the syntax and performs the conversion seamlessly.

However, for more complex LaTeX code, there is another route. This post describes how to insert any LaTeX code in the body of your Scrivener document. Again, we use the MultMarkdown to .tex compiler so that any formatting in the document is preserved, but we take advantage of the ability to direct the compiler to process text in HTML tags.

Including LaTeX code in the Scrivener document:

The syntax for this is

<!– LaTeX code –>

For example,




<!–\[ {e}^{i\pi }+1=0 \]–>


Creating a TeX file:

File > Compile…

From the Compile for drop-down menu, select MultiMarkdown to Latex (.tex).

From the Format as drop-down menu, select Custom.

Under Contents, choose which documents are to be added by selecting the check-boxes in the Include column. (If this isn’t visible, select the down arrow on the right of the Format as drop-down menu.)

From the LaTeX menu, choose Custom as the LaTeX document class to include custom header information, e.g. \usepackage{ }, if any special packages are used.

From the Meta-Data menu, check the box labelled Use XSLT post-processing. On hovering over this option, the information states, “this option tells MultiMarkdown to process text included within HTML tags in the source document”, as shown below (click for larger image).

xlst option

It is this option that processes the HTML enclosed code. Whilst other options stay the same between one Compile and the next, this box has to be checked every time.

Select Compile.

Importing into LyX:

I use LyX to fine-tune my .tex documents. To import:

File > Import > LaTeX (plain)…

Select the .tex file

See Also:

Quick Guides Masterlist


3 thoughts on “Inserting any LaTeX code in Scrivener

  1. Pingback: Scrivener, MultiMarkdown and LaTeX | having words

  2. Pingback: Replacements for easy LaTeX inclusion in Scrivener | having words

  3. Pingback: Inserting any LaTeX code in Scrivener | Everything Scrivener

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s