Annotation of mandoc/eqn.7, Revision 1.18
1.18 ! kristaps 1: .\" $Id: eqn.7,v 1.17 2011/07/22 14:55:07 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.15 kristaps 67: | "{" eqn "}"
68: | "define" text text
1.18 ! kristaps 69: | "gfont" text
1.17 kristaps 70: | "gsize" text
1.15 kristaps 71: | "set" text text
72: | "undef" text
1.11 kristaps 73: | box pos box
1.9 kristaps 74: | box mark
1.15 kristaps 75: | pile "{" list "}"
1.10 kristaps 76: | font box
1.15 kristaps 77: | "size" text box
78: | "left" text eqn ["right" text]
1.3 kristaps 79: text : TEXT
1.15 kristaps 80: pile : "lpile" | "cpile" | "rpile"
81: pos : "over" | "sup" | "sub" | "to" | "from"
82: mark : "dot" | "dotdot" | "hat" | "tilde" | "vec"
83: | "dyad" | "bar" | "under"
84: font : "roman" | "italic" | "bold"
85: list : eqn
86: | list "above" eqn
1.3 kristaps 87: .Ed
88: .Pp
89: Data in TEXT form is a non-empty sequence of non-space characters or a
90: non-empty quoted string.
1.5 kristaps 91: Unless within a quoted string, white-space (and enclosing literal quote
92: pairs) is thrown away.
1.6 kristaps 93: Quoted strings are not scanned for replacement definitions.
1.16 kristaps 94: .Pp
95: The following TEXT terms are translated into a rendered glyph, if
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.
200: .El
1.1 kristaps 201: .Sh SEE ALSO
202: .Xr mandoc 1 ,
203: .Xr man 7 ,
204: .Xr mandoc_char 7 ,
205: .Xr mdoc 7 ,
206: .Xr roff 7
207: .Rs
208: .%A Brian W. Kernighan
209: .%A Lorinda L. Cherry
210: .%T System for Typesetting Mathematics
211: .%J Communications of the ACM
212: .%V 18
213: .%P 151\(en157
214: .%D March, 1975
215: .Re
1.5 kristaps 216: .Rs
217: .%A Brian W. Kernighan
218: .%A Lorinda L. Cherry
219: .%T Typesetting Mathematics, User's Guide
220: .%D 1976
221: .Re
222: .Rs
223: .%A Brian W. Kernighan
224: .%A Lorinda L. Cherry
225: .%T Typesetting Mathematics, User's Guide (Second Edition)
226: .%D 1978
227: .Re
228: .Sh HISTORY
1.15 kristaps 229: The eqn utility, a preprocessor for troff, was originally written by
1.5 kristaps 230: Brian W. Kernighan and Lorinda L. Cherry in 1975.
231: The GNU reimplementation of eqn, part of the GNU troff package, was
232: released in 1989 by James Clark.
233: The eqn component of
234: .Xr mandoc 1
235: was added in 2011.
1.1 kristaps 236: .Sh AUTHORS
1.5 kristaps 237: This
1.1 kristaps 238: .Nm
239: reference was written by
240: .An Kristaps Dzonsons Aq kristaps@bsd.lv .
CVSweb