MirBSD manpage: 24.eqnguide(USD)

Typesetting Mathematics - User's Guide                   USD:24-1

             Typesetting Mathematics - User's Guide
                           (Second Edition)

            Brian W. Kernighan and Lorinda L. Cherry

                     AT&T Bell Laboratories
                  Murray Hill, New Jersey 07974


     This is the  user's  guide  for  a  system  for  typesetting
mathematics, using the phototypesetters on  the  UNIX-  operating

     Mathematical  expressions  are  described   in   a
language  designed to be easy to use by people who know
neither mathematics  nor  typesetting.  Enough  of  the
language    to    set    in-line    expressions    like
  lim  (tan x)sin 2x = 1 or display equations like
                           |       |
      G(z) = eln G(z) = exp|   _k__k_|       Sk|k/k
                           | ≥̅  k  |__2_z_4_+...|         |
                           ||≥1    | S2k≥1   |...      |
            |  |   __z__+...||  _2__2_+         |      km |
           =|  |   S1      ||1+ 2   22.2! k2     ___m___|zm
            |1+|1z+ 2!     ||      k1  ___2___ ... km   |
           =|≥̅ |                ___1___  k2       m  km!|
can be learned0in an hor or so. k1    2  k2!          |
               | k1,k2,...,km≥0 1  k1!
     The language1interfaceskdirectly with  the  photo-
typesetting language TROFF, so mathematical expressions
can be embedded in the running text  of  a  manuscript,
and  the  entire document produced in one process. This
user's guide is an example of its output.

     The same language may be used with the  UNIX  for-
matter  NROFF  to  set mathematical expressions on DASI
and GSI terminals and Model 37 teletypes.

-  UNIX  is a registered trademark of AT&T Bell Labora-
tories in the USA and other countries.

                        December 24, 2022

USD:24-2                   Typesetting Mathematics - User's Guide

1. Introduction

     EQN is a program for typesetting mathematics on the Graphics
Systems  phototypesetters  on  the UNIX operating system. The EQN
language was designed to be easy to use by people who  know  nei-
ther  mathematics nor typesetting. Thus EQN knows relatively lit-
tle about mathematics. In particular, mathematical  symbols  like
+,  -, x, parentheses, and so on have no special meanings. EQN is
quite happy to set garbage (but it will look good).

     EQN works as a preprocessor for  the  typesetter  formatter,
TROFF[1],  so  the normal mode of operation is to prepare a docu-
ment with both mathematics and ordinary  text  interspersed,  and
let  EQN  set  the  mathematics  while TROFF does the body of the

     On UNIX, EQN will also produce mathematics on DASI  and  GSI
terminals  and on Model 37 teletypes. The input is identical, but
you have to use the programs NEQN and NROFF instead  of  EQN  and
TROFF.  Of  course, some things won't look as good because termi-
nals don't provide the variety of  characters,  sizes  and  fonts
that  a  typesetter  does, but the output is usually adequate for

     To use EQN on UNIX,

        eqn files | troff

2. Displayed Equations

     To tell EQN where a mathematical expression begins and ends,
we mark it with lines beginning .EQ and .EN. Thus if you type the


your output will look like

The .EQ and .EN are copied through untouched; they are not other-
wise  processed  by EQN. This means that you have to take care of
things like centering, numbering, and so on  yourself.  The  most
common  way  is  to use the TROFF and NROFF macro package package
`-ms' developed by M. E. Lesk[3], which  allows  you  to  center,
indent, left-justify and number equations.

     With the `-ms' package, equations are centered  by  default.
To  left-justify an equation, use .EQ L instead of .EQ. To indent
it, use .EQ I. Any of these  can  be  followed  by  an  arbitrary
`equation  number'  which will be placed at the right margin. For
example, the input

                        December 24, 2022

Typesetting Mathematics - User's Guide                   USD:24-3

        .EQ I (3.1a)
        x = f(y/2) + y/2

produces the output

      x=f(y/2)+y/2                                         (3.1a)

     The2e canabeoenteredtwithoutt.EQoands.EN.nWeiwilletalksabout
itkin s̅e̅ction 19.

3. Input spaces

     Spaces and newlines within an expression are thrown away  by
EQN. (Normal text is left absolutely alone.) Thus between .EQ and



        x = y + z


        x   =   y
           + z

and so on all produce the same output

You should use spaces and newlines  freely  to  make  your  input
equations  readable  and  easy  to edit. In particular, very long
lines are a bad idea, since they are often hard  to  fix  if  you
make a mistake.

4. Output spaces

     To force extra spaces into the output, use a tilde ``~'' for
each space you want:



                            x = y + z
You can also use a circumflex ``^'', which gives a space half the
width  of  a tilde. It is mainly useful for fine-tuning. Tabs may
also be used to position pieces of an  expression,  but  the  tab
stops must be set by TROFF commands.

                        December 24, 2022

USD:24-4                   Typesetting Mathematics - User's Guide

5. Symbols, Special Names, Greek

     EQN  knows  some  mathematical  symbols,  some  mathematical
names, and the Greek alphabet. For example,

        x=2 pi int sin ( omega t)dt


Here the spaces in the input are necessary to tell EQN that  int,
pi,  sin  and omega are separate entities that should get special
treatment. The sin, digit 2, and parentheses  are  set  in  roman
type  instead  of  italic;  pi  and omega are made Greek; and int
becomes the integral sign.

     When in doubt, leave spaces around  separate  parts  of  the
input.  A  very  common  error  is  to type f(pi) without leaving
spaces on both sides of the pi. As a result, EQN does not  recog-
nize  pi  as  a  special word, and it appears as f(pi) instead of

     A  complete  list  of  EQN  names  appears  in  section  23.
Knowledgeable  users  can also use TROFF four-character names for
anything EQN doesn't know about, like \(bs for  the  Bell  System
sign .

6. Spaces, Again

     The only way EQN can deduce that some  sequence  of  letters
might  be  special  is  if  that  sequence  is separated from the
letters on either side of it. This can be done by  surrounding  a
special  word by ordinary spaces (or tabs or newlines), as we did
in the previous section.

     You can also make special words  stand  out  by  surrounding
them with tildes or circumflexes:


is much the same as the last example, except that the tildes  not
only  separate  the  magic  words like sin, omega, and so on, but
also add extra spaces, one space per tilde:

                    x = 2 i̅i̅  sin ( w t ) dt

     Special words can also be separated by braces { } and double
quotes "...", which have special meanings that we will see soon.

7. Subscripts and Superscripts

     Subscripts and superscripts are obtained with the words  sub
and sup.

                        December 24, 2022

Typesetting Mathematics - User's Guide                   USD:24-5

        x sup 2 + y sub k


EQN takes care of all  the  size  changes  and  vertical  motions
needed  to make the output look right. The words sub and sup must
be surrounded by spaces; x sub2 will give you  xsub2  instead  of
x2. Furthermore, don't forget to leave a space (or a tilde, etc.)
to mark the end of a subscript or superscript. A common error  is
to say something like

        y = (x sup 2)+1

which causes

instead of the intended


     Subscripted subscripts and superscripted  superscripts  also

        x sub i sub 1


A subscript and superscript on the same  thing  are  printed  one
above the other if the subscript comes first:

        x sub i sup 2

     Other than this special cayz,  sub  and  sup  group  to  the
right, so x sup y sub z means x  , not xyz.

8. Braces for Grouping

     Normally, the end of a subscript or  superscript  is  marked
simply  by  a blank (or tab or tilde, etc.) What if the subscript
or superscript is something that has to be typed with  blanks  in
it?  In  that  case,  you  can use the braces { and } to mark the
beginning and end of the subscript or superscript:

        e sup {i omega t}


                        December 24, 2022

USD:24-6                   Typesetting Mathematics - User's Guide


Rule:  Braces can always be used to force EQN to treat  something
as a unit, or just to make your intent perfectly clear. Thus:

        x sub {i sub 1} sup 2

with braces, but               xi1

        x sub i sub 1 sup 2


                               x 2
which is rather different.      i1

     Braces can occur within braces if necessary:

        e sup {i pi sup {rho +1}}


The general rule is that anywhere you could use some single thing
like  x,  you  can  use  an  arbitrarily complicated thing if you
enclose it in braces. EQN will look  after  all  the  details  of
positioning it and making it the right size.

     In all cases, make sure you have the right number of braces.
Leaving  one  out  or  adding an extra will cause EQN to complain

     Occasionally you will have to  print  braces.  To  do  this,
enclose  them in double quotes, like "{". Quoting is discussed in
more detail in section 14.

9. Fractions

     To make a fraction, use the word over:

        a+b over 2c =1

The line is made the right length and  positioned  automatically.
Braces can be used to make clear what goes over what:

        {alpha + beta} over {sin (x)}

                        December 24, 2022

Typesetting Mathematics - User's Guide                   USD:24-7

What happens when there is bothnan)over and a  sup  in  the  same
expression?  In  such  an apparently ambiguous case, EQN does the
sup before the over, so

        -b sup 2 ove_2_pi
                    i̅i̅ The rules which decide which operation  is
don_e_2_firstein cases like this are summarized in section 23. When
in d̅o̅ubt, however, use braces to make clear what goes with what.

10. Square Roots

     To draw a square root, use sqrt:

  sqrt a+b + 1 over sqrt {ax sup 2 +bx+c}

                          ___ __________
                        \|a+b+  ________
Warning - square roots of tall\quantities look lousy,  because  a
root-sign big enough to cover the quantity is too dark and heavy:

        sqrt {a sup 2 over b sub 2}

Big square roots are generally better written as something to the
power 1/2:                    \|

which is

        (a sup 2 /b sub 2 ) sup half

11. Summation, Integral, Etc.

     Summations, integrals, and similar constructions are easy:

        sum from i=0 to {i= inf} x sup i

                              ≥̅  xi
Notice that we used braces toiindicate where the upper part  i=oo
begins and ends. No braces were necessary for the lower part i=0,
because it contained no blanks. The braces will never  hurt,  and

                        December 24, 2022

USD:24-8                   Typesetting Mathematics - User's Guide

if  the from and to parts contain any blanks, you must use braces
around them.

     The from and to parts are both optional,  but  if  both  are
used, they have to occur in that order.

     Other useful characters can replace the sum in our example:

        int   prod   union   inter

become, respectively,

                          TT      (̅)̅      _)_
Since the thing before the from can be anything,  even  something
in braces, from-to can often be used in unexpected ways:

        lim from {n -> inf} x sub n =0


                             lim xn=0
12. Size and Font Changes

     By default, equations are set in  10-point  type  (the  same
size  as  this  guide), with standard mathematical conventions to
determine what characters  are  in  roman  and  what  in  italic.
Although EQN makes a valiant attempt to use esthetically pleasing
sizes and fonts, it is not perfect. To change  sizes  and  fonts,
use  size  n  and  roman, italic, bold and fat. Like sub and sup,
size and font changes affect only the thing  that  follows  them,
and revert to the normal situation at the end of it. Thus

        bold x y



        size 14 bold x = y +
           size 14 {alpha + beta}


As always, you can use braces if you  want  to  affect  something
more  complicated  than  a  single  letter.  For example, you can
change the size of an entire equation by

        size 12 { ... }

     Legal sizes which may follow size are 6, 7, 8,  9,  10,  11,

                        December 24, 2022

Typesetting Mathematics - User's Guide                   USD:24-9

12,  14, 16, 18, 20, 22, 24, 28, 36. You can also change the size
by a given amount; for example, you can say size +2 to  make  the
size  two  points  bigger,  or  size -3  to  make it three points
smaller. This has the advantage that you don't have to know  what
the current size is.

     If you are using fonts other than roman,  italic  and  bold,
you  can  say  font  X  where  X is a one character TROFF name or
number for the font. Since EQN is tuned  for  roman,  italic  and
bold, other fonts may not give quite as good an appearance.

     The fat operation takes the current font and  widens  it  by
overstriking: fat grad is ̅̅ and fat {x sub i} is xi.

     If an entire document is to be in  a  non-standard  size  or
font,  it  is  a  severe nuisance to have to write out a size and
font change for each equation. Accordingly, you can set a  ``glo-
bal'' size or font which thereafter affects all equations. At the
beginning of any equation, you might say, for instance,

        gsize 16
        gfont R

to set the size to 16 and the font to roman thereafter. In  place
of  R,  you  can  use any of the TROFF font names. The size after
gsize can be a relative change with + or -.

     Generally, gsize and gfont will appear at the beginning of a
document  but they can also appear thoughout a document: the glo-
bal font and size can be changed as often as needed. For example,
in a footnote= you will typically want the size of  equations  to
match  the  size  of  the  footnote  text, which is two
points smaller than the  main  text.  Don't  forget  to
reset the global size at the end of the footnote.

13. Diacritical Marks

     To get funny marks on top  of  letters,  there  are  several

=Like this one, in which we have a few  random  expres-
sions  like xi and i̅i̅2. The sizes for these were set by
the command gsize -2.

                        December 24, 2022

USD:24-10                  Typesetting Mathematics - User's Guide

        x dot     ..
        x dotdot  x
        x hat     ^
        x tilde   
        x vec     -
        x dyad    _x
        x bar     x
        x under   _x

The diacritical mark is placed at the right height. The  bar  and
u_n_d_e_r_  are  made the right length for the entire construct, as in
x+y+z; other marks are centered.

14. Quoted Text

     Any input entirely within quotes ("...") is not  subject  to
any  of the font changes and spacing adjustments normally done by
the equation setter. This provides a way to do your  own  spacing
and adjusting if needed:

        italic "sin(x)" + sin (x)



     Quotes are also used to get braces and  other  EQN  keywords

        "{ size alpha }"


                         { size alpha }

        roman "{ size alpha }"


                         { size alpha }

     The construction "" is often used  as  a  place-holder  when
grammatically  EQN  needs  something, but you don't actually want
anything in your output. For example, to make 2He, you can't just
type  sup  2  roman  He  because a sup has to be a superscript on
something. Thus you must say

        "" sup 2 roman He

     To get a literal quote use  ``\"''.  TROFF  characters  like
\(bs  can  appear  unquoted,  but  more  complicated  things like

                        December 24, 2022

Typesetting Mathematics - User's Guide                  USD:24-11

horizontal and vertical motions with \h and \v should  always  be
quoted.  (If  you've  never  heard of \h and \v, ignore this sec-

15. Lining Up Equations

     Sometimes it's necessary to line up a series of equations at
some  horizontal  position, often at an equals sign. This is done
with two operations called mark and lineup.

     The word mark may appear once at any place in  an  equation.
It  remembers  the horizontal position where it appeared. Succes-
sive equations can contain one occurrence of the word lineup. The
place  where  lineup  appears  is  made to line up with the place
marked by the previous mark if at all possible. Thus,  for  exam-
ple, you can say

        .EQ I
        x+y mark = z
        .EQ I
        x lineup = 1

to produce

For reasons too complicated to talk about, when you use  EQN  and
`-ms', use either .EQ I or .EQ L. mark and lineup don't work with
centered equations. Also bear in  mind  that  mark  doesn't  look

        x mark =1
        x+y lineup =z

isn't going to work, because there isn't room for  the  x+y  part
after the mark remembers where the x is.

16. Big Brackets, Etc.

     To get big brackets [ ], braces { },  parentheses  ( ),  and
bars |~| around things, use the left and right commands:

        left { a over b + 1 right }
         ~=~ left ( c over d right )
         + left [ e right ]

is                           |
                         |_+1| = |_|
                         |b  |   |d|+|
                         |           |e|
The resulting brackets are made big enough to cover whatever they
enclose.  Other characters can be used besides these, but the are

                        December 24, 2022

USD:24-12                  Typesetting Mathematics - User's Guide

not likely to look very good. One  exception  is  the  floor  and
ceiling characters:

        left floor x over y right floor
        <= left ceiling a over b right ceiling


     Several warnings about brackets are in order. First,  braces
are  typically bigger than brackets and parentheses, because they
are made up of three, five, seven, etc., pieces,  while  brackets
can  be  made  up  of two, three, etc. Second, big left and right
parentheses often look poor, because the character set is  poorly

     The right part may be omitted: a ``left something'' need not
have  a  corresponding  ``right something''. If the right part is
omitted, put braces around the thing you want the left bracket to
encompass. Otherwise, the resulting brackets may be too large.

     If you want to omit the left part, things are  more  compli-
cated,  because  technically  you  can't  have  a right without a
corresponding left. Instead you have to say

        left "" ..... right )

for example. The left "" means a ``left nothing''. This satisfies
the rules without hurting your output.

17. Piles

     There is a general facility for  making  vertical  piles  of
things; it comes in several flavors. For example:

        A ~=~ left [
          pile { a above b above c }
          ~~ pile { x above y above z }
        right ]

will make
                               |a  x|
                           A = |b  y|
The elements of the pile (there|canzbe as many as you  want)  are
centered  one  above  another,  at the right height for most pur-
poses. The keyword above is used to separate the  pieces;  braces
are used around the entire list. The elements of a pile can be as
complicated as needed, even containing more piles.

     Three other forms of pile exist: lpile makes a pile with the
elements  left-justified; rpile makes a right-justified pile; and
cpile makes a centered pile, just like pile. The vertical spacing
between  the pieces is somewhat larger for l-, r- and cpiles than

                        December 24, 2022

Typesetting Mathematics - User's Guide                  USD:24-13

it is for ordinary piles.

  roman sign (x)~=~
  left {
     lpile {1 above 0 above -1}
     ~~ lpile
      {if~x>0 above if~x=0 above if~x<0}

                      sign(x) = |0   if x>0
                                |-1  if x=0
                                |    if x<0

Notice the left brace without a matching right one.

18. Matrices

     It is also possible to make matrices. For example, to make a
neat array like

                             xi  x2

                             yi  y2
you have to type

        matrix {
          ccol { x sub i above y sub i }
          ccol { x sup 2 above y sup 2 }

This produces a matrix with two centered columns. The elements of
the  columns  are  then  listed  just as for a pile, each element
separated by the word above. You can also use  lcol  or  rcol  to
left  or  right  adjust  columns.  Each  column can be separately
adjusted, and there can be as many columns as you like.

     The reason for using a matrix instead of two adjacent piles,
by  the  way, is that if the elements of the piles don't all have
the same height, they won't line up  properly.  A  matrix  forces
them  to line up, because it looks at the entire structure before
deciding what spacing to use.

     A word of warning about matrices - each column must have the
same number of elements in it. The world will end if you get this

19. Shorthand for In-line Equations

     In a  mathematical  document,  it  is  necessary  to  follow
mathematical  conventions not just in display equations, but also
in the body of the text, for example  by  making  variable  names
like  x  italic.  Although  this could be done by surrounding the
appropriate parts with .EQ and .EN, the continual  repetition  of
.EQ  and  .EN is a nuisance. Furthermore, with `-ms', .EQ and .EN

                        December 24, 2022

USD:24-14                  Typesetting Mathematics - User's Guide

imply a displayed equation.

     EQN provides a shorthand for short in-line expressions.  You
can  define  two characters to mark the left and right ends of an
in-line equation, and then type expressions right in  the  middle
of  text lines. To set both the left and right characters to dol-
lar signs, for example, add to the beginning of your document the
three lines

         delim $$

Having done this, you can then say things like

        Let $alpha sub i$ be the primary variable, and let $beta$
        be zero. Then we can show that $x sub 1$ is $>=0$.

This works as you might expect - spaces, newlines, and so on  are
significant  in  the  text,  but not in the equation part itself.
Multiple equations can occur in a single input line.

     Enough room is left before and after n  line  that  contains
in-line  expressions that something like  ≥̅ xi does not interfere
with the lines surrounding it.           i=1

     To turn off the delimiters,

         delim off

Warning: don't use braces, tildes, circumflexes, or double quotes
as delimiters - chaos will result.

20. Definitions

     EQN provides a facility so you can  give  a  frequently-used
string  of  characters  a name, and thereafter just type the name
instead of the whole string. For example, if the sequence

        x sub i sub 1 + y sub i sub 1

appears repeatedly throughout a paper, you can save re-typing  it
each time by defining it like this:

  define  xy  'x sub i sub 1 + y sub i sub 1'

This makes xy a shorthand for whatever characters  occur  between
the  single  quotes  in the definition. You can use any character
instead of quote to mark the ends of the definition, so  long  as
it doesn't appear inside the definition.

     Now you can use xy like this:

                        December 24, 2022

Typesetting Mathematics - User's Guide                  USD:24-15

        f(x) = xy ...

and so on. Each occurrence of xy will expand  into  what  it  was
defined as. Be careful to leave spaces or their equivalent around
the name when you actually use it, so EQN will be able  to  iden-
tify it as special.

     There are several things to watch out for.  First,  although
definitions can use previous definitions, as in

         define  xi  ' x sub i '
         define  xi1  ' xi sub 1 '

don't define something in terms of itself' A favorite error is to

        define  X  ' roman X '

This is a guaranteed disaster, since X is now defined in terms of
itself. If you say

        define  X  ' roman "X" '

however, the quotes protect the second X,  and  everything  works

     EQN keywords can be redefined. You can make / mean  over  by

        define  /  ' over '

or redefine over as / with

        define  over  ' / '

     If you need different things to print on a terminal  and  on
the  typesetter,  it  is  sometimes  worth defining a symbol dif-
ferently in NEQN and EQN. This can be done with ndefine and  tde-
fine. A definition made with ndefine only takes effect if you are
running NEQN; if you use tdefine, the definition only applies for
EQN. Names defined with plain define apply to both EQN and NEQN.

21. Local Motions

     Although EQN tries to get most things at the right place  on
the  paper,  it  isn't perfect, and occasionally you will need to
tune the output to make it just  right.  Small  extra  horizontal
spaces  can  be  obtained with tilde and circumflex. You can also

                        December 24, 2022

USD:24-16                  Typesetting Mathematics - User's Guide

say back n and fwd n to move small amounts horizontally. n is how
far  to move in 1/100's of an em (an em is about the width of the
letter `m'.) Thus back 50 moves back about half the width  of  an
m. Similarly you can move things up or down with up n and down n.
As with sub or sup, the local motions affect the  next  thing  in
the  input,  and this can be something arbitrarily complicated if
it is enclosed in braces.

22. A Large Example

     Here is the complete source for the three display  equations
in the abstract of this guide.

 .EQ I
 G(z)~mark =~ e sup { ln ~ G(z) }
 ~=~ exp left (
 sum from k>=1 {S sub k z sup k} over k right )
 ~=~  prod from k>=1 e sup {S sub k z sup k /k}
 .EQ I
 lineup = left ( 1 + S sub 1 z +
 { S sub 1 sup 2 z sup 2 } over 2! + ... right )
 left ( 1+ { S sub 2 z sup 2 } over 2
 + { S sub 2 sup 2 z sup 4 } over { 2 sup 2 cdot 2! }
 + ... right ) ...
 .EQ I
 lineup =  sum from m>=0 left (
 sum from
 pile { k sub 1 ,k sub 2 ,..., k sub m  >=0
 k sub 1 +2k sub 2 + ... +mk sub m =m}
 { S sub 1 sup {k sub 1} } over {1 sup k sub 1 k sub 1 ! } ~
 { S sub 2 sup {k sub 2} } over {2 sup k sub 2 k sub 2 ! } ~
 { S sub m sup {k sub m} } over {m sup k sub m k sub m ! }
 right ) z sup m

23. Keywords, Precedences, Etc.

     If you don't use braces, EQN will do operations in the order
shown in this list.

   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

                        December 24, 2022

Typesetting Mathematics - User's Guide                  USD:24-17

All others group to the right.

     Digits, parentheses, brackets, punctuation marks, and  these
mathematical words are converted to Roman font when encountered:

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

These character sequences are recognized and translated as shown.

     >=        ≥
     <=        ≤
     ==        _=
     !=        /
     +-        ±
     ->        ->
     <-        <-
     <<        <<
     >>        >>
     inf       oo
     partial   `
     half      1/2
     prime     '
     approx    ~
     cdot      .
     times     x
     del       \̅/̅
     grad      \̅/̅
     ...       ...
     ,...,     ,...,
     sum       ≥̅
     prod      TT
     union     (̅)̅
     inter     _)_

     To obtain Greek letters, simply spell them out  in  whatever
case you want:

  DELTA  _\_     iota   i
  GAMMA  I̅      kappa  k
  LAMBDA /\     lambda \
  OMEGA  _      mu     u
  PHI    |      nu     v
  PI     TT     omega  w
  PSI    |      omicrono
  SIGMA  ≥̅      phi    |
  THETA  -      pi     i̅i̅
  UPSILON       Y      psi|
  XI     _      rho    p
  alpha  (      sigma  o̅

                        December 24, 2022

USD:24-18                  Typesetting Mathematics - User's Guide

  beta   |      tau    i̅                   chi    x      theta  -
  delta  `      upsilonu                  epsilon       -      xi
  eta    n      zeta    gamma  /

     These are all the words known to EQN (except for  characters
with names), together with the section where they are discussed.

  above  17, 18 lpile  17
  back   21     mark   15
  bar    13     matrix 18
  bold   12     ndefine20
  ccol   18     over   9
  col    18     pile   17
  cpile  17     rcol   18
  define 20     right  16
  delim  19     roman  12
  dot    13     rpile  17
  dotdot 13     size   12
  down   21     sqrt   10
  dyad   13     sub    7
  fat    12     sup    7
  font   12     tdefine20
  from   11     tilde  13
  fwd    21     to     11
  gfont  12     under  13
  gsize  12     up     21
  hat    13     vec    13
  italic 12     ~, ^   4, 6
  lcol   18     { }    8
  left   16     "..."  8, 14
  lineup 15

24. Troubleshooting

     If you make a mistake in an equation,  like  leaving  out  a
brace  (very common) or having one too many (very common) or hav-
ing a sup with nothing before it (common), EQN will tell you with
the message

  syntax error between lines x and y, file z

where x and y are approximately the lines between which the trou-
ble occurred, and z is the name of the file in question. The line
numbers are approximate - look nearby as  well.  There  are  also
self-explanatory  messages that arise if you leave out a quote or
try to run EQN on a non-existent file.

     If you want to check a document before actually printing  it
(on UNIX only),

        eqn  files >/dev/null

                        December 24, 2022

Typesetting Mathematics - User's Guide                  USD:24-19

will throw away the output but print the messages.

     If you use something like dollar signs as delimiters, it  is
easy  to  leave  one  out. This causes very strange troubles. The
program checkeq checks for misplaced or missing dollar signs  and
similar troubles.

     In-line equations can only be so big because of an  internal
buffer in TROFF. If you get a message ``word overflow'', you have
exceeded this limit. If you print the  equation  as  a  displayed
equation  this  message  will usually go away. The message ``line
overflow'' indicates you have exceeded an even bigger buffer. The
only  cure  for  this  is to break the equation into two separate

     On a related topic, EQN does not break equations by itself -
you  must  split long equations up across multiple lines by your-
self, marking each by a separate .EQ ... .EN sequence.  EQN  does
warn about equations that are too long to fit on one line.

25. Use on UNIX

     To print a document that contains mathematics  on  the  UNIX

        eqn files | troff

If there are any TROFF options, they go after the TROFF  part  of
the command. For example,

        eqn files | troff -ms

     A compatible version of EQN can  be  used  on  devices  like
teletypes and DASI and GSI terminals which have half-line forward
and reverse capabilities. To print equations on a Model 37  tele-
type, for example, use

        neqn files | nroff

The language for equations recognized by  NEQN  is  identical  to
that of EQN, although of course the output is more restricted.

     To use a GSI or DASI terminal as the output device,

        neqn files | nroff -Tx

where x is the terminal type you are using, such as 300 or 300S.

     EQN and NEQN can be used with the TBL program[2] for setting
tables  that  contain  mathematics.  Use  TBL before [N]EQN, like

                        December 24, 2022

USD:24-20                  Typesetting Mathematics - User's Guide

        tbl  files  |  eqn  |  troff
        tbl  files  |  neqn  |  nroff

26. Acknowledgments

     We are deeply indebted to  J.  F.  Ossanna,  the  author  of
TROFF,  for  his  willingness  to  extend  TROFF to make our task
easier, and for his continuous assistance during the  development
and  evolution  of  EQN.  We  are  also grateful to A. V. Aho for
advice on language design, to S. C. Johnson for  assistance  with
the  YACC  compiler-compiler,  and  to all the EQN users who have
made helpful suggestions and criticisms.


[1]  J. F. Ossanna, ``NROFF/TROFF User's Manual'',  Bell  Labora-
     tories Computing Science Technical Report #54, 1976.

[2]  M. E. Lesk, ``Typing Documents on UNIX'', Bell Laboratories,

[3]  M. E. Lesk, ``TBL - A Program  for  Setting  Tables'',  Bell
     Laboratories Computing Science Technical Report #49, 1976.

                        December 24, 2022

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung