Programming Gri
1: Introduction 2: Simple example 3: Fancy example 4: Running Gri 5: Programming Gri 6: General Issues 7: X-Y Plots 8: Contour Plots 9: Image Plots 10: Examples 11: Handling Data 12: Gri Commands 13: Gri Extras 14: Evolution of Gri 15: Installing Gri 16: Gri Bugs 17: System Tools 18: Acknowledgments 19: License 20: Newsgroup 21: Concept Index |
5.9: Text StringsAny text can be drawn in any size; Gri does not limit font size to a list, e.g. 10 point, 12 points, etc. Several fonts are available in Gri, e.g. Times, Helvetica, etc.; these are all standard PostScript fonts. Support for some non-English languages (e.g. French) is also provided. And, finally, Gri supports inclusion of simple mathematical expressions (Greek letters, superscripts, etc.) in text, using a LaTeX-style syntax.
5.9.1: Embedding synonyms in quoted text stringsOutside math strings, you can embed your synonyms at will. For example, you can include the name of a data file in the title of your plot as follows
5.9.2: Mathematical text5.9.2.1: SubscriptsAs 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:
5.9.2.2: SuperscriptsAs 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:
5.9.2.3: Mathematical symbolsAs 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):
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"):
5.9.3: Non-English charactersGri supports both English and other European-derived languages. In particular, it permits text with accents on letters. (It does not support other Oriental and other languages at this time.) Gri uses the ISO-Latin-1 font-encodings by default, although the so-called `standard' font-encoding may also be selected with the `Set Font Encoding '
command see Set Font Encoding. For more on font encodings see any
book on PostScript fonts ... although the bottom line is that if you are
using accented characters in your work, then you probably already know
about encodings, and if you don't use accents then you needn't learn
about this topic except for the pleasure of learning about other
languages.
The method of handling accented characters is very simple. If you can
type it, Gri can draw it! It's up to you to determine how to enter the
accents. Most text editors permit this. Since many users will prefer
the Emacs editor, a few words about that are in order.
Consider the task of inserting French text, with the Emacs
text-editor. There are several ways of doing this (and you may wish to
consult your emacs info manual). A method that works in emacs-19 up to
current emacs-20 versions uses the emacs `iso-transl.el' package by
putting the following in your `~/.emacs' file:
e '. And then, Gri will recognize this accented `e ',
and it will draw the accent on the axis label.
5.9.4: Adjustment Of Character PositionMicro-positioning is available within math-mode, via the symbols `\! ' (which means go left one thin-space) and `\, '
(which means go right on thin-space). (A thin-space is 1/6 the width of
the letter ``M'').
|