-->
Previous | Table of Contents | Next |
To draw a square root symbol, use the keyword sqrt, and geqn ensures that the square root symbol is properly drawn to enclose all parts of the equation that are indicated as belonging to the square root. Very large square root signs that cover a lot of material on many lines, for example, do not look particularly good when printed. You may want to consider using the superscript 0.5 instead.
You can use sqrt quite easily. For example, the command
sqrt a+c - 1 over sqrt {alpha + beta}
shows the first square root sign over a+c and the second one over the part in braces.
To produce a summation, use the keyword sum and the keywords from and to to show the upper and lower parts of the command. For example, use the command
sum from x=1 to x=100 x sup 2
to create the formula for summing x squared over the range 1 to 100. If you want to use a special word, use braces:
sum from x=1 to {x= inf} x sup 2
This is the same command, except summing from 1 to infinity. The braces ensure that the to component is properly interpreted. If no from or to component is specified, they are not printed.
To use integrals, the keyword int is used and can again take a from argument:
lim from n=1 xy sup 3 = 9
Other reserved words for geqn are used with set theory. You can use the keywords union and inter for the union and intersection of sets.
As equations get more complicated, you will need to use more brackets and braces. You can generate brackets ([]), braces ({}), and parentheses (()) as needed using the left and right commands:
left { b over d+1} = left ( alpha over {beta + gamma} )
This produces large braces, and parentheses are required to surround the terms. You can nest these, of course, with geqn adjusting the sizes properly. Braces are usually bigger than brackets and parentheses.
For floor and ceiling characters, use the left floor, right floor, left ceiling, and right ceiling commands. For example:
left ceiling x over alpha right ceiling > left floor beta over 2 right floor
draws the equation with the proper vertical bars and ceiling and floor markers.
To create a pile of elements, use the reserved word pile. The following example shows the usage best:
X = left [ pile { a above b above c } right ]
This produces output with the three elements a, b, and c stacked vertically within big braces.
To make a matrix requires a little more work. You could probably make a matrix using the pile command, but if the elements are not of equal height, they will not line up. For that reason, use the keyword matrix. The general format is
matrix { ccol { elements } ccol { elements }
in which ccol produces centered columns. For left-adjusted columns, use lcol; rcol produces right-adjusted columns. The elements are specified individually. For example, the command
matrix { ccol { x sub 1 above y sub 1 } ccol { x sub 2 above y sub 2 }
produces the matrix
x1 x2 y1 y2
All matrices must have the same number of elements in each column or geqn cant process the matrix properly.
Note:
Some mathematical packages allow you to have varying numbers of elements in matrix columns. This is a bad practice because such a table is no longer a real matrix. Each column should have exactly the same number of elements, as should each row.
Any characters placed within quotation marks are not interpreted by geqn. This is useful for text strings that may contain reserved words, such as the following:
italics beta = beta + gamma
Here, the word beta will appear in italics without being converted to the beta character.
You can change font and point size with geqn in much the same way as with groff. The default setting is usually Roman 10 point. If you want to set bold characters, use the keyword bold; italic sets italic font.
x=y bold alpha
You can also use the keyword fat, which widens the character (useful for things such as grad characters). These reserved words affect only what immediately follows, so you must use braces if the area to be changed is more than a single block of characters.
x=y*2 bold {alpha + gamma}
To change the size of characters, use the size keyword:
size 16 {alpha + beta}
This sets the enclosed text in 16 point size. Incremental changes are acceptable.
To affect the entire equation, you can use the gsize (global size) and gfont (global font) commands at the start of the geqn block:
.EQ gsize 14 gfont H .
This makes it easy to format the equations however you wish.
As you have seen, geqn is quite friendly and easy to use, especially if you are used to writing out equations longhand. You should play around with the system and learn the different features. There are more commands available within geqn, but the main ones have been shown to you. For more information, check the man pages or a good groff book that includes eqn.
Previous | Table of Contents | Next |