Annotation of mandoc/eqn.7, Revision 1.16
1.16 ! kristaps 1: .\" $Id: eqn.7,v 1.15 2011/07/22 13:48:52 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
69: | "set" text text
70: | "undef" text
1.11 kristaps 71: | box pos box
1.9 kristaps 72: | box mark
1.15 kristaps 73: | pile "{" list "}"
1.10 kristaps 74: | font box
1.15 kristaps 75: | "size" text box
76: | "left" text eqn ["right" text]
1.3 kristaps 77: text : TEXT
1.15 kristaps 78: pile : "lpile" | "cpile" | "rpile"
79: pos : "over" | "sup" | "sub" | "to" | "from"
80: mark : "dot" | "dotdot" | "hat" | "tilde" | "vec"
81: | "dyad" | "bar" | "under"
82: font : "roman" | "italic" | "bold"
83: list : eqn
84: | list "above" eqn
1.3 kristaps 85: .Ed
86: .Pp
87: Data in TEXT form is a non-empty sequence of non-space characters or a
88: non-empty quoted string.
1.5 kristaps 89: Unless within a quoted string, white-space (and enclosing literal quote
90: pairs) is thrown away.
1.6 kristaps 91: Quoted strings are not scanned for replacement definitions.
1.16 ! kristaps 92: .Pp
! 93: The following TEXT terms are translated into a rendered glyph, if
! 94: available: alpha, beta, chi, delta, epsilon, eta, gamma, iota, kappa,
! 95: lambda, mu, nu, omega, omicron, phi, pi, psi, rho, sigma, tau, theta,
! 96: upsilon, xi, zeta, DELTA, GAMMA, LAMBDA, OMEGA, PHI, PI, PSI, SIGMA,
! 97: THETA, UPSILON, XI, inter (intersection), union (union), prod (product),
! 98: int (integral), sum (summation), grad (gradient), del (vector
! 99: differential), times (multiply), cdot (centre-dot), nothing (zero-width
! 100: space), approx (approximately equals), prime (prime), half (one-half),
! 101: partial (partial differential), inf (infinity), >> (much greater), <<
! 102: (much less), \-> (left arrow), <\- (right arrow), += (plus-minus), !=
! 103: (not equal), == (equivalence), <= (less-than-equal), and >=
! 104: (more-than-equal).
1.3 kristaps 105: .Pp
106: The following control statements are available:
107: .Bl -tag -width Ds
108: .It Cm define
109: Replace all occurances of a key with a value.
110: Its syntax is as follows:
111: .Pp
1.5 kristaps 112: .D1 define Ar key cvalc
113: .Pp
114: The first character of the value string,
115: .Ar c ,
116: is used as the delimiter for the value
117: .Ar val .
118: This allows for arbitrary enclosure of terms (not just quotes), such as
119: .Pp
120: .D1 define Ar foo 'bar baz'
121: .D1 define Ar foo cbar bazc
1.2 kristaps 122: .Pp
1.3 kristaps 123: It is an error to have an empty
124: .Ar key or
1.5 kristaps 125: .Ar val .
1.3 kristaps 126: Note that a quoted
127: .Ar key
128: causes errors in some
1.2 kristaps 129: .Nm
1.3 kristaps 130: implementations and should not be considered portable.
1.7 kristaps 131: It is not expanded for replacements.
1.4 kristaps 132: Definitions may refer to other definitions; these are evaluated
133: recursively when text replacement occurs and not when the definition is
134: created.
1.5 kristaps 135: .Pp
136: Definitions can create arbitrary strings, for example, the following is
137: a legal construction.
138: .Bd -literal -offset indent
139: define foo 'define'
140: foo bar 'baz'
141: .Ed
142: .Pp
1.4 kristaps 143: Self-referencing definitions will raise an error.
1.3 kristaps 144: .It Cm set
1.4 kristaps 145: Set an equation mode.
1.3 kristaps 146: Both arguments are thrown away.
1.7 kristaps 147: Its syntax is as follows:
148: .Pp
149: .D1 set Ar key val
150: .Pp
151: The
152: .Ar key
153: and
154: .Ar val
155: are not expanded for replacements.
1.3 kristaps 156: .It Cm undef
157: Unset a previously-defined key.
158: Its syntax is as follows:
159: .Pp
160: .D1 define Ar key
1.2 kristaps 161: .Pp
1.3 kristaps 162: Once invoked, the definition for
163: .Ar key
164: is discarded.
1.7 kristaps 165: The
166: .Ar key
167: is not expanded for replacements.
1.3 kristaps 168: .El
1.5 kristaps 169: .Sh COMPATIBILITY
170: This section documents the compatibility of mandoc
171: .Nm
172: and the troff
173: .Nm
174: implementation (including GNU troff).
175: .Pp
176: .Bl -dash -compact
177: .It
178: The text string
179: .Sq \e\*q
180: is interpreted as a literal quote in troff.
181: In mandoc, this is interpreted as a comment.
182: .El
1.1 kristaps 183: .Sh SEE ALSO
184: .Xr mandoc 1 ,
185: .Xr man 7 ,
186: .Xr mandoc_char 7 ,
187: .Xr mdoc 7 ,
188: .Xr roff 7
189: .Rs
190: .%A Brian W. Kernighan
191: .%A Lorinda L. Cherry
192: .%T System for Typesetting Mathematics
193: .%J Communications of the ACM
194: .%V 18
195: .%P 151\(en157
196: .%D March, 1975
197: .Re
1.5 kristaps 198: .Rs
199: .%A Brian W. Kernighan
200: .%A Lorinda L. Cherry
201: .%T Typesetting Mathematics, User's Guide
202: .%D 1976
203: .Re
204: .Rs
205: .%A Brian W. Kernighan
206: .%A Lorinda L. Cherry
207: .%T Typesetting Mathematics, User's Guide (Second Edition)
208: .%D 1978
209: .Re
210: .Sh HISTORY
1.15 kristaps 211: The eqn utility, a preprocessor for troff, was originally written by
1.5 kristaps 212: Brian W. Kernighan and Lorinda L. Cherry in 1975.
213: The GNU reimplementation of eqn, part of the GNU troff package, was
214: released in 1989 by James Clark.
215: The eqn component of
216: .Xr mandoc 1
217: was added in 2011.
1.1 kristaps 218: .Sh AUTHORS
1.5 kristaps 219: This
1.1 kristaps 220: .Nm
221: reference was written by
222: .An Kristaps Dzonsons Aq kristaps@bsd.lv .
CVSweb