Annotation of mandoc/eqn.7, Revision 1.10
1.10 ! kristaps 1: .\" $Id: eqn.7,v 1.9 2011/07/21 13:18:24 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.6 kristaps 17: .Dd $Mdocdate: July 21 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
62: The equation grammar is as follows:
63: .Bd -literal -offset indent
64: eqn : box | eqn box
65: box : text
1.9 kristaps 66: | { eqn }
1.3 kristaps 67: | DEFINE text text
68: | SET text text
69: | UNDEF text
1.9 kristaps 70: | box mark
1.10 ! kristaps 71: | font box
1.3 kristaps 72: text : TEXT
1.9 kristaps 73: mark : DOT
74: | DOTDOT
75: | HAT
76: | TILDE
77: | VEC
78: | DYAD
79: | BAR
80: | UNDER
1.10 ! kristaps 81: font : ROMAN
! 82: | ITALIC
! 83: | BOLD
1.3 kristaps 84: .Ed
85: .Pp
86: Data in TEXT form is a non-empty sequence of non-space characters or a
87: non-empty quoted string.
1.5 kristaps 88: Unless within a quoted string, white-space (and enclosing literal quote
89: pairs) is thrown away.
1.6 kristaps 90: Quoted strings are not scanned for replacement definitions.
1.3 kristaps 91: .Pp
92: The following control statements are available:
93: .Bl -tag -width Ds
94: .It Cm define
95: Replace all occurances of a key with a value.
96: Its syntax is as follows:
97: .Pp
1.5 kristaps 98: .D1 define Ar key cvalc
99: .Pp
100: The first character of the value string,
101: .Ar c ,
102: is used as the delimiter for the value
103: .Ar val .
104: This allows for arbitrary enclosure of terms (not just quotes), such as
105: .Pp
106: .D1 define Ar foo 'bar baz'
107: .D1 define Ar foo cbar bazc
1.2 kristaps 108: .Pp
1.3 kristaps 109: It is an error to have an empty
110: .Ar key or
1.5 kristaps 111: .Ar val .
1.3 kristaps 112: Note that a quoted
113: .Ar key
114: causes errors in some
1.2 kristaps 115: .Nm
1.3 kristaps 116: implementations and should not be considered portable.
1.7 kristaps 117: It is not expanded for replacements.
1.4 kristaps 118: Definitions may refer to other definitions; these are evaluated
119: recursively when text replacement occurs and not when the definition is
120: created.
1.5 kristaps 121: .Pp
122: Definitions can create arbitrary strings, for example, the following is
123: a legal construction.
124: .Bd -literal -offset indent
125: define foo 'define'
126: foo bar 'baz'
127: .Ed
128: .Pp
1.4 kristaps 129: Self-referencing definitions will raise an error.
1.3 kristaps 130: .It Cm set
1.4 kristaps 131: Set an equation mode.
1.3 kristaps 132: Both arguments are thrown away.
1.7 kristaps 133: Its syntax is as follows:
134: .Pp
135: .D1 set Ar key val
136: .Pp
137: The
138: .Ar key
139: and
140: .Ar val
141: are not expanded for replacements.
1.3 kristaps 142: .It Cm undef
143: Unset a previously-defined key.
144: Its syntax is as follows:
145: .Pp
146: .D1 define Ar key
1.2 kristaps 147: .Pp
1.3 kristaps 148: Once invoked, the definition for
149: .Ar key
150: is discarded.
1.7 kristaps 151: The
152: .Ar key
153: is not expanded for replacements.
1.3 kristaps 154: .El
1.5 kristaps 155: .Sh COMPATIBILITY
156: This section documents the compatibility of mandoc
157: .Nm
158: and the troff
159: .Nm
160: implementation (including GNU troff).
161: .Pp
162: .Bl -dash -compact
163: .It
164: The text string
165: .Sq \e\*q
166: is interpreted as a literal quote in troff.
167: In mandoc, this is interpreted as a comment.
168: .El
1.1 kristaps 169: .Sh SEE ALSO
170: .Xr mandoc 1 ,
171: .Xr man 7 ,
172: .Xr mandoc_char 7 ,
173: .Xr mdoc 7 ,
174: .Xr roff 7
175: .Rs
176: .%A Brian W. Kernighan
177: .%A Lorinda L. Cherry
178: .%T System for Typesetting Mathematics
179: .%J Communications of the ACM
180: .%V 18
181: .%P 151\(en157
182: .%D March, 1975
183: .Re
1.5 kristaps 184: .Rs
185: .%A Brian W. Kernighan
186: .%A Lorinda L. Cherry
187: .%T Typesetting Mathematics, User's Guide
188: .%D 1976
189: .Re
190: .Rs
191: .%A Brian W. Kernighan
192: .%A Lorinda L. Cherry
193: .%T Typesetting Mathematics, User's Guide (Second Edition)
194: .%D 1978
195: .Re
196: .Sh HISTORY
197: The eqn utility, a preprocessor for troff, was originally written by
198: Brian W. Kernighan and Lorinda L. Cherry in 1975.
199: The GNU reimplementation of eqn, part of the GNU troff package, was
200: released in 1989 by James Clark.
201: The eqn component of
202: .Xr mandoc 1
203: was added in 2011.
1.1 kristaps 204: .Sh AUTHORS
1.5 kristaps 205: This
1.1 kristaps 206: .Nm
207: reference was written by
208: .An Kristaps Dzonsons Aq kristaps@bsd.lv .
CVSweb