home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 16.1 Tbl Chapter 16
Next: 16.3 Pic

16.2 Eqn

Eqn is a preprocessor designed to facilitate the typesetting of mathematical equations. Use neqn with nroff. Eqn has the following command-line syntax:

/usr/ucb/eqn [ options ] [ files ]

-d xy

Use x and y as start and stop delimiters; same as specifying the eqn directive delim xy .

-f n

Change to font n ; same as the gfont directive.

-p n

Reduce size of superscripts and subscripts by n points. If -p is not specified, the default reduction is 3 points.

-s n

Reduce the point size by n points; same as the gsize directive.

-T dev

Format output to device dev . The default value comes from the TYPESETTER environment variable. Not available with neqn.

16.2.1 Eqn Macros


Start typesetting mathematics.


End typesetting mathematics.

Use the checkeq command to check for unmatched macro pairs.

16.2.2 Mathematical Characters

The character sequences below are recognized and translated as shown:

Character Translation Character Translation
>= >= approx ~
<= <= nothing
== == cdot .
!= != times ×
+- ± del [nabla]
-> -> grad [nabla]
<- <- ... ...
<< << ,..., ,...,
>> >> sum [sum]
inf [infinity] int [integral]
partial d prod [product]
half ½ union U
prime ' inter [cap]

16.2.3 Mathematical Text

Digits, parentheses, brackets, punctuation marks, and the following mathematical words are printed out in Roman font:

sin     cos     tan     arc
sinh    cosh    tanh
and     if      for     det
max     min     lim
log     ln      exp
Re      Im

16.2.4 Greek Characters

Greek letters can be printed in uppercase or lowercase. To obtain Greek letters, simply spell them out. Some uppercase Greek letters are not supported because they can be specified by an Arabic equivalent (e.g, A for alpha, B for beta).

Character Translation Character Translation
alpha [alpha] tau [tau]
beta [beta] upsilon [upsilon]
gamma [gamma] phi [phi]
delta [delta] chi [chi]
epsilon [epsilon] psi [psi]
zeta [zeta] omega [omega]
eta [eta] GAMMA [Gamma]
theta [theta] DELTA [Delta]
iota [iota] THETA [Theta]
kappa [kappa] LAMBDA [Lambda]
lambda [lambda] XI [Xi]
mu [mu] PI [Pi]
nu [nu] SIGMA [Sigma]
xi [xi] UPSILON [Upsilon]
omicron [omicron] PHI [Phi]
pi [pi] PSI [Psi]
rho [rho] OMEGA [Omega]
sigma [sigma]

16.2.5 Diacritical Marks

Several keywords are available to mark the tops of characters. Eqn centers a mark at the correct height. bar and under will span the necessary length.

Character Translation
x dot x·
x dotdot x¨
x hat x^
x tilde x~
x vec x->
x dyad x<->
x bar x¯
x under x_

16.2.6 Keywords Recognized by Eqn

In addition to character names and diacritical marks, eqn recognizes the following keywords:


Separate the pieces of a pile or matrix column.

back n

Move backwards horizontally n 1/100's of an m.


Change to bold font.


Center align a column of a matrix.


Make a centered pile (same as pile).


Create a name for a frequently used string.

delim xy

Define two characters to mark the left and right ends of an eqn equation to be printed in line. Use delim off to turn of delimiters.

down n

Move down n 1/100's of an m.


Widen the current font by overstriking it.

font x

Change to font x , where x is the one-character name or the number of a font.


Used in summations, integrals, and similar constructions to signify the lower limit.

fwd n

Move forward horizontally n 1/100's of an em.

gfont x

Set a global font x for all equations.

gsize n

Set a global size for all equations.


Change to italic font.


Left justify a column of a matrix.


Create big brackets, big braces, big bars, etc.


Line up marks in equations on different lines.


Left justify the elements of a pile.


Remember the horizontal position in an equation. Used with lineup.


Create a matrix.


Create a definition which takes effect only when neqn is running.


Make a fraction.


Make a vertical pile with elements centered above one another.


Right adjust a column of a matrix.


Create big brackets, big braces, big bars, etc.


Change to roman font.


Right justify the elements of a pile.

size n

Change the size of the font to n .


Draw a square root sign.


Start a subscript.


Start a superscript.


Make a definition which will apply only for eqn.


Used in summations, integrals, and similar constructions to signify the upper limit.

up n

Move up n 1/100's of an em.


Force extra space into the output.


Force a space one half the size of the space forced by ~ .

{ }

Force eqn to treat an element as a unit.


A string within quotes is not subject to alterations by eqn.

16.2.7 Precedence

If you don't use braces, eqn will do operations in the order shown in this list, reading from left to right.

dyad vec under bar
tilde hat dot dotdot
fwd back down up
fat roman italic bold
size sub sup sqrt
over from to

These operations group to the left:

over   sqrt   left   right

All others group to the right.

16.2.8 Eqn Examples


delim %%
%sum from i=0 to inf c sup i~=~lim from {m -> inf}
sum from i=0 to m c sup i%
delim off

Result: Figure 16.0


delim %%
%x ~=~ left [ { -b ~+-~ sqrt {b sup 2 - ~4ac} } 
over 2a right ]%
delim off

Result: Figure 16.0

Previous: 16.1 Tbl UNIX in a Nutshell: System V Edition Next: 16.3 Pic
16.1 Tbl Book Index 16.3 Pic

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System