[BACK]Return to eqn.7 CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/eqn.7, Revision 1.9

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

CVSweb