15.2.8 Use of the interpreter Property

All text objects—such as titles, labels, legends, and text—include the property "interpreter" that determines the manner in which special control sequences in the text are rendered.

The interpreter property can take three values: "none", "tex", "latex". If the interpreter is set to "none" then no special rendering occurs—the displayed text is a verbatim copy of the specified text. Currently, the "latex" interpreter is not implemented for on-screen display and is equivalent to "none". 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.

The "tex" option implements a subset of TeX functionality when rendering text. This allows the insertion of special glyphs such as Greek characters or mathematical symbols. Special characters are inserted by using a backslash (\) character followed by a code, as shown in Table 15.1.

Besides special glyphs, the formatting of the text can be changed within the string by using the codes

\bf Bold font
\it Italic font
\sl Oblique Font
\rm Normal font

These codes may be used in conjunction with the { and } characters to limit the change to a part of the string. For example,

xlabel ('{\bf H} = a {\bf V}')

where the character 'a' will not appear in bold font. Note that to avoid having Octave interpret the backslash character in the strings, the strings themselves should be in single quotes.

It is also possible to change the fontname and size within the text

\fontname{fontname} Specify the font to use
\fontsize{size} Specify the size of the font to use

The color of the text may also be changed inline using either a string (e.g., "red") or numerically with a Red-Green-Blue (RGB) specification (e.g., [1 0 0], also red).

\color{color} Specify the color as a string
\color[rgb]{R G B} Specify the color numerically

Finally, superscripting and subscripting can be controlled with the '^' and '_' characters. If the '^' or '_' is followed by a { character, then all of the block surrounded by the { } pair is superscripted or subscripted. Without the { } pair, only the character immediately following the '^' or '_' is changed.

Greek Lowercase Letters
\alpha \beta \gamma
\delta \epsilon \zeta
\eta \theta \vartheta
\iota \kappa \lambda
\mu \nu \xi
\o \pi \varpi
\rho \sigma \varsigma
\tau \upsilon \phi
\chi \psi \omega
Greek Uppercase Letters
\Gamma \Delta \Theta
\Lambda \Xi \Pi
\Sigma \Upsilon \Phi
\Psi \Omega
Misc Symbols Type Ord
\aleph \wp \Re
\Im \partial \infty
\prime \nabla \surd
\angle \forall \exists
\neg \clubsuit \diamondsuit
\heartsuit \spadesuit
“Large” Operators
\int
Binary Operators
\pm \cdot \times
\ast \circ \bullet
\div \cap \cup
\vee \wedge \oplus
\otimes \oslash
Relations
\leq \subset \subseteq
\in \geq \supset
\supseteq \ni \mid
\equiv \sim \approx
\cong \propto \perp
Arrows
\leftarrow \Leftarrow \rightarrow
\Rightarrow \leftrightarrow \uparrow
\downarrow
Openings and Closings
\lfloor \langle \lceil
\rfloor \rangle \rceil
Alternate Names
\neq
Other
\ldots \0 \copyright
\deg

Table 15.1: Available special characters in TeX mode

15.2.8.1 Degree Symbol

Conformance to both TeX and MATLAB with respect to the \circ symbol is impossible. While TeX translates this symbol to Unicode 2218 (U+2218), MATLAB maps this to Unicode 00B0 (U+00B0) instead. Octave has chosen to follow the TeX specification, but has added the additional symbol \deg which maps to the degree symbol (U+00B0).

© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v6.3.0/Use-of-the-interpreter-Property.html