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:
Since MultiMarkdown syntax is not processed inside of metadata, you can use the latex author metadata to override the regular author metadata when exporting to LaTeX. This metadata must come after the regular author metadata if it is also being used. This example syntax is limited and isn’t widely supported. More common is the way Kramdown offers extensions to add attributes to block-level elements, including not only the height and width but CSS and other attributes. Markdown Guide🔗. Markdown is a simple way to format text that looks great on any device. It doesn't do anything fancy like change the font size, color, or type — just the essentials, using keyboard symbols you already know. MultiMarkdown Composer is ranked 10th while Visual Studio Code is ranked 12th. The most important reason people chose MultiMarkdown Composer is: Not many popular Markdown editors support MultiMarkdown syntax. MultiMarkdown can already convert text to HTML 5, and it does so cleanly and allows a great deal of control and flexibility. For MultiMarkdown to convert text to HTML 5, the text has to be written in MultiMarkdown syntax—that is, with asterisks denoting bold and italics, pipes and dashes representing tables, greater-than symbols.
The syntax for this is
<!–LaTeX code–>
For example,
<!–title{Introduction}–>
<!–newpage{}–>
<!–tableofcontents{}–>
<!–[ {e}^{ipi }+1=0 ]–>
Multimarkdown Syntax
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).
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