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

Annotation of mandoc/eqn.7, Revision 1.12

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

CVSweb