NAME
eqn — eqn language reference for mandocDESCRIPTION
The eqn language is an equation-formatting language. It is used within mdoc(7) and man(7) UNIX manual pages. It describes the structure of an equation, not its mathematical meaning. This manual describes the eqn language accepted by the mandoc(1) utility, which corresponds to the Second Edition eqn specification (see SEE ALSO for references).EQUATION STRUCTURE
Each equation is bracketed by ‘.EQ’ and ‘.EN’ strings. Note: these are not the same as roff(7) macros, and may only be invoked as ‘.EQ’.eqn : box | eqn box box : text | "{" eqn "}" | "define" text text | "ndefine" text text | "tdefine" text text | "gfont" text | "gsize" text | "set" text text | "undef" text | "sqrt" box | box pos box | box mark | "matrix" "{" [col "{" list "}" ]* | pile "{" list "}" | font box | "size" text box | "left" text eqn ["right" text] col : "lcol" | "rcol" | "ccol" | "col" text : [^space\"]+ | \".*\" pile : "lpile" | "cpile" | "rpile" | "pile" pos : "over" | "sup" | "sub" | "to" | "from" mark : "dot" | "dotdot" | "hat" | "tilde" | "vec" | "dyad" | "bar" | "under" font : "roman" | "italic" | "bold" | "fat" list : eqn | list "above" eqn space : [\^~ \t]
- define
-
Replace all occurrences of a key with a value. Its syntax is as follows:define key cvalcdefine foo 'bar baz'define foo cbar bazc
define foo 'define' foo bar 'baz'
- gfont
-
Set the default font of subsequent output. Its syntax is as follows:gfont font
- gsize
-
Set the default size of subsequent output. Its syntax is as follows:gsize [+|-]size
- set
-
Set an equation mode. In mandoc, both arguments are thrown away. Its syntax is as follows:set key val
- undef
-
Unset a previously-defined key. Its syntax is as follows:define key
- above
- See pile.
- bar
- Draw a line over the preceding box.
- bold
- Set the following box using bold font.
- ccol
- Like cpile, but for use in matrix.
- cpile
- Like pile, but with slightly increased vertical spacing.
- dot
- Set a single dot over the preceding box.
- dotdot
- Set two dots (dieresis) over the preceding box.
- dyad
- Set a dyad symbol (left-right arrow) over the preceding box.
- fat
- A synonym for bold.
- font
- Set the second argument using the font specified by the first argument; currently not recognized by the mandoc(1) eqn parser.
- from
- Set the following box below the preceding box, using a slightly smaller font. Used for sums, integrals, limits, and the like.
- hat
- Set a hat (circumflex) over the preceding box.
- italic
- Set the following box using italic font.
- lcol
- Like lpile, but for use in matrix.
- left
- Set the first argument as a big left delimiter before the second argument. As an optional third argument, right can follow. In that case, the fourth argument is set as a big right delimiter after the second argument.
- lpile
- Like cpile, but subequations are left-justified.
- matrix
- Followed by a list of columns enclosed in braces. All columns need to have the same number of subequations. The columns are set as a matrix. The difference compared to multiple subsequent pile operators is that in a matrix, corresponding subequations in all columns line up horizontally, while each pile does vertical spacing independently.
- over
- Set a fraction. The preceding box is the numerator, the following box is the denominator.
- pile
- Followed by a list of subequations enclosed in braces, the subequations being separated by above keywords. Sets the subequations one above the other, each of them centered. Typically used to represent vectors in coordinate representation.
- rcol
- Like rpile, but for use in matrix.
- right
-
See left; right cannot be used without left. To set a big right delimiter without a big left delimiter, the following construction can be used:left
""
box right delimiter - roman
- Set the following box using the default font.
- rpile
- Like cpile, but subequations are right-justified.
- size
- Set the second argument with the font size specified by the first argument; currently ignored by mandoc(1). By prepending a plus or minus sign to the first argument, the font size can be selected relative to the current size.
- sqrt
- Set the square root of the following box.
- sub
- Set the following box as a subscript to the preceding box.
- sup
-
Set the following box as a superscript to the preceding box. As a special case, if a sup clause immediately follows a sub clause as inmainbox sub subbox sup supbox
- tilde
- Set a tilde over the preceding box.
- to
-
Set the following box above the preceding box, using a slightly smaller font. Used for sums and integrals and the like. As a special case, if a to clause immediately follows a from clause as inmainbox from frombox to tobox
- under
- Underline the preceding box.
- vec
- Set a vector symbol (right arrow) over the preceding box.
mainbox sup supbox sub subbox
mainbox sup {supbox sub subbox}
{mainbox sup supbox} sub subbox.
- dyad, vec, under, bar, tilde, hat, dot, dotdot
- fat, roman, italic, bold, size
- sub, sup
- sqrt
- over
- from, to
COMPATIBILITY
This section documents the compatibility of mandoc eqn and the troff eqn implementation (including GNU troff).- The text string ‘\"’ is interpreted as a literal quote in troff. In mandoc, this is interpreted as a comment.
- In troff, The circumflex and tilde white-space symbols map to fixed-width spaces. In mandoc, these characters are synonyms for the space character.
- The troff implementation of eqn allows for equation alignment with the mark and lineup tokens. mandoc discards these tokens. The back n, fwd n, up n, and down n commands are also ignored.