Previous: , Up: Use of the "interpreter" Property   [Contents][Index]


15.2.8.3 "latex" interpreter

The "latex" interpreter only works if an external LaTeX tool chain is present. Three binaries are needed: latex, dvipng, and dvisvgm. If those binaries are installed but not on the path, one can still provide their respective path using the following environment variables: OCTAVE_LATEX_BINARY, OCTAVE_DVIPNG_BINARY, and OCTAVE_DVISVG_BINARY.

Note that Octave does not parse or validate the text strings when in "latex" mode—it is the responsibility of the programmer to generate valid strings which may include wrapping sections that should appear in Math mode with '$' characters. See, for example, https://www.latex-project.org/help/documentation/ for documentation about LaTeX typesetting.

For debugging purpose, a convenience environment variable, OCTAVE_LATEX_DEBUG_FLAG, can be set to trigger more verbose output when Octave fails to have a given text compiled by an external LaTeX engine. For example, "x^2" is not a valid LaTeX string and the following example should fail

setenv ("OCTAVE_LATEX_DEBUG_FLAG", "1")
x = 1:10;
plot (x, x.^2)
title ("x^2", "interpreter", "latex")

Searching the terminal output you should find some helpful info about the origin of the failure:

...
No file default.aux.
! Missing $ inserted.
<inserted text>
                $
l.6 x^
      2
! Missing $ inserted.
...

If no usable LaTeX tool chain is found at the first text rendering, using the "latex" interpreter is equivalent to "none".