text(text) renders text at the current anchor point.
text(
text,
dx,
dy) renders text displaced by the given number of points. Normally, positive
dx is to the right and positive
dy down, but the x- and y-axes rotate along with the angle set by the
at command.
Text between underscore (_) and next space is set as subscript.
Text between hat (^) and next space is set as superscript. Matched parentheses, brackets, and quotes protect spaces. Additionally, tilde (~) can be used as a protected space inside sub- or superscripts.
Words can be /italicized/ or *boldfaced* with slashes and asterisks. “Words” in this context means a sequence of letters and/or numbers. Slashes and asterisks that do not form pairs around a word are not interpreted specially.
As in TeX math, \, inserts a thin space, and \! inserts a thin negative space.
Examples of valid strings:
"Distance (μm)" — Unicode is fully supported.
"Coefficient *A*_1^2" — Boldface, subscript, superscript.
"Coefficient *A*_{1^2}" — Nested subscript. Braces are eaten.
"Coefficient *A*_{{1}}" — Nested subscript. Extra braces are not eaten.
"/x/^{2}/2" — Braces help interpret end of superscript.
"e^-½(/x/^2 + /y/^2)" — The parentheses protect the outer superscript.
"e^-½{(/x/^2 + /y/^2) / σ^2}" — Braces are needed to protect spaces not protected by parentheses.
"frown^:\( or smile^:\)" — Backslashes prevent unwanted space protection.
"frown^{:(} or smile^{:)}" — Braces obviate the need for backslashes.