1 .\" $Id: eqn.7,v 1.23 2011/07/23 18:41:18 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.
33 This manual describes the
35 language accepted by the
37 utility, which correspond to the Second Edition eqn specification (see
45 documents are enclosed by the standalone
50 Equations are multi-line blocks consisting of formulas and control
52 .Sh EQUATION STRUCTURE
53 Each equation is bracketed by
59 these are not the same as
61 macros, and may only be invoked as
64 The equation grammar is as follows, where quoted strings are
65 case-sensitive literals in the input:
66 .Bd -literal -offset indent
70 | \*qdefine\*q text text
71 | \*qndefine\*q text text
72 | \*qtdefine\*q text text
79 | \*qmatrix\*q \*q{\*q [col \*q{\*q list \*q}\*q ]*
80 | pile \*q{\*q list \*q}\*q
83 | \*qleft\*q text eqn [\*qright\*q text]
84 col : \*qlcol\*q | \*qrcol\*q | \*qccol\*q
85 text : [^space\e\*q]+ | \e\*q.*\e\*q
86 pile : \*qlpile\*q | \*qcpile\*q | \*qrpile\*q
87 pos : \*qover\*q | \*qsup\*q | \*qsub\*q | \*qto\*q | \*qfrom\*q
88 mark : \*qdot\*q | \*qdotdot\*q | \*qhat\*q | \*qtilde\*q | \*qvec\*q
89 | \*qdyad\*q | \*qbar\*q | \*qunder\*q
90 font : \*qroman\*q | \*qitalic\*q | \*qbold\*q | \*qfat\*q
92 | list \*qabove\*q eqn
96 White-space consists of the space, tab, circumflex, and tilde
98 If within a quoted string, these space characters are retained.
99 Quoted strings are also not scanned for replacement definitions.
101 The following text terms are translated into a rendered glyph, if
102 available: alpha, beta, chi, delta, epsilon, eta, gamma, iota, kappa,
103 lambda, mu, nu, omega, omicron, phi, pi, psi, rho, sigma, tau, theta,
104 upsilon, xi, zeta, DELTA, GAMMA, LAMBDA, OMEGA, PHI, PI, PSI, SIGMA,
105 THETA, UPSILON, XI, inter (intersection), union (union), prod (product),
106 int (integral), sum (summation), grad (gradient), del (vector
107 differential), times (multiply), cdot (centre-dot), nothing (zero-width
108 space), approx (approximately equals), prime (prime), half (one-half),
109 partial (partial differential), inf (infinity), >> (much greater), <<
110 (much less), \-> (left arrow), <\- (right arrow), += (plus-minus), !=
111 (not equal), == (equivalence), <= (less-than-equal), and >=
114 The following control statements are available:
117 Replace all occurances of a key with a value.
118 Its syntax is as follows:
120 .D1 define Ar key cvalc
122 The first character of the value string,
124 is used as the delimiter for the value
126 This allows for arbitrary enclosure of terms (not just quotes), such as
128 .D1 define Ar foo 'bar baz'
129 .D1 define Ar foo cbar bazc
131 It is an error to have an empty
136 causes errors in some
138 implementations and should not be considered portable.
139 It is not expanded for replacements.
140 Definitions may refer to other definitions; these are evaluated
141 recursively when text replacement occurs and not when the definition is
144 Definitions can create arbitrary strings, for example, the following is
145 a legal construction.
146 .Bd -literal -offset indent
151 Self-referencing definitions will raise an error.
154 statement is a synonym for
160 Set the default font of subsequent output.
161 Its syntax is as follows:
165 In mandoc, this value is discarded.
167 Set the default size of subsequent output.
168 Its syntax is as follows:
174 value should be an integer.
176 Set an equation mode.
177 In mandoc, both arguments are thrown away.
178 Its syntax is as follows:
186 are not expanded for replacements.
188 Unset a previously-defined key.
189 Its syntax is as follows:
193 Once invoked, the definition for
198 is not expanded for replacements.
201 This section documents the compatibility of mandoc
205 implementation (including GNU troff).
211 is interpreted as a literal quote in troff.
212 In mandoc, this is interpreted as a comment.
214 In troff, The circumflex and tilde white-space symbols map to
216 In mandoc, these characters are synonyms for the space character.
218 The troff implementation of
220 allows for equation alignment with the
225 mandoc discards these tokens.
232 commands are also ignored.
241 .%A Brian W. Kernighan
242 .%A Lorinda L. Cherry
243 .%T System for Typesetting Mathematics
244 .%J Communications of the ACM
250 .%A Brian W. Kernighan
251 .%A Lorinda L. Cherry
252 .%T Typesetting Mathematics, User's Guide
256 .%A Brian W. Kernighan
257 .%A Lorinda L. Cherry
258 .%T Typesetting Mathematics, User's Guide (Second Edition)
262 The eqn utility, a preprocessor for troff, was originally written by
263 Brian W. Kernighan and Lorinda L. Cherry in 1975.
264 The GNU reimplementation of eqn, part of the GNU troff package, was
265 released in 1989 by James Clark.
272 reference was written by
273 .An Kristaps Dzonsons Aq kristaps@bsd.lv .