Annotation of 43BSDReno/share/doc/usd/27.eqnguide/g1, revision 1.1.1.1

1.1       root        1: .\"    @(#)g1  6.1 (Berkeley) 5/22/86
                      2: .\"
                      3: .if t .2C
                      4: .SC Introduction
                      5: .PP
                      6: .UC EQN
                      7: is a
                      8: program for typesetting mathematics
                      9: on the Graphics Systems phototypesetters on the
                     10: .UX
                     11: operating system.
                     12: The 
                     13: .UC EQN
                     14: language was designed to be easy to use
                     15: by people who know neither mathematics
                     16: nor typesetting.
                     17: Thus
                     18: .UC EQN
                     19: knows relatively little about mathematics.
                     20: In particular, mathematical symbols like
                     21: +, \(mi, \(mu, parentheses, and so on have no special meanings.
                     22: .UC EQN
                     23: is quite happy to set garbage (but it will look good).
                     24: .PP
                     25: .UC EQN
                     26: works as a preprocessor for the typesetter formatter,
                     27: .UC TROFF [1],
                     28: so the normal mode of operation is to prepare
                     29: a document with both mathematics and ordinary text
                     30: interspersed,
                     31: and let
                     32: .UC EQN
                     33: set the mathematics while
                     34: .UC TROFF
                     35: does the body of the text.
                     36: .PP
                     37: On
                     38: .UC UNIX ,
                     39: .UC EQN
                     40: will also produce mathematics on
                     41: .UC DASI 
                     42: and
                     43: .UC GSI
                     44: terminals and on
                     45: Model 37 teletypes.
                     46: The input is identical, but you have to use the programs
                     47: .UC NEQN 
                     48: and
                     49: .UC NROFF
                     50: instead of
                     51: .UC EQN 
                     52: and
                     53: .UC TROFF .
                     54: Of course, some things won't look as good
                     55: because terminals 
                     56: don't provide the variety of characters, sizes and fonts
                     57: that a typesetter does,
                     58: but the output is usually adequate for proofreading.
                     59: .PP
                     60: To use 
                     61: .UC EQN
                     62: on
                     63: .UC UNIX ,
                     64: .P1
                     65: eqn files | troff
                     66: .P2
                     67: .SC Displayed Equations
                     68: .PP
                     69: To tell
                     70: .UC EQN
                     71: where a mathematical expression begins and ends,
                     72: we mark it with lines beginning
                     73: .UC .EQ
                     74: and
                     75: .UC .EN .
                     76: Thus
                     77: if you type the lines
                     78: .P1
                     79: ^EQ
                     80: x=y+z
                     81: ^EN
                     82: .P2
                     83: your output will look like
                     84: .EQ
                     85: x=y+z
                     86: .EN
                     87: The
                     88: .UC .EQ
                     89: and
                     90: .UC .EN
                     91: are copied through untouched;
                     92: they
                     93: are not otherwise processed
                     94: by
                     95: .UC EQN .
                     96: This means that you have to take care
                     97: of things like centering, numbering, and so on
                     98: yourself.
                     99: The most common way is to use the
                    100: .UC TROFF
                    101: and
                    102: .UC NROFF
                    103: macro package package `\(mims'
                    104: developed by M. E. Lesk[3],
                    105: which allows you to center, indent, left-justify and number equations.
                    106: .PP
                    107: With the `\(mims' package,
                    108: equations are centered by default.
                    109: To left-justify an equation, use
                    110: .UC \&.EQ\ L
                    111: instead of
                    112: .UC .EQ .
                    113: To indent it, use
                    114: .UC .EQ\ I .
                    115: Any of these can be followed by an arbitrary `equation number'
                    116: which will be placed at the right margin.
                    117: For example, the input
                    118: .P1
                    119: ^EQ I (3.1a)
                    120: x = f(y/2) + y/2
                    121: ^EN
                    122: .P2
                    123: produces the output
                    124: .EQ I (3.1a)
                    125: x = f(y/2) + y/2
                    126: .EN
                    127: .PP
                    128: There is also a shorthand notation so
                    129: in-line expressions
                    130: like
                    131: $pi sub i sup 2$
                    132: can be entered without
                    133: .UC .EQ
                    134: and
                    135: .UC .EN .
                    136: We will talk about it in section 19.
                    137: .SC Input spaces
                    138: .PP
                    139: Spaces and newlines within an expression are thrown away by
                    140: .UC EQN .
                    141: (Normal text is left absolutely alone.)
                    142: Thus
                    143: between
                    144: .UC .EQ
                    145: and
                    146: .UC .EN ,
                    147: .P1
                    148: x=y+z
                    149: .P2
                    150: and
                    151: .P1
                    152: x = y + z
                    153: .P2
                    154: and
                    155: .P1
                    156: x   =   y   
                    157:    + z
                    158: .P2
                    159: and so on
                    160: all produce the same
                    161: output
                    162: .EQ
                    163: x=y+z
                    164: .EN
                    165: You should use spaces and newlines freely to make your input equations
                    166: readable and easy to edit.
                    167: In particular, very long lines are a bad idea,
                    168: since they are often hard to fix if you make a mistake.
                    169: .SC Output spaces
                    170: .PP
                    171: To force extra spaces into the 
                    172: .ul
                    173: output,
                    174: use a tilde ``\|~\|''
                    175: for each space you want:
                    176: .P1
                    177: x~=~y~+~z
                    178: .P2
                    179: gives
                    180: .EQ
                    181: x~=~y~+~z
                    182: .EN
                    183: You can also use a circumflex ``^'', 
                    184: which gives a space half the width of a tilde.
                    185: It is mainly useful for fine-tuning.
                    186: Tabs may also be used to position pieces
                    187: of an expression,
                    188: but the tab stops must be set by 
                    189: .UC TROFF
                    190: commands.
                    191: .SC "Symbols, Special Names, Greek"
                    192: .PP
                    193: .UC EQN
                    194: knows some mathematical symbols,
                    195: some mathematical names, and the Greek alphabet.
                    196: For example,
                    197: .P1
                    198: x=2 pi int sin ( omega t)dt
                    199: .P2
                    200: produces
                    201: .EQ
                    202: x = 2 pi int sin ( omega t)dt
                    203: .EN
                    204: Here the spaces in the input are
                    205: .B
                    206: necessary
                    207: .R
                    208: to tell
                    209: .UC EQN
                    210: that
                    211: .ul
                    212: int,
                    213: .ul
                    214: pi,
                    215: .ul
                    216: sin
                    217: and
                    218: .ul
                    219: omega
                    220: are separate entities that should get special treatment.
                    221: The
                    222: .ul
                    223: sin,
                    224: digit 2, and parentheses are set in roman type instead of italic;
                    225: .ul
                    226: pi
                    227: and
                    228: .ul
                    229: omega
                    230: are made Greek;
                    231: and
                    232: .ul
                    233: int
                    234: becomes the integral sign.
                    235: .PP
                    236: When in doubt, leave spaces around separate parts of the input.
                    237: A
                    238: .ul
                    239: very
                    240: common error is to type
                    241: .ul
                    242: f(pi)
                    243: without leaving spaces on both sides of the
                    244: .ul
                    245: pi.
                    246: As a result,
                    247: .UC EQN
                    248: does not recognize
                    249: .ul
                    250: pi
                    251: as a special word, and it appears as
                    252: $f(pi)$
                    253: instead of
                    254: $f( pi )$.
                    255: .PP
                    256: A complete list of
                    257: .UC EQN
                    258: names appears in section 23.
                    259: Knowledgeable users can also use
                    260: .UC TROFF
                    261: four-character names
                    262: for anything 
                    263: .UC EQN
                    264: doesn't know about,
                    265: like
                    266: .ul
                    267: \\(bs
                    268: for the Bell System sign \(bs.
                    269: .SC "Spaces, Again"
                    270: .PP
                    271: The only way
                    272: .UC EQN
                    273: can deduce that some sequence
                    274: of letters might be special
                    275: is if that sequence is separated from the letters
                    276: on either side of it.
                    277: This can be done by surrounding a special word by ordinary spaces
                    278: (or tabs or newlines),
                    279: as we did in the previous section.
                    280: .PP
                    281: .tr ~~
                    282: You can also make special words stand out by surrounding them
                    283: with tildes or circumflexes:
                    284: .P1
                    285: x~=~2~pi~int~sin~(~omega~t~)~dt
                    286: .P2
                    287: is much the same as the last example,
                    288: except that the tildes
                    289: not only
                    290: separate the magic words
                    291: like
                    292: .ul
                    293: sin,
                    294: .ul
                    295: omega,
                    296: and so on,
                    297: but also add extra spaces,
                    298: one space per tilde:
                    299: .EQ
                    300: x~=~2~pi~int~sin~(~omega~t~)~dt
                    301: .EN
                    302: .PP
                    303: Special words can also be separated by braces { }
                    304: and double quotes "...",
                    305: which have special meanings that we will
                    306: see soon.
                    307: .tr ~
                    308: .SC "Subscripts and Superscripts"
                    309: .PP
                    310: Subscripts and superscripts are
                    311: obtained with the words
                    312: .ul
                    313: sub
                    314: and
                    315: .ul
                    316: sup.
                    317: .P1
                    318: x sup 2 + y sub k
                    319: .P2
                    320: gives
                    321: .EQ
                    322: x sup 2 + y sub k
                    323: .EN
                    324: .UC EQN
                    325: takes care of all the size changes and vertical motions
                    326: needed to make the output look right.
                    327: The words
                    328: .ul
                    329: sub
                    330: and
                    331: .ul
                    332: sup
                    333: must be surrounded by spaces;
                    334: .ul
                    335: x sub2
                    336: will give you
                    337: $x sub2$ instead of $x sub 2$.
                    338: Furthermore, don't forget to leave a space
                    339: (or a tilde, etc.)
                    340: to mark the end of a subscript or superscript.
                    341: A common error is to say
                    342: something like
                    343: .P1
                    344: y = (x sup 2)+1
                    345: .P2
                    346: which causes
                    347: .EQ
                    348: y = (x sup 2)+1
                    349: .EN
                    350: instead of
                    351: the intended
                    352: .EQ
                    353: y = (x sup 2 )+1
                    354: .EN
                    355: .PP
                    356: Subscripted subscripts and superscripted superscripts
                    357: also work:
                    358: .P1
                    359: x sub i sub 1
                    360: .P2
                    361: is
                    362: .EQ
                    363: x sub i sub 1
                    364: .EN
                    365: A subscript and superscript on the same thing
                    366: are printed one above the other
                    367: if the subscript comes
                    368: .ul
                    369: first:
                    370: .P1
                    371: x sub i sup 2
                    372: .P2
                    373: is
                    374: .EQ
                    375: x sub i sup 2
                    376: .EN
                    377: .PP
                    378: Other than this special case,
                    379: .ul
                    380: sub
                    381: and
                    382: .ul
                    383: sup
                    384: group to the right, so
                    385: .ul
                    386: x\ sup\ y\ sub\ z
                    387: means
                    388: $x sup {y sub z}$, not ${x sup y} sub z$.
                    389: .SC "Braces for Grouping"
                    390: .PP
                    391: Normally, the end of a subscript or superscript is marked
                    392: simply by a blank (or tab or tilde, etc.)
                    393: What if the subscript or superscript is something that has to be typed
                    394: with blanks in it?
                    395: In that case, you can use the braces
                    396: { and } to mark the
                    397: beginning and end of the subscript or superscript:
                    398: .P1
                    399: e sup {i omega t}
                    400: .P2
                    401: is
                    402: .EQ
                    403: e sup {i omega t}
                    404: .EN
                    405: .sp
                    406: Rule:  Braces can
                    407: .ul
                    408: always
                    409: be used to force 
                    410: .UC EQN
                    411: to treat something as a unit,
                    412: or just to make your intent perfectly clear.
                    413: Thus:
                    414: .P1
                    415: x sub {i sub 1} sup 2
                    416: .P2
                    417: is
                    418: .EQ
                    419: x sub {i sub 1} sup 2
                    420: .EN
                    421: with braces, but
                    422: .P1
                    423: x sub i sub 1 sup 2
                    424: .P2
                    425: is
                    426: .EQ
                    427: x sub i sub 1 sup 2
                    428: .EN
                    429: which is rather different.
                    430: .PP
                    431: Braces can occur within braces if necessary:
                    432: .P1
                    433: e sup {i pi sup {rho +1}}
                    434: .P2
                    435: is
                    436: .EQ
                    437: e sup {i pi sup {rho +1}}
                    438: .EN
                    439: The general rule is that anywhere you could use some single
                    440: thing like
                    441: .ul
                    442: x,
                    443: you can use an arbitrarily complicated thing if you enclose
                    444: it in braces.
                    445: .UC EQN
                    446: will look after all the details of positioning it and making
                    447: it the right size.
                    448: .PP
                    449: In all cases, make sure you have the
                    450: right number of braces.
                    451: Leaving one out or adding an extra will cause 
                    452: .UC EQN
                    453: to complain bitterly.
                    454: .PP
                    455: Occasionally you will have to
                    456: print braces.
                    457: To do this,
                    458: enclose them in double quotes,
                    459: like "{".
                    460: Quoting is discussed in more detail in section 14.
                    461: .SC Fractions
                    462: .PP
                    463: To make a fraction,
                    464: use the word
                    465: .ul
                    466: over:
                    467: .P1
                    468: a+b over 2c =1
                    469: .P2
                    470: gives
                    471: .EQ
                    472: a+b over 2c =1
                    473: .EN
                    474: The line is made the right length and positioned automatically.
                    475: Braces can be used to make clear what goes over what:
                    476: .P1
                    477: {alpha + beta} over {sin (x)}
                    478: .P2
                    479: is
                    480: .EQ
                    481: {alpha + beta} over {sin (x)}
                    482: .EN
                    483: What happens when there is both an
                    484: .ul
                    485: over
                    486: and a
                    487: .ul
                    488: sup
                    489: in the same expression?
                    490: In such an apparently ambiguous case,
                    491: .UC EQN
                    492: does the
                    493: .ul
                    494: sup
                    495: before the
                    496: .ul
                    497: over,
                    498: so
                    499: .P1
                    500: \(mib sup 2 over pi
                    501: .P2
                    502: is
                    503: $-b sup 2 over pi$
                    504: instead of
                    505: $-b sup {2 over pi}$
                    506: The rules
                    507: which decide which operation is done first in cases like this
                    508: are summarized in section 23.
                    509: When in doubt, however,
                    510: .ul
                    511: use braces
                    512: to make clear what goes with what.
                    513: .SC "Square Roots"
                    514: .PP
                    515: To draw a square root, use
                    516: .ul
                    517: sqrt:
                    518: .P1 2
                    519: sqrt a+b + 1 over sqrt {ax sup 2 +bx+c}
                    520: .P2
                    521: is
                    522: .EQ
                    523: sqrt a+b + 1 over sqrt {ax sup 2 +bx+c}
                    524: .EN
                    525: Warning _ square roots of tall quantities look lousy,
                    526: because a root-sign 
                    527: big enough to cover the quantity is
                    528: too dark and heavy:
                    529: .P1
                    530: sqrt {a sup 2 over b sub 2}
                    531: .P2
                    532: is
                    533: .EQ
                    534: sqrt{a sup 2 over b sub 2}
                    535: .EN
                    536: Big square roots are generally better written as something
                    537: to the power \(12:
                    538: .EQ
                    539: (a sup 2 /b sub 2 ) sup half
                    540: .EN
                    541: which is
                    542: .P1
                    543: (a sup 2 /b sub 2 ) sup half
                    544: .P2
                    545: .SC "Summation, Integral, Etc."
                    546: .PP
                    547: Summations, integrals, and similar constructions
                    548: are easy:
                    549: .P1
                    550: sum from i=0 to {i= inf} x sup i
                    551: .P2
                    552: produces
                    553: .EQ
                    554: sum from i=0 to {i= inf} x sup i
                    555: .EN
                    556: Notice that we used
                    557: braces to indicate where the upper
                    558: part
                    559: $i= inf$
                    560: begins and ends.
                    561: No braces were necessary for the lower part $i=0$,
                    562: because it contained no blanks.
                    563: The braces will never hurt,
                    564: and if the 
                    565: .ul
                    566: from
                    567: and
                    568: .ul
                    569: to
                    570: parts contain any blanks, you must use braces around them.
                    571: .PP
                    572: The
                    573: .ul
                    574: from
                    575: and
                    576: .ul
                    577: to
                    578: parts are both optional,
                    579: but if both are used,
                    580: they have to occur in that order.
                    581: .PP
                    582: Other useful characters can replace the
                    583: .ul
                    584: sum
                    585: in our example:
                    586: .P1
                    587: int   prod   union   inter
                    588: .P2
                    589: become, respectively,
                    590: .EQ
                    591: int ~~~~~~ prod ~~~~~~ union ~~~~~~ inter
                    592: .EN
                    593: Since the thing before the 
                    594: .ul
                    595: from
                    596: can be anything,
                    597: even something in braces,
                    598: .ul
                    599: from-to
                    600: can often be used in unexpected ways:
                    601: .P1
                    602: lim from {n \(mi> inf} x sub n =0
                    603: .P2
                    604: is
                    605: .EQ
                    606: lim from {n-> inf} x sub n =0
                    607: .EN

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.