Print this page
9718 update mandoc to 1.14.4
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man5/eqn.5.man.txt
+++ new/usr/src/man/man5/eqn.5.man.txt
1 1 EQN(5) Standards, Environments, and Macros EQN(5)
2 2
3 3 NAME
4 4 eqn - eqn language reference for mandoc
5 5
6 6 DESCRIPTION
7 7 The eqn language is an equation-formatting language. It is used within
8 8 mdoc(5) and man(5) UNIX manual pages. It describes the structure of an
9 9 equation, not its mathematical meaning. This manual describes the eqn
10 10 language accepted by the mandoc(1) utility, which corresponds to the
11 11 Second Edition eqn specification (see SEE ALSO for references).
12 12
13 13 Equations within mdoc(5) or man(5) documents are enclosed by the
14 14 standalone `.EQ' and `.EN' tags. Equations are multi-line blocks
15 15 consisting of formulas and control statements.
16 16
17 17 EQUATION STRUCTURE
18 18 Each equation is bracketed by `.EQ' and `.EN' strings. Note: these are
19 19 not the same as mandoc_roff(5) macros, and may only be invoked as `.EQ'.
20 20
21 21 The equation grammar is as follows, where quoted strings are case-
22 22 sensitive literals in the input:
23 23
24 24 eqn : box | eqn box
25 25 box : text
26 26 | "{" eqn "}"
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
27 27 | "define" text text
28 28 | "ndefine" text text
29 29 | "tdefine" text text
30 30 | "gfont" text
31 31 | "gsize" text
32 32 | "set" text text
33 33 | "undef" text
34 34 | "sqrt" box
35 35 | box pos box
36 36 | box mark
37 - | "matrix" "{" [col "{" list "}" ]*
37 + | "matrix" "{" [col "{" list "}"]* "}"
38 38 | pile "{" list "}"
39 39 | font box
40 40 | "size" text box
41 41 | "left" text eqn ["right" text]
42 42 col : "lcol" | "rcol" | "ccol" | "col"
43 43 text : [^space\"]+ | \".*\"
44 44 pile : "lpile" | "cpile" | "rpile" | "pile"
45 45 pos : "over" | "sup" | "sub" | "to" | "from"
46 46 mark : "dot" | "dotdot" | "hat" | "tilde" | "vec"
47 47 | "dyad" | "bar" | "under"
48 48 font : "roman" | "italic" | "bold" | "fat"
49 49 list : eqn
50 50 | list "above" eqn
51 51 space : [\^~ \t]
52 52
53 53 White-space consists of the space, tab, circumflex, and tilde characters.
54 54 It is required to delimit tokens consisting of alphabetic characters and
55 55 it is ignored at other places. Braces and quotes also delimit tokens.
56 56 If within a quoted string, these space characters are retained. Quoted
57 57 strings are also not scanned for keywords, glyph names, and expansion of
58 58 definitions. To print a literal quote character, it can be prepended
59 59 with a backslash or expressed with the \(dq escape sequence.
60 60
61 61 Subequations can be enclosed in braces to pass them as arguments to
62 62 operation keywords, overriding standard operation precedence. Braces can
63 63 be nested. To set a brace verbatim, it needs to be enclosed in quotes.
64 64
65 65 The following text terms are translated into a rendered glyph, if
66 66 available: alpha, beta, chi, delta, epsilon, eta, gamma, iota, kappa,
67 67 lambda, mu, nu, omega, omicron, phi, pi, psi, rho, sigma, tau, theta,
68 68 upsilon, xi, zeta, DELTA, GAMMA, LAMBDA, OMEGA, PHI, PI, PSI, SIGMA,
69 69 THETA, UPSILON, XI, inter (intersection), union (union), prod (product),
70 70 int (integral), sum (summation), grad (gradient), del (vector
71 71 differential), times (multiply), cdot (center-dot), nothing (zero-width
72 72 space), approx (approximately equals), prime (prime), half (one-half),
73 73 partial (partial differential), inf (infinity), >> (much greater), <<
74 74 (much less), <- (left arrow), -> (right arrow), +- (plus-minus), != (not
75 75 equal), == (equivalence), <= (less-than-equal), and >= (more-than-equal).
76 76 The character escape sequences documented in mandoc_char(5) can be used,
77 77 too.
78 78
79 79 The following control statements are available:
80 80
81 81 define Replace all occurrences of a key with a value. Its syntax is as
82 82 follows:
83 83
84 84 define key cvalc
85 85
86 86 The first character of the value string, c, is used as the
87 87 delimiter for the value val. This allows for arbitrary enclosure
88 88 of terms (not just quotes), such as
89 89
90 90 define foo 'bar baz'
91 91 define foo cbar bazc
92 92
93 93 It is an error to have an empty key or val. Note that a quoted
94 94 key causes errors in some eqn implementations and should not be
95 95 considered portable. It is not expanded for replacements.
96 96 Definitions may refer to other definitions; these are evaluated
97 97 recursively when text replacement occurs and not when the
98 98 definition is created.
99 99
100 100 Definitions can create arbitrary strings, for example, the
101 101 following is a legal construction.
102 102
103 103 define foo 'define'
104 104 foo bar 'baz'
105 105
106 106 Self-referencing definitions will raise an error. The ndefine
107 107 statement is a synonym for define, while tdefine is discarded.
108 108
109 109 gfont Set the default font of subsequent output. Its syntax is as
110 110 follows:
111 111
112 112 gfont font
113 113
114 114 In mandoc, this value is discarded.
115 115
116 116 gsize Set the default size of subsequent output. Its syntax is as
117 117 follows:
118 118
119 119 gsize [+|-]size
120 120
121 121 The size value should be an integer. If prepended by a sign, the
122 122 font size is changed relative to the current size.
123 123
124 124 set Set an equation mode. In mandoc, both arguments are thrown away.
125 125 Its syntax is as follows:
126 126
127 127 set key val
128 128
129 129 The key and val are not expanded for replacements. This
130 130 statement is a GNU extension.
131 131
132 132 undef Unset a previously-defined key. Its syntax is as follows:
133 133
134 134 define key
135 135
136 136 Once invoked, the definition for key is discarded. The key is
137 137 not expanded for replacements. This statement is a GNU
138 138 extension.
139 139
140 140 Operation keywords have the following semantics:
141 141
142 142 above See pile.
143 143
144 144 bar Draw a line over the preceding box.
145 145
146 146 bold Set the following box using bold font.
147 147
148 148 ccol Like cpile, but for use in matrix.
149 149
150 150 cpile Like pile, but with slightly increased vertical spacing.
151 151
152 152 dot Set a single dot over the preceding box.
153 153
154 154 dotdot Set two dots (dieresis) over the preceding box.
155 155
156 156 dyad Set a dyad symbol (left-right arrow) over the preceding box.
157 157
158 158 fat A synonym for bold.
159 159
160 160 font Set the second argument using the font specified by the first
161 161 argument; currently not recognized by the mandoc(1) eqn parser.
162 162
163 163 from Set the following box below the preceding box, using a slightly
164 164 smaller font. Used for sums, integrals, limits, and the like.
165 165
166 166 hat Set a hat (circumflex) over the preceding box.
167 167
168 168 italic Set the following box using italic font.
169 169
170 170 lcol Like lpile, but for use in matrix.
171 171
172 172 left Set the first argument as a big left delimiter before the second
173 173 argument. As an optional third argument, right can follow. In
174 174 that case, the fourth argument is set as a big right delimiter
175 175 after the second argument.
176 176
177 177 lpile Like cpile, but subequations are left-justified.
178 178
179 179 matrix Followed by a list of columns enclosed in braces. All columns
180 180 need to have the same number of subequations. The columns are
181 181 set as a matrix. The difference compared to multiple subsequent
182 182 pile operators is that in a matrix, corresponding subequations in
183 183 all columns line up horizontally, while each pile does vertical
184 184 spacing independently.
185 185
186 186 over Set a fraction. The preceding box is the numerator, the
187 187 following box is the denominator.
188 188
189 189 pile Followed by a list of subequations enclosed in braces, the
190 190 subequations being separated by above keywords. Sets the
191 191 subequations one above the other, each of them centered.
192 192 Typically used to represent vectors in coordinate representation.
193 193
194 194 rcol Like rpile, but for use in matrix.
195 195
196 196 right See left; right cannot be used without left. To set a big right
197 197 delimiter without a big left delimiter, the following
198 198 construction can be used:
199 199
200 200 left "" box right delimiter
201 201
202 202 roman Set the following box using the default font.
203 203
204 204 rpile Like cpile, but subequations are right-justified.
205 205
206 206 size Set the second argument with the font size specified by the first
207 207 argument; currently ignored by mandoc(1). By prepending a plus
208 208 or minus sign to the first argument, the font size can be
209 209 selected relative to the current size.
210 210
211 211 sqrt Set the square root of the following box.
212 212
213 213 sub Set the following box as a subscript to the preceding box.
214 214
215 215 sup Set the following box as a superscript to the preceding box. As
216 216 a special case, if a sup clause immediately follows a sub clause
217 217 as in
218 218
219 219 mainbox sub subbox sup supbox
220 220
221 221 both are set with respect to the same mainbox, that is, supbox is
222 222 set above subbox.
223 223
224 224 tilde Set a tilde over the preceding box.
225 225
226 226 to Set the following box above the preceding box, using a slightly
227 227 smaller font. Used for sums and integrals and the like. As a
228 228 special case, if a to clause immediately follows a from clause as
229 229 in
230 230
231 231 mainbox from frombox to tobox
232 232
233 233 both are set below and above the same mainbox.
234 234
235 235 under Underline the preceding box.
236 236
237 237 vec Set a vector symbol (right arrow) over the preceding box.
238 238
239 239 The binary operations from, to, sub, and sup group to the right, that is,
240 240
241 241 mainbox sup supbox sub subbox
242 242
243 243 is the same as
244 244
245 245 mainbox sup {supbox sub subbox}
246 246
247 247 and different from
248 248
249 249 {mainbox sup supbox} sub subbox.
250 250
251 251 By contrast, over groups to the left.
252 252
253 253 In the following list, earlier operations bind more tightly than later
254 254 operations:
255 255
256 256 1. dyad, vec, under, bar, tilde, hat, dot, dotdot
257 257 2. fat, roman, italic, bold, size
258 258 3. sub, sup
259 259 4. sqrt
260 260 5. over
261 261 6. from, to
262 262
263 263 COMPATIBILITY
264 264 This section documents the compatibility of mandoc eqn and the troff eqn
265 265 implementation (including GNU troff).
266 266
267 267 - The text string `\"' is interpreted as a literal quote in troff. In
268 268 mandoc, this is interpreted as a comment.
269 269 - In troff, The circumflex and tilde white-space symbols map to fixed-
270 270 width spaces. In mandoc, these characters are synonyms for the space
271 271 character.
272 272 - The troff implementation of eqn allows for equation alignment with
273 273 the mark and lineup tokens. mandoc discards these tokens. The back
274 274 n, fwd n, up n, and down n commands are also ignored.
275 275
276 276 SEE ALSO
277 277 mandoc(1), man(5), mandoc_char(5), mandoc_roff(5), mdoc(5)
278 278
279 279 Brian W. Kernighan and Lorinda L. Cherry, "System for Typesetting
280 280 Mathematics", Communications of the ACM, 18, 151-157, March, 1975.
281 281
282 282 Brian W. Kernighan and Lorinda L. Cherry, Typesetting Mathematics, User's
283 283 Guide, 1976.
284 284
285 285 Brian W. Kernighan and Lorinda L. Cherry, Typesetting Mathematics, User's
286 286 Guide (Second Edition), 1978.
↓ open down ↓ |
239 lines elided |
↑ open up ↑ |
287 287
288 288 HISTORY
289 289 The eqn utility, a preprocessor for troff, was originally written by
290 290 Brian W. Kernighan and Lorinda L. Cherry in 1975. The GNU
291 291 reimplementation of eqn, part of the GNU troff package, was released in
292 292 1989 by James Clark. The eqn component of mandoc(1) was added in 2011.
293 293
294 294 AUTHORS
295 295 This eqn reference was written by Kristaps Dzonsons <kristaps@bsd.lv>.
296 296
297 -illumos July 20, 2017 illumos
297 +illumos September 4, 2017 illumos
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX