navigation map

Chapters:
  1: Introduction
  2: Simple example
  3: Invocation
  4: Finer Control
  5: X-Y Plots
  6: Contour Plots
  7: Image Plots
  8: Examples
  9: Gri Commands
  10: Programming
  11: Environment
  12: Emacs Mode
  13: History
  14: Installation
  15: Gri Bugs
  16: Test Suite
  17: Gri in Press
  18: Acknowledgments
  19: License

Indices:
  Concepts
  Commands
  Variables
index.html#Top Text.html#Text Gri: embedded synonyms Gri: non-English text index.html#Top Gri: non-English text

10.10.2: Mathematical text

10.10.2.1: Subscripts

As in TeX and LaTeX, you must be in math-mode to use subscripts; in other words, you must enclose the string or substring in dollar-signs. For single-character subscripts, insert an underline prior to the character to be subscripted:


draw title "$a_2$"

For multiple-character subscripts, insert braces before and after the item to be subscripted:


draw title "$a_{22}$"

10.10.2.2: Superscripts

As in TeX and LaTeX, you must be in math-mode to use superscripts; in other words, you must enclose the string or substring in dollar-signs. For single-character superscripts, insert a carat prior to the character to be superscripted:


draw title "$a^2$"

For multiple-character superscripts, insert braces before and after the item to be superscripted:


draw title "$a^{22}$"

10.10.2.3: Mathematical symbols

As in TeX and LaTeX, you indicate mathematical symbols and Greek letters with backslash sequences. The following LaTeX symbols are defined in math mode in Gri (cf tables in Lamport's section 3):


\Delta \Downarrow \Gamma \Im \Lambda \Leftarrow
\Leftrightarrow \Omega \Pi \Phi \Psi \Re
\Rightarrow \Sigma \Theta \Uparrow \Upsilon \Xi
\alpha \approx \ast \beta \bullet \chi \circ
\cong \delta \div \downarrow \epsilon \equiv
\eta \exists \forall \gamma \geq \gg \in \infty
\iota \kappa \lambda \langle \leftarrow
\leftrightarrow \leq \ll \mu \nabla \neq \nu
\omega \partial \phi \pi \pm \prod \propto \psi
\rangle \rho \rightarrow \sigma \sim \subset
\subseteq \sum \supset \supseteq \surd \sqrt
\tau \theta \times \uparrow \upsilon \varpi
\wedge \xi \zeta \vartheta \varsigma \varphi
\aleph \oplus \otimes \wp \prime \emptyset
\angle \neg \clubsuit \diamondsuit \spadesuit
\cdot \lfloor \lceil \rceil \rfloor

Click here to see the symbols and their names. For example, you might use these as follows:


draw title "$\alpha$ = thermal expansion coefficient"

Sometimes you'll want a mathematical symbol to be adjacent to a normal text string, with no space between. You can do this by enclosing in braces, as in LaTeX.

TeX and LaTeX handle combinations of superscripts and subscripts very cleanly, putting one above the other. Presently, Gri does not do this; for example `set x name "$A_1^2$"' will have the 2 appearing to the right of the 1 instead of above it. Proper positioning will be added to a later version of Gri, but in the meantime you can achieve the desired effect with the TeX ``negative thinspace'' psuedo-character in math-mode. Using this feature will not hurt you when the new Gri becomes available. The symbol for a negative thinspace is `\!' in math-mode. It has no meaning in nonmath mode. A thinspace is 1/6 of an ``em-space'' (a TeX term, normally equal to the width of the character ``M'' in the current font). In most fonts, numbers are half the width of the letter ``M'', so that 3 negative thinspaces will move leftward over a single number. Thus, if the example above becomes `set x name "$A_1\!\!\!^2"', the 2 will be positioned above the 1. (Equivalently, you could write `set x name "$A^2\!\!_1$"'.) Depending on the actual characters you have in the super/subscripts, you might need more or less thinspaces; some experimentation might be required. Also, note that the symbol `\,' in math mode is a positive thinspace (which moves the next character a little bit to the right). Thus, you can add a little extra spaces between characters by doing something like `set x name "A$\,$B"'.

To get a hat over a single character, do something like the following (which draws a hat over the character "h"):


draw label "h${\!\!\!^{^\wedge}}$" at 10 12 cm

To get an overbar on a rho, do this:


draw label "$\rho\!\!\!\!^-$" at 3 3 cm

navigation map