Next: Printing and Saving Plots, Previous: Manipulation of Plot Windows, Up: High-Level Plotting [Contents][Index]

#### 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 and is equivalent to `"none"`.

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. The special characters are inserted with a code following a backslash (\) character, as shown in Table 15.1.

Note that for on-screen display the interpreter property is honored by all graphics toolkits. However for printing, only the `"gnuplot"` toolkit renders TeX instructions.

Besides special glyphs, the formatting of 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 just a part of the string. For example,

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

where the character `'a'` will not appear in a bold font. Note that to avoid having Octave interpret the backslash characters in the strings, the strings 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 |

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 super- or sub-scripted. Without the { } pair, only the character immediately following the `'^'` or `'_'` is super- or sub-scripted.

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

A complete example showing the capabilities of the extended text is

    x = 0:0.01:3;
    plot (x, erf (x));
    hold on;
    plot (x,x,"r");
    axis ([0, 3, 0, 1]);
    text (0.65, 0.6175, strcat ('\leftarrow x = {2/\surd\pi',
    ' {\fontsize{16}\int_{\fontsize{8}0}^{\fontsize{8}x}}',
    ' e^{-t^2} dt} = 0.6175'))

The result of which can be seen in Figure 15.7

Figure 15.7: Example of inclusion of text with the TeX interpreter

Next: Printing and Saving Plots, Previous: Manipulation of Plot Windows, Up: High-Level Plotting [Contents][Index]