Annotation of mandoc/eqn.7, Revision 1.19
1.19 ! kristaps 1: .\" $Id: eqn.7,v 1.18 2011/07/22 14:59:02 kristaps Exp $
1.1 kristaps 2: .\"
3: .\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4: .\"
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.
8: .\"
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.
16: .\"
1.15 kristaps 17: .Dd $Mdocdate: July 22 2011 $
1.1 kristaps 18: .Dt EQN 7
19: .Os
20: .Sh NAME
21: .Nm eqn
22: .Nd eqn language reference for mandoc
23: .Sh DESCRIPTION
24: The
25: .Nm eqn
26: language is a equation-formatting language.
27: It is used within
28: .Xr mdoc 7
29: and
30: .Xr man 7
31: .Ux
32: manual pages.
33: This manual describes the subset of the
34: .Nm
35: language accepted by the
36: .Xr mandoc 1
37: utility.
38: .Pp
39: Equations within
40: .Xr mdoc 7
41: or
42: .Xr man 7
1.3 kristaps 43: documents are enclosed by the standalone
44: .Sq \&.EQ
1.1 kristaps 45: and
1.3 kristaps 46: .Sq \&.EN
47: tags.
48: Equations are multi-line blocks consisting of formulas and control
49: statements.
50: .Sh EQUATION STRUCTURE
51: Each equation is bracketed by
52: .Sq \&.EQ
53: and
54: .Sq \&.EN
55: strings.
56: .Em Note :
57: these are not the same as
58: .Xr roff 7
59: macros, and may only be invoked as
60: .Sq \&.EQ .
61: .Pp
1.15 kristaps 62: The equation grammar is as follows, where quoted strings are
63: case-sensitive literals in the input:
1.3 kristaps 64: .Bd -literal -offset indent
65: eqn : box | eqn box
66: box : text
1.19 ! kristaps 67: | \*q{\*q eqn \*q}\*q
! 68: | \*qdefine\*q text text
! 69: | \*qgfont\*q text
! 70: | \*qgsize\*q text
! 71: | \*qset\*q text text
! 72: | \*qundef\*q text
1.11 kristaps 73: | box pos box
1.9 kristaps 74: | box mark
1.19 ! kristaps 75: | pile \*q{\*q list \*q}\*q
1.10 kristaps 76: | font box
1.19 ! kristaps 77: | \*qsize\*q text box
! 78: | \*qleft\*q text eqn [\*qright\*q text]
! 79: text : [^space\e\*q]+ | \e\*q.*\e\*q
! 80: pile : \*qlpile\*q | \*qcpile\*q | \*qrpile\*q
! 81: pos : \*qover\*q | \*qsup\*q | \*qsub\*q | \*qto\*q | \*qfrom\*q
! 82: mark : \*qdot\*q | \*qdotdot\*q | \*qhat\*q | \*qtilde\*q | \*qvec\*q
! 83: | \*qdyad\*q | \*qbar\*q | \*qunder\*q
! 84: font : \*qroman\*q | \*qitalic\*q | \*\*qbold\*q
! 85: list : eqn
! 86: | list \*qabove\*q eqn
! 87: space : [\e^~ \et]
1.3 kristaps 88: .Ed
89: .Pp
1.19 ! kristaps 90: White-space consists of the space, tab, circumflex, and tilde
! 91: characters.
! 92: If within a quoted string, these space characters are retained.
! 93: Quoted strings are also not scanned for replacement definitions.
1.16 kristaps 94: .Pp
1.19 ! kristaps 95: The following text terms are translated into a rendered glyph, if
1.16 kristaps 96: available: alpha, beta, chi, delta, epsilon, eta, gamma, iota, kappa,
97: lambda, mu, nu, omega, omicron, phi, pi, psi, rho, sigma, tau, theta,
98: upsilon, xi, zeta, DELTA, GAMMA, LAMBDA, OMEGA, PHI, PI, PSI, SIGMA,
99: THETA, UPSILON, XI, inter (intersection), union (union), prod (product),
100: int (integral), sum (summation), grad (gradient), del (vector
101: differential), times (multiply), cdot (centre-dot), nothing (zero-width
102: space), approx (approximately equals), prime (prime), half (one-half),
103: partial (partial differential), inf (infinity), >> (much greater), <<
104: (much less), \-> (left arrow), <\- (right arrow), += (plus-minus), !=
105: (not equal), == (equivalence), <= (less-than-equal), and >=
106: (more-than-equal).
1.3 kristaps 107: .Pp
108: The following control statements are available:
109: .Bl -tag -width Ds
110: .It Cm define
111: Replace all occurances of a key with a value.
112: Its syntax is as follows:
113: .Pp
1.5 kristaps 114: .D1 define Ar key cvalc
115: .Pp
116: The first character of the value string,
117: .Ar c ,
118: is used as the delimiter for the value
119: .Ar val .
120: This allows for arbitrary enclosure of terms (not just quotes), such as
121: .Pp
122: .D1 define Ar foo 'bar baz'
123: .D1 define Ar foo cbar bazc
1.2 kristaps 124: .Pp
1.3 kristaps 125: It is an error to have an empty
126: .Ar key or
1.5 kristaps 127: .Ar val .
1.3 kristaps 128: Note that a quoted
129: .Ar key
130: causes errors in some
1.2 kristaps 131: .Nm
1.3 kristaps 132: implementations and should not be considered portable.
1.7 kristaps 133: It is not expanded for replacements.
1.4 kristaps 134: Definitions may refer to other definitions; these are evaluated
135: recursively when text replacement occurs and not when the definition is
136: created.
1.5 kristaps 137: .Pp
138: Definitions can create arbitrary strings, for example, the following is
139: a legal construction.
140: .Bd -literal -offset indent
141: define foo 'define'
142: foo bar 'baz'
143: .Ed
144: .Pp
1.4 kristaps 145: Self-referencing definitions will raise an error.
1.18 kristaps 146: .It Cm gfont
147: Set the default font of subsequent output.
148: Its syntax is as follows:
149: .Pp
150: .D1 gfont Ar font
151: .Pp
152: In mandoc, this value is discarded.
1.17 kristaps 153: .It Cm gsize
154: Set the default size of subsequent output.
155: Its syntax is as follows:
156: .Pp
1.18 kristaps 157: .D1 gsize Ar size
1.17 kristaps 158: .Pp
159: The
160: .Ar size
161: value should be an integer.
1.3 kristaps 162: .It Cm set
1.4 kristaps 163: Set an equation mode.
1.18 kristaps 164: In mandoc, both arguments are thrown away.
1.7 kristaps 165: Its syntax is as follows:
166: .Pp
167: .D1 set Ar key val
168: .Pp
169: The
170: .Ar key
171: and
172: .Ar val
173: are not expanded for replacements.
1.3 kristaps 174: .It Cm undef
175: Unset a previously-defined key.
176: Its syntax is as follows:
177: .Pp
178: .D1 define Ar key
1.2 kristaps 179: .Pp
1.3 kristaps 180: Once invoked, the definition for
181: .Ar key
182: is discarded.
1.7 kristaps 183: The
184: .Ar key
185: is not expanded for replacements.
1.3 kristaps 186: .El
1.5 kristaps 187: .Sh COMPATIBILITY
188: This section documents the compatibility of mandoc
189: .Nm
190: and the troff
191: .Nm
192: implementation (including GNU troff).
193: .Pp
194: .Bl -dash -compact
195: .It
196: The text string
197: .Sq \e\*q
198: is interpreted as a literal quote in troff.
199: In mandoc, this is interpreted as a comment.
1.19 ! kristaps 200: .It
! 201: In troff, The circumflex and tilde white-space symbols map to
! 202: fixed-width spaces.
! 203: In mandoc, these characters are synonyms for the space character.
1.5 kristaps 204: .El
1.1 kristaps 205: .Sh SEE ALSO
206: .Xr mandoc 1 ,
207: .Xr man 7 ,
208: .Xr mandoc_char 7 ,
209: .Xr mdoc 7 ,
210: .Xr roff 7
211: .Rs
212: .%A Brian W. Kernighan
213: .%A Lorinda L. Cherry
214: .%T System for Typesetting Mathematics
215: .%J Communications of the ACM
216: .%V 18
217: .%P 151\(en157
218: .%D March, 1975
219: .Re
1.5 kristaps 220: .Rs
221: .%A Brian W. Kernighan
222: .%A Lorinda L. Cherry
223: .%T Typesetting Mathematics, User's Guide
224: .%D 1976
225: .Re
226: .Rs
227: .%A Brian W. Kernighan
228: .%A Lorinda L. Cherry
229: .%T Typesetting Mathematics, User's Guide (Second Edition)
230: .%D 1978
231: .Re
232: .Sh HISTORY
1.15 kristaps 233: The eqn utility, a preprocessor for troff, was originally written by
1.5 kristaps 234: Brian W. Kernighan and Lorinda L. Cherry in 1975.
235: The GNU reimplementation of eqn, part of the GNU troff package, was
236: released in 1989 by James Clark.
237: The eqn component of
238: .Xr mandoc 1
239: was added in 2011.
1.1 kristaps 240: .Sh AUTHORS
1.5 kristaps 241: This
1.1 kristaps 242: .Nm
243: reference was written by
244: .An Kristaps Dzonsons Aq kristaps@bsd.lv .
CVSweb