Using Inline Text Markup¶
Any text that appears on a plot, including titles, axis labels, colorbar labels, and text placed with Add Text, can contain inline markup. The Toolkit uses a subset of the “LaTeX” markup widely used in science and engineering.
Inline markup occurs between $
characters in your string:
This is some example text with an $\alpha$ character. |
|
This is some example text with an \alpha character. |
To put a literal $
symbol in your string, simply escape it:
Alphas ($\alpha$) are expensive: \$2 each! |
|
Alphas (\alpha) are expensive: $2 each! |
Ordinary letters appearing in markup will be treated as the names of mathematical variables, and will appear in italic font. You can manually specify the font using the following commands:
\mathrm{Roman} |
\mathrm{Roman} |
\mathrm{Italic} |
\mathit{Italic} |
For function names (like cos
or sin
), there’s a better way:
see Function Names below.
If a string contains formatting mistakes or illegal characters, it will not be processed by the LaTeX system. Instead, the raw contents of the string will be displayed.
Example¶
Download Text Markup.vi
,
or see Examples for a complete list of examples.
Basic Math¶
Result | Code |
---|---|
a_i^j | a_i^j |
a_{sub}^{super} | a_{sub}^{super} |
\sqrt{a} | \sqrt{a} |
\sqrt[5]{a} | \sqrt[5]{a} |
\frac{a}{b} | \frac{a}{b} |
a = b | a = b |
a < b | a < b |
a > b | a > b |
a \leq b | a \leq b |
a \geq b | a \geq b |
a \ll b | a \ll b |
a \gg b | a \gg b |
a \approx b | a \approx b |
a \neq b | a \neq b |
a \times b | a \times b |
a \pm b | a \pm b |
\langle a \rangle | \langle a \rangle |
\{a\} | \{ a \} |
\vec{a} | \vec{a} |
\acute{a} | \acute{a} |
\bar{a} | \bar{a} |
\dot{a} | \dot{a} |
\ddot{a} | \ddot{a} |
\hat{a} | \hat{a} |
Math Symbols¶
Keep in mind that some symbols, notably \int
, \prod
, and \sum
,
have “smart” subscript and superscript support. For example, this code:
\int_{0}^{\infty} A(x) dx = \sum_{i=0}^{\infty} B_i
produces this result:
\int_{0}^{\infty} A(x) dx = \sum_{i=0}^{\infty} B_i
Symbol | Code |
---|---|
\int | \int |
\iint | \iint |
\iiint | \iiint |
\oint | \oint |
\sum | \sum |
\prod | \prod |
\infty | \infty |
\nabla | \nabla |
\partial | \partial |
\star | \star |
\circ | \circ |
\sim | \sim |
\odot | \odot |
\oplus | \ominus |
\otimes | \otimes |
\parallel | \parallel |
\perp | \perp |
\leftarrow | \leftarrow |
\rightarrow | \rightarrow |
\uparrow | \uparrow |
\downarrow | \downarrow |
Function Names¶
Plain characters inside a markup block are treated as the names of mathematical
variables. This is undesirable when e.g. the sine of x is desired; sin x
is rendered as sin x. The correct approach is to use the explicit
function name, via \sin{x}
: \sin{x}.
Function | Code |
---|---|
\sin{x} | \sin{x} |
\cos{x} | \cos{x} |
\tan{x} | \tan{x} |
\arcsin{x} | \arcsin{x} |
\arccos{x} | \arccos{x} |
\arctan{x} | \arctan{x} |
\exp{x} | \exp{x} |
\ln{x} | \ln{x} |
\log{x} | \log{x} |
Greek Characters¶
These can be used anywhere an ordinary letter is used.
Character | Code |
---|---|
\alpha | \alpha |
\beta | \beta |
\chi | \chi |
\delta | \delta |
\epsilon | \epsilon |
\eta | \eta |
\gamma | \gamma |
\iota | \iota |
\kappa | \kappa |
\lambda | \lambda |
\mu | \mu |
\nu | \nu |
\omega | \omega |
\phi | \phi |
\pi | \pi |
\psi | \psi |
\rho | \rho |
\sigma | \sigma |
\tau | \tau |
\theta | \theta |
\upsilon | \upsilon |
\xi | \xi |
\zeta | \zeta |
\Delta | \Delta |
\Gamma | \Gamma |
\Lambda | \Lambda |
\Omega | \Omega |
\Phi | \Phi |
\Pi | \Pi |
\Psi | \Psi |
\Sigma | \Sigma |
\Theta | \Theta |
\Upsilon | \Upsilon |
\Xi | \Xi |