1 .\" $Id: eqn.7,v 1.25 2011/07/23 19:04:47 kristaps Exp $
3 .\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: July 23 2011 $
22 .Nd eqn language reference for mandoc
26 language is a equation-formatting language.
35 of an equation, not its mathematical meaning.
36 This manual describes the
38 language accepted by the
40 utility, which correspond to the Second Edition eqn specification (see
48 documents are enclosed by the standalone
53 Equations are multi-line blocks consisting of formulas and control
55 .Sh EQUATION STRUCTURE
56 Each equation is bracketed by
62 these are not the same as
64 macros, and may only be invoked as
67 The equation grammar is as follows, where quoted strings are
68 case-sensitive literals in the input:
69 .Bd -literal -offset indent
73 | \*qdefine\*q text text
74 | \*qndefine\*q text text
75 | \*qtdefine\*q text text
82 | \*qmatrix\*q \*q{\*q [col \*q{\*q list \*q}\*q ]*
83 | pile \*q{\*q list \*q}\*q
86 | \*qleft\*q text eqn [\*qright\*q text]
87 col : \*qlcol\*q | \*qrcol\*q | \*qccol\*q | \*qcol\*q
88 text : [^space\e\*q]+ | \e\*q.*\e\*q
89 pile : \*qlpile\*q | \*qcpile\*q | \*qrpile\*q | \*qpile\*q
90 pos : \*qover\*q | \*qsup\*q | \*qsub\*q | \*qto\*q | \*qfrom\*q
91 mark : \*qdot\*q | \*qdotdot\*q | \*qhat\*q | \*qtilde\*q | \*qvec\*q
92 | \*qdyad\*q | \*qbar\*q | \*qunder\*q
93 font : \*qroman\*q | \*qitalic\*q | \*qbold\*q | \*qfat\*q
95 | list \*qabove\*q eqn
99 White-space consists of the space, tab, circumflex, and tilde
101 If within a quoted string, these space characters are retained.
102 Quoted strings are also not scanned for replacement definitions.
104 The following text terms are translated into a rendered glyph, if
105 available: alpha, beta, chi, delta, epsilon, eta, gamma, iota, kappa,
106 lambda, mu, nu, omega, omicron, phi, pi, psi, rho, sigma, tau, theta,
107 upsilon, xi, zeta, DELTA, GAMMA, LAMBDA, OMEGA, PHI, PI, PSI, SIGMA,
108 THETA, UPSILON, XI, inter (intersection), union (union), prod (product),
109 int (integral), sum (summation), grad (gradient), del (vector
110 differential), times (multiply), cdot (centre-dot), nothing (zero-width
111 space), approx (approximately equals), prime (prime), half (one-half),
112 partial (partial differential), inf (infinity), >> (much greater), <<
113 (much less), \-> (left arrow), <\- (right arrow), += (plus-minus), !=
114 (not equal), == (equivalence), <= (less-than-equal), and >=
117 The following control statements are available:
120 Replace all occurances of a key with a value.
121 Its syntax is as follows:
123 .D1 define Ar key cvalc
125 The first character of the value string,
127 is used as the delimiter for the value
129 This allows for arbitrary enclosure of terms (not just quotes), such as
131 .D1 define Ar foo 'bar baz'
132 .D1 define Ar foo cbar bazc
134 It is an error to have an empty
139 causes errors in some
141 implementations and should not be considered portable.
142 It is not expanded for replacements.
143 Definitions may refer to other definitions; these are evaluated
144 recursively when text replacement occurs and not when the definition is
147 Definitions can create arbitrary strings, for example, the following is
148 a legal construction.
149 .Bd -literal -offset indent
154 Self-referencing definitions will raise an error.
157 statement is a synonym for
163 Set the default font of subsequent output.
164 Its syntax is as follows:
168 In mandoc, this value is discarded.
170 Set the default size of subsequent output.
171 Its syntax is as follows:
177 value should be an integer.
179 Set an equation mode.
180 In mandoc, both arguments are thrown away.
181 Its syntax is as follows:
189 are not expanded for replacements.
190 This statement is a GNU extension.
192 Unset a previously-defined key.
193 Its syntax is as follows:
197 Once invoked, the definition for
202 is not expanded for replacements.
203 This statement is a GNU extension.
206 This section documents the compatibility of mandoc
210 implementation (including GNU troff).
216 is interpreted as a literal quote in troff.
217 In mandoc, this is interpreted as a comment.
219 In troff, The circumflex and tilde white-space symbols map to
221 In mandoc, these characters are synonyms for the space character.
223 The troff implementation of
225 allows for equation alignment with the
230 mandoc discards these tokens.
237 commands are also ignored.
246 .%A Brian W. Kernighan
247 .%A Lorinda L. Cherry
248 .%T System for Typesetting Mathematics
249 .%J Communications of the ACM
255 .%A Brian W. Kernighan
256 .%A Lorinda L. Cherry
257 .%T Typesetting Mathematics, User's Guide
261 .%A Brian W. Kernighan
262 .%A Lorinda L. Cherry
263 .%T Typesetting Mathematics, User's Guide (Second Edition)
267 The eqn utility, a preprocessor for troff, was originally written by
268 Brian W. Kernighan and Lorinda L. Cherry in 1975.
269 The GNU reimplementation of eqn, part of the GNU troff package, was
270 released in 1989 by James Clark.
277 reference was written by
278 .An Kristaps Dzonsons Aq kristaps@bsd.lv .