Bring some LaTeX unto your document!

1. Requirements ๐Ÿ”—

In order to use LaTeX processing, you need to have a LaTeX distribution installed. We recommend the TeX Live distribution. You'll also need to install the latex2svg python script provided with NML. You'll have to follow the installation instructions from the original latex2svg repository. If you don't want to add the script to your $PATH, you can set the executable path in the ยง{tex_env}[caption=LaTeX environment].

2. Inline Math ๐Ÿ”—

You can add inline math by enclosing LaTeX between two $:

You can make the LaTeX non inline by specifying kind=block in it's property: $[kind=block] 1+1=2$ โ†’

(notice how it's not inside a paragraph)

3. Non Math LaTeX ๐Ÿ”—

You can write LaTeX outside of LaTeX's math environment, by enclosing your code between $|...|$:


$|\begin{tikzpicture}
	\begin{axis}
	\addplot3[patch,patch refines=3,
		shader=faceted interp,
		patch type=biquadratic] 
	table[z expr=x^2-y^2]
	{
		x  y
		-2 -2
		2  -2
		2  2
		-2 2
		0  -2
		2  0
		0  2
		-2 0
		0  0
	};
	\end{axis}
\end{tikzpicture}|$

Gives the following:

4. LaTeX environment ๐Ÿ”—

You can define multiple LaTeX environment, the default being main

Replace env with the name of the custom environment you wish to define.

Here's a preamble to render LaTeX gray:

@tex.main.fontsize = 9
@tex.main.preamble = \usepackage{xcolor} \\
\usepgfplotslibrary{patchplots} \\
\definecolor{__color1}{HTML}{d5d5d5} \\
\everymath{\color{__color1}}
@tex.main.block_prepend = \color{__color1}

To set the environment you wish to use for a particular LaTeX element, set the env property:

5. Properties ๐Ÿ”—

6. LaTeX cache ๐Ÿ”—

LaTeX elements that have been successfully rendered to svg are stored in the cache database, to avoid processing them a second time. Note that this cache is shared between documents, so you don't need to reprocess them if they share the same environment. They are stored under the table named cached_tex, if you modify the env all elements will be reprocessed which may take a while...

7. Bindings ๐Ÿ”—