1.\" Copyright (c) 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.proprietary.roff% 5.\" 6.\" @(#)eqn.1 6.6 (Berkeley) 04/17/91 7.\" 8.Vx 9.Dd 10.Dt EQN 1 11.Os ATT 7th 12.EQ 13delim $$ 14.EN 15.Sh NAME 16.Nm eqn, neqn , checkeq 17.Nd typeset mathematics 18.Sh SYNOPSIS 19.Nm eqn 20.Oo 21.Op Fl d Ar xy 22.Op Fl p Ar n 23.Op Fl s Ar n 24.Op Fl f Ar n 25.Op file 26\&... 27.Nm checkeq 28.Op file 29\&... 30.Sh DESCRIPTION 31.Nm Eqn 32is a 33.Xr troff 1 34preprocessor 35for typesetting mathematics 36on a Graphic Systems phototypesetter, 37.Xr neqn 38on terminals. 39Usage is almost always 40.Pp 41.Dl eqn file ... | troff 42.Pp 43.Dl neqn file ... | nroff 44.Pp 45If no files are specified, 46these programs 47read from the standard input. 48A line beginning with `.EQ' marks the start of an equation; 49the end of an equation 50is marked by a line beginning with `.EN'. 51Neither of these lines is altered, 52so they may be defined in macro packages 53to get 54centering, numbering, etc. 55It is also possible to set two characters as `delimiters'; 56subsequent text between delimiters is also treated as 57.Nm eqn 58input. 59Delimiters may be set to characters 60.Ar x 61and 62.Ar y 63with the command-line argument 64.Fl d xy 65or (more commonly) with 66`delim 67.Ar xy ' 68between .EQ and .EN. 69The left and right delimiters may be identical. 70Delimiters are turned off by `delim off'. 71All text that is neither between delimiters nor between .EQ and .EN 72is passed through untouched. 73.Pp 74The program 75.Nm checkeq 76reports missing or unbalanced delimiters and .EQ/.EN pairs. 77.Pp 78Tokens within 79.Nm eqn 80are separated by 81spaces, tabs, newlines, braces, double quotes, 82tildes or circumflexes. 83Braces {} are used for grouping; 84generally speaking, 85anywhere a single character like 86.Ar x 87could appear, a complicated construction 88enclosed in braces may be used instead. 89Tilde ~ represents a full space in the output, 90circumflex ^ half as much. 91.Pp 92.vs 13p 93Subscripts and superscripts are produced with the keywords 94.Ic sub 95and 96.Ic sup . 97Thus 98.Ar "x sub i" 99makes 100$x sub i$, 101.Ar "a sub i sup 2" 102produces 103$a sub i sup 2$, 104and 105.Ar "e sup {x sup 2 + 106.Ar y sup 2}" 107gives 108$e sup {x sup 2 + y sup 2}$. 109.Pp 110Fractions are made with 111.Ic over : 112.Ar "a over b" 113yields $a over b$. 114.Pp 115.Ic sqrt 116makes square roots: 117.Ar "1 over sqrt 118.Ar {ax sup 2 +bx+c}" 119results in 120$1 over sqrt {ax sup 2 +bx+c}$ . 121.Pp 122The keywords 123.Ic from 124and 125.Ic to 126introduce lower and upper limits on arbitrary things: 127$lim from {n-> inf} sum from 0 to n x sub i$ 128is made with 129.Ar "lim from {n\-> inf } 130.Ar sum from 0 to n x 131.Ar sub i." 132.Pp 133Left and right brackets, braces, etc., of the right height are made with 134.Ic left 135and 136.Ic right : 137.Op Ar "left 138.Ar x sup 2 + y sup 2 139.AR over alpha right 140.Ar \&~=~1" 141produces 142$left [ x sup 2 + y sup 2 over alpha right ] ~=~1$. 143The 144.Ic right 145clause is optional. 146Legal characters after 147.Ic left 148and 149.Ic right 150are braces, brackets, bars, 151.Ic c 152and 153.Ic f 154for ceiling and floor, 155and "" for nothing at all (useful for a right-side-only bracket). 156.Pp 157Vertical piles of things are made with 158.Ic pile , 159.Ic lpile , 160.Ic cpile , 161and 162.Ic rpile : 163.Ar "pile {a above b above c}" 164produces 165$pile {a above b above c}$. 166There can be an arbitrary number of elements in a pile. 167.Ic lpile 168left-justifies, 169.Ic pile 170and 171.Ic cpile 172center, with different vertical spacing, 173and 174.Ic rpile 175right justifies. 176.Pp 177Matrices are made with 178.Ic matrix : 179.Ar "matrix { lcol { x sub i 180.Ar above y sub 2 } ccol { 181.Ar 1 above 2 } }" 182produces 183$matrix { lcol { x sub i above y sub 2 } ccol { 1 above 2 } }$. 184In addition, there is 185.Ic rcol 186for a right-justified column. 187.Pp 188.vs 12p 189Diacritical marks are made with 190.Ic dot , 191.Ic dotdot , 192.Ic hat , 193.Ic tilde , 194.Ic bar , 195.Ic vec , 196.Ic dyad , 197and 198.Ic under : 199.Ar "x dot \&= f(t) bar" 200is 201$x dot = f(t) bar$, 202.Ar "y dotdot bar \&~=~ 203.Ar n under" 204is 205$y dotdot bar ~=~ n under$, 206and 207.Ar "x vec \&~=~ y dyad" 208is 209$x vec ~=~ y dyad$. 210.Pp 211Sizes and font can be changed with 212.Ic size 213.Op Ar n 214or 215.Ic size 216.Sf Sy \(+- n, 217.Ic roman , 218.Ic italic , 219.Ic bold , 220and 221.Ic font 222.Ar n. 223Size and fonts can be changed globally in a document by 224.Ic gsize 225.Ar n 226and 227.Ic gfont 228.Ar n , 229or by the command-line arguments 230.Cx Fl s 231.Ar n 232.Cx 233and 234.Cx Fl f 235.Ar n 236.Cx . 237.Cx 238.Pp 239Normally subscripts and superscripts are reduced by 2403 point sizes from the previous size; 241this may be changed by the command-line argument 242.Cx Fl p 243.Ar n . 244.Cx 245.Pp 246Successive display arguments can be lined up. 247Place 248.Ic mark 249before the desired lineup point in the first equation; 250place 251.Ic lineup 252at the place that is to line up vertically in subsequent equations. 253.Pp 254Shorthands may be defined 255or existing keywords redefined with 256.Ic define : 257.Ar "define thing \&% replacement \&%" 258defines a new token called 259.Ar thing 260which will be replaced by 261.Ar replacement 262whenever it appears thereafter. 263The 264.Ic \&% 265may be any character that does not occur in 266.Ar replacement . 267.Pp 268Keywords like 269.Ar sum 270.EQ 271( sum ) 272.EN 273.Ar int 274.EQ 275( int ) 276.EN 277.Ar inf 278.EQ 279( inf ) 280.EN 281and shorthands like 282>= 283.EQ 284(>=) 285.EN 286\-> 287.EQ 288(->), 289.EN 290and 291!= 292.EQ 293( != ) 294.EN 295are recognized. 296Greek letters are spelled out in the desired case, as in 297.Ar alpha 298or 299.Ar GAMMA . 300Mathematical words like sin, cos, log are made Roman automatically. 301.Xr Troff 1 302four-character escapes like \e(bs (\(bs) 303can be used anywhere. 304Strings enclosed in double quotes "..." 305are passed through untouched; 306this permits keywords to be entered as text, 307and can be used to communicate 308with 309.Xr troff 1 310when all else fails. 311.Sh SEE ALSO 312.Xr troff 1 , 313.Xr tbl 1 , 314.Xr ms 7 , 315.Xr eqnchar 7 316.br 317B. W. Kernighan and L. L. Cherry, 318.Em Typesetting Mathematics\-User's Guide 319.Br 320J. F. Ossanna, 321.Em NROFF/TROFF User's Manual 322.Sh HISTORY 323.Nm Eqn 324appeared in Version 6 AT&T Unix. 325.Sh BUGS 326.Pp 327To embolden digits, parens, etc., 328it is necessary to quote them, 329as in `bold "12.3"'. 330