1*0a6a1f1dSLionel Sambuc.\" Id: eqn.7,v 1.29 2013/07/13 19:41:16 schwarze Exp 292395e9cSLionel Sambuc.\" 392395e9cSLionel Sambuc.\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> 492395e9cSLionel Sambuc.\" 592395e9cSLionel Sambuc.\" Permission to use, copy, modify, and distribute this software for any 692395e9cSLionel Sambuc.\" purpose with or without fee is hereby granted, provided that the above 792395e9cSLionel Sambuc.\" copyright notice and this permission notice appear in all copies. 892395e9cSLionel Sambuc.\" 992395e9cSLionel Sambuc.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1092395e9cSLionel Sambuc.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1192395e9cSLionel Sambuc.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1292395e9cSLionel Sambuc.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1392395e9cSLionel Sambuc.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1492395e9cSLionel Sambuc.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1592395e9cSLionel Sambuc.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1692395e9cSLionel Sambuc.\" 17*0a6a1f1dSLionel Sambuc.Dd July 13, 2013 1892395e9cSLionel Sambuc.Dt EQN 7 1992395e9cSLionel Sambuc.Os 2092395e9cSLionel Sambuc.Sh NAME 2192395e9cSLionel Sambuc.Nm eqn 2292395e9cSLionel Sambuc.Nd eqn language reference for mandoc 2392395e9cSLionel Sambuc.Sh DESCRIPTION 2492395e9cSLionel SambucThe 2592395e9cSLionel Sambuc.Nm eqn 2692395e9cSLionel Sambuclanguage is an equation-formatting language. 2792395e9cSLionel SambucIt is used within 2892395e9cSLionel Sambuc.Xr mdoc 7 2992395e9cSLionel Sambucand 3092395e9cSLionel Sambuc.Xr man 7 3192395e9cSLionel Sambuc.Ux 3292395e9cSLionel Sambucmanual pages. 3392395e9cSLionel SambucIt describes the 3492395e9cSLionel Sambuc.Em structure 3592395e9cSLionel Sambucof an equation, not its mathematical meaning. 3692395e9cSLionel SambucThis manual describes the 3792395e9cSLionel Sambuc.Nm 3892395e9cSLionel Sambuclanguage accepted by the 3992395e9cSLionel Sambuc.Xr mandoc 1 4092395e9cSLionel Sambucutility, which corresponds to the Second Edition eqn specification (see 4192395e9cSLionel Sambuc.Sx SEE ALSO 4292395e9cSLionel Sambucfor references). 4392395e9cSLionel Sambuc.Pp 4492395e9cSLionel SambucEquations within 4592395e9cSLionel Sambuc.Xr mdoc 7 4692395e9cSLionel Sambucor 4792395e9cSLionel Sambuc.Xr man 7 4892395e9cSLionel Sambucdocuments are enclosed by the standalone 4992395e9cSLionel Sambuc.Sq \&.EQ 5092395e9cSLionel Sambucand 5192395e9cSLionel Sambuc.Sq \&.EN 5292395e9cSLionel Sambuctags. 5392395e9cSLionel SambucEquations are multi-line blocks consisting of formulas and control 5492395e9cSLionel Sambucstatements. 5592395e9cSLionel Sambuc.Sh EQUATION STRUCTURE 5692395e9cSLionel SambucEach equation is bracketed by 5792395e9cSLionel Sambuc.Sq \&.EQ 5892395e9cSLionel Sambucand 5992395e9cSLionel Sambuc.Sq \&.EN 6092395e9cSLionel Sambucstrings. 6192395e9cSLionel Sambuc.Em Note : 6292395e9cSLionel Sambucthese are not the same as 6392395e9cSLionel Sambuc.Xr roff 7 6492395e9cSLionel Sambucmacros, and may only be invoked as 6592395e9cSLionel Sambuc.Sq \&.EQ . 6692395e9cSLionel Sambuc.Pp 6792395e9cSLionel SambucThe equation grammar is as follows, where quoted strings are 6892395e9cSLionel Sambuccase-sensitive literals in the input: 6992395e9cSLionel Sambuc.Bd -literal -offset indent 7092395e9cSLionel Sambuceqn : box | eqn box 7192395e9cSLionel Sambucbox : text 7292395e9cSLionel Sambuc | \*q{\*q eqn \*q}\*q 7392395e9cSLionel Sambuc | \*qdefine\*q text text 7492395e9cSLionel Sambuc | \*qndefine\*q text text 7592395e9cSLionel Sambuc | \*qtdefine\*q text text 7692395e9cSLionel Sambuc | \*qgfont\*q text 7792395e9cSLionel Sambuc | \*qgsize\*q text 7892395e9cSLionel Sambuc | \*qset\*q text text 7992395e9cSLionel Sambuc | \*qundef\*q text 8092395e9cSLionel Sambuc | box pos box 8192395e9cSLionel Sambuc | box mark 8292395e9cSLionel Sambuc | \*qmatrix\*q \*q{\*q [col \*q{\*q list \*q}\*q ]* 8392395e9cSLionel Sambuc | pile \*q{\*q list \*q}\*q 8492395e9cSLionel Sambuc | font box 8592395e9cSLionel Sambuc | \*qsize\*q text box 8692395e9cSLionel Sambuc | \*qleft\*q text eqn [\*qright\*q text] 8792395e9cSLionel Sambuccol : \*qlcol\*q | \*qrcol\*q | \*qccol\*q | \*qcol\*q 8892395e9cSLionel Sambuctext : [^space\e\*q]+ | \e\*q.*\e\*q 8992395e9cSLionel Sambucpile : \*qlpile\*q | \*qcpile\*q | \*qrpile\*q | \*qpile\*q 9092395e9cSLionel Sambucpos : \*qover\*q | \*qsup\*q | \*qsub\*q | \*qto\*q | \*qfrom\*q 9192395e9cSLionel Sambucmark : \*qdot\*q | \*qdotdot\*q | \*qhat\*q | \*qtilde\*q | \*qvec\*q 9292395e9cSLionel Sambuc | \*qdyad\*q | \*qbar\*q | \*qunder\*q 9392395e9cSLionel Sambucfont : \*qroman\*q | \*qitalic\*q | \*qbold\*q | \*qfat\*q 9492395e9cSLionel Sambuclist : eqn 9592395e9cSLionel Sambuc | list \*qabove\*q eqn 9692395e9cSLionel Sambucspace : [\e^~ \et] 9792395e9cSLionel Sambuc.Ed 9892395e9cSLionel Sambuc.Pp 9992395e9cSLionel SambucWhite-space consists of the space, tab, circumflex, and tilde 10092395e9cSLionel Sambuccharacters. 10192395e9cSLionel SambucIf within a quoted string, these space characters are retained. 10292395e9cSLionel SambucQuoted strings are also not scanned for replacement definitions. 10392395e9cSLionel Sambuc.Pp 10492395e9cSLionel SambucThe following text terms are translated into a rendered glyph, if 10592395e9cSLionel Sambucavailable: alpha, beta, chi, delta, epsilon, eta, gamma, iota, kappa, 10692395e9cSLionel Sambuclambda, mu, nu, omega, omicron, phi, pi, psi, rho, sigma, tau, theta, 10792395e9cSLionel Sambucupsilon, xi, zeta, DELTA, GAMMA, LAMBDA, OMEGA, PHI, PI, PSI, SIGMA, 10892395e9cSLionel SambucTHETA, UPSILON, XI, inter (intersection), union (union), prod (product), 10992395e9cSLionel Sambucint (integral), sum (summation), grad (gradient), del (vector 11092395e9cSLionel Sambucdifferential), times (multiply), cdot (centre-dot), nothing (zero-width 11192395e9cSLionel Sambucspace), approx (approximately equals), prime (prime), half (one-half), 11292395e9cSLionel Sambucpartial (partial differential), inf (infinity), >> (much greater), << 11392395e9cSLionel Sambuc(much less), \-> (left arrow), <\- (right arrow), += (plus-minus), != 11492395e9cSLionel Sambuc(not equal), == (equivalence), <= (less-than-equal), and >= 11592395e9cSLionel Sambuc(more-than-equal). 11692395e9cSLionel Sambuc.Pp 11792395e9cSLionel SambucThe following control statements are available: 11892395e9cSLionel Sambuc.Bl -tag -width Ds 11992395e9cSLionel Sambuc.It Cm define 12092395e9cSLionel SambucReplace all occurrences of a key with a value. 12192395e9cSLionel SambucIts syntax is as follows: 12292395e9cSLionel Sambuc.Pp 12392395e9cSLionel Sambuc.D1 define Ar key cvalc 12492395e9cSLionel Sambuc.Pp 12592395e9cSLionel SambucThe first character of the value string, 12692395e9cSLionel Sambuc.Ar c , 12792395e9cSLionel Sambucis used as the delimiter for the value 12892395e9cSLionel Sambuc.Ar val . 12992395e9cSLionel SambucThis allows for arbitrary enclosure of terms (not just quotes), such as 13092395e9cSLionel Sambuc.Pp 13192395e9cSLionel Sambuc.D1 define Ar foo 'bar baz' 13292395e9cSLionel Sambuc.D1 define Ar foo cbar bazc 13392395e9cSLionel Sambuc.Pp 13492395e9cSLionel SambucIt is an error to have an empty 13592395e9cSLionel Sambuc.Ar key 13692395e9cSLionel Sambucor 13792395e9cSLionel Sambuc.Ar val . 13892395e9cSLionel SambucNote that a quoted 13992395e9cSLionel Sambuc.Ar key 14092395e9cSLionel Sambuccauses errors in some 14192395e9cSLionel Sambuc.Nm 14292395e9cSLionel Sambucimplementations and should not be considered portable. 14392395e9cSLionel SambucIt is not expanded for replacements. 14492395e9cSLionel SambucDefinitions may refer to other definitions; these are evaluated 14592395e9cSLionel Sambucrecursively when text replacement occurs and not when the definition is 14692395e9cSLionel Sambuccreated. 14792395e9cSLionel Sambuc.Pp 14892395e9cSLionel SambucDefinitions can create arbitrary strings, for example, the following is 14992395e9cSLionel Sambuca legal construction. 15092395e9cSLionel Sambuc.Bd -literal -offset indent 15192395e9cSLionel Sambucdefine foo 'define' 15292395e9cSLionel Sambucfoo bar 'baz' 15392395e9cSLionel Sambuc.Ed 15492395e9cSLionel Sambuc.Pp 15592395e9cSLionel SambucSelf-referencing definitions will raise an error. 15692395e9cSLionel SambucThe 15792395e9cSLionel Sambuc.Cm ndefine 15892395e9cSLionel Sambucstatement is a synonym for 15992395e9cSLionel Sambuc.Cm define , 16092395e9cSLionel Sambucwhile 16192395e9cSLionel Sambuc.Cm tdefine 16292395e9cSLionel Sambucis discarded. 16392395e9cSLionel Sambuc.It Cm gfont 16492395e9cSLionel SambucSet the default font of subsequent output. 16592395e9cSLionel SambucIts syntax is as follows: 16692395e9cSLionel Sambuc.Pp 16792395e9cSLionel Sambuc.D1 gfont Ar font 16892395e9cSLionel Sambuc.Pp 16992395e9cSLionel SambucIn mandoc, this value is discarded. 17092395e9cSLionel Sambuc.It Cm gsize 17192395e9cSLionel SambucSet the default size of subsequent output. 17292395e9cSLionel SambucIts syntax is as follows: 17392395e9cSLionel Sambuc.Pp 17492395e9cSLionel Sambuc.D1 gsize Ar size 17592395e9cSLionel Sambuc.Pp 17692395e9cSLionel SambucThe 17792395e9cSLionel Sambuc.Ar size 17892395e9cSLionel Sambucvalue should be an integer. 17992395e9cSLionel Sambuc.It Cm set 18092395e9cSLionel SambucSet an equation mode. 18192395e9cSLionel SambucIn mandoc, both arguments are thrown away. 18292395e9cSLionel SambucIts syntax is as follows: 18392395e9cSLionel Sambuc.Pp 18492395e9cSLionel Sambuc.D1 set Ar key val 18592395e9cSLionel Sambuc.Pp 18692395e9cSLionel SambucThe 18792395e9cSLionel Sambuc.Ar key 18892395e9cSLionel Sambucand 18992395e9cSLionel Sambuc.Ar val 19092395e9cSLionel Sambucare not expanded for replacements. 19192395e9cSLionel SambucThis statement is a GNU extension. 19292395e9cSLionel Sambuc.It Cm undef 19392395e9cSLionel SambucUnset a previously-defined key. 19492395e9cSLionel SambucIts syntax is as follows: 19592395e9cSLionel Sambuc.Pp 19692395e9cSLionel Sambuc.D1 define Ar key 19792395e9cSLionel Sambuc.Pp 19892395e9cSLionel SambucOnce invoked, the definition for 19992395e9cSLionel Sambuc.Ar key 20092395e9cSLionel Sambucis discarded. 20192395e9cSLionel SambucThe 20292395e9cSLionel Sambuc.Ar key 20392395e9cSLionel Sambucis not expanded for replacements. 20492395e9cSLionel SambucThis statement is a GNU extension. 20592395e9cSLionel Sambuc.El 20692395e9cSLionel Sambuc.Sh COMPATIBILITY 20792395e9cSLionel SambucThis section documents the compatibility of mandoc 20892395e9cSLionel Sambuc.Nm 20992395e9cSLionel Sambucand the troff 21092395e9cSLionel Sambuc.Nm 21192395e9cSLionel Sambucimplementation (including GNU troff). 21292395e9cSLionel Sambuc.Pp 21392395e9cSLionel Sambuc.Bl -dash -compact 21492395e9cSLionel Sambuc.It 21592395e9cSLionel SambucThe text string 21692395e9cSLionel Sambuc.Sq \e\*q 21792395e9cSLionel Sambucis interpreted as a literal quote in troff. 21892395e9cSLionel SambucIn mandoc, this is interpreted as a comment. 21992395e9cSLionel Sambuc.It 22092395e9cSLionel SambucIn troff, The circumflex and tilde white-space symbols map to 22192395e9cSLionel Sambucfixed-width spaces. 22292395e9cSLionel SambucIn mandoc, these characters are synonyms for the space character. 22392395e9cSLionel Sambuc.It 22492395e9cSLionel SambucThe troff implementation of 22592395e9cSLionel Sambuc.Nm 22692395e9cSLionel Sambucallows for equation alignment with the 22792395e9cSLionel Sambuc.Cm mark 22892395e9cSLionel Sambucand 22992395e9cSLionel Sambuc.Cm lineup 23092395e9cSLionel Sambuctokens. 23192395e9cSLionel Sambucmandoc discards these tokens. 23292395e9cSLionel SambucThe 23392395e9cSLionel Sambuc.Cm back Ar n , 23492395e9cSLionel Sambuc.Cm fwd Ar n , 23592395e9cSLionel Sambuc.Cm up Ar n , 23692395e9cSLionel Sambucand 23792395e9cSLionel Sambuc.Cm down Ar n 23892395e9cSLionel Sambuccommands are also ignored. 23992395e9cSLionel Sambuc.El 24092395e9cSLionel Sambuc.Sh SEE ALSO 24192395e9cSLionel Sambuc.Xr mandoc 1 , 24292395e9cSLionel Sambuc.Xr man 7 , 24392395e9cSLionel Sambuc.Xr mandoc_char 7 , 24492395e9cSLionel Sambuc.Xr mdoc 7 , 24592395e9cSLionel Sambuc.Xr roff 7 24692395e9cSLionel Sambuc.Rs 24792395e9cSLionel Sambuc.%A Brian W. Kernighan 24892395e9cSLionel Sambuc.%A Lorinda L. Cherry 24992395e9cSLionel Sambuc.%T System for Typesetting Mathematics 25092395e9cSLionel Sambuc.%J Communications of the ACM 25192395e9cSLionel Sambuc.%V 18 25292395e9cSLionel Sambuc.%P 151\(en157 25392395e9cSLionel Sambuc.%D March, 1975 25492395e9cSLionel Sambuc.Re 25592395e9cSLionel Sambuc.Rs 25692395e9cSLionel Sambuc.%A Brian W. Kernighan 25792395e9cSLionel Sambuc.%A Lorinda L. Cherry 25892395e9cSLionel Sambuc.%T Typesetting Mathematics, User's Guide 25992395e9cSLionel Sambuc.%D 1976 26092395e9cSLionel Sambuc.Re 26192395e9cSLionel Sambuc.Rs 26292395e9cSLionel Sambuc.%A Brian W. Kernighan 26392395e9cSLionel Sambuc.%A Lorinda L. Cherry 26492395e9cSLionel Sambuc.%T Typesetting Mathematics, User's Guide (Second Edition) 26592395e9cSLionel Sambuc.%D 1978 26692395e9cSLionel Sambuc.Re 26792395e9cSLionel Sambuc.Sh HISTORY 26892395e9cSLionel SambucThe eqn utility, a preprocessor for troff, was originally written by 26992395e9cSLionel SambucBrian W. Kernighan and Lorinda L. Cherry in 1975. 27092395e9cSLionel SambucThe GNU reimplementation of eqn, part of the GNU troff package, was 27192395e9cSLionel Sambucreleased in 1989 by James Clark. 27292395e9cSLionel SambucThe eqn component of 27392395e9cSLionel Sambuc.Xr mandoc 1 27492395e9cSLionel Sambucwas added in 2011. 27592395e9cSLionel Sambuc.Sh AUTHORS 27692395e9cSLionel SambucThis 27792395e9cSLionel Sambuc.Nm 27892395e9cSLionel Sambucreference was written by 279*0a6a1f1dSLionel Sambuc.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv . 280