man > eqn(1)

๐Ÿ“› NAME

eqn - format equations for troff or MathML

๐Ÿš€ Quick Reference

Use CaseCommandDescription
Process equations in a troff fileeqn file.trCompile embedded equations for troff output.
Use custom delimiterseqn -d '$$' file.trSet inline equation delimiters to $$.
Output MathMLeqn -T MathML file.trGenerate Presentation MathML markup.
Only one size reductioneqn -r file.trReduce point size only once.
Skip initialization fileeqn -R file.trDon't load eqnrc.
Set minimum point sizeeqn -m 12 file.trMinimum point size of 12 points.
Search directory for eqnrceqn -M /path file.trLook for eqnrc in /path first.
No newlines in delimiterseqn -N file.trBetter error recovery from missing delimiters.

๐Ÿ“‹ SYNOPSIS

eqn [-rvCNR] [-d xy] [-T name] [-M dir] [-f F] [-s n] [-p n] [-m n] [file ...]

๐Ÿ“ DESCRIPTION

This manual page describes the GNU version of eqn, which is part of the groff document formatting system. eqn compiles descriptions of equations embedded within troff input files into commands that are understood by troff. Normally, it should be invoked using the -e option of groff. The syntax is quite compatible with Unix eqn. The output of GNU eqn cannot be processed with Unix troff; it must be processed with GNU troff. If no files are given on the command line, the standard input is read. A filename of - causes the standard input to be read.

eqn searches for the file eqnrc in the directories given with the -M option first, then in /usr/lib/groff/site-tmac, /usr/share/groff/site-tmac, and finally in the standard macro directory /usr/share/groff/1.22.4/tmac. If it exists, eqn processes it before the other input files. The -R option prevents this.

GNU eqn does not provide the functionality of neqn: it does not support low-resolution, typewriter-like devices (although it may work adequately for very simple input).

โš™๏ธ OPTIONS

Whitespace is permitted between a command-line option and its argument.

๐Ÿ”ค -d xy

Specify delimiters x and y for the left and right end, respectively, of in-line equations. Any delim statements in the source file overrides this.

๐Ÿ” -C

Recognize .EQ and .EN even when followed by a character other than space or newline. Also, the statement โ€˜delim onโ€™ is not handled specially.

๐Ÿšซ -N

Don't allow newlines within delimiters. This option allows eqn to recover better from missing closing delimiters.

๐Ÿ“Ÿ -v

Print the version number.

๐Ÿ”ฝ -r

Only one size reduction.

๐Ÿ“ -m n

The minimum point-size is n. eqn does not reduce the size of subscripts or superscripts to a smaller size than n.

๐Ÿ–ฅ๏ธ -T name

The output is for device name. Normally, the only effect of this is to define a macro name with a value of 1; eqnrc uses this to provide definitions appropriate for the output device. However, if the specified device is โ€œMathMLโ€, the output is MathML markup rather than troff commands, and eqnrc is not loaded at all. The default output device is ps.

๐Ÿ“ -M dir

Search dir for eqnrc before the default directories.

๐Ÿšซ -R

Don't load eqnrc.

๐Ÿ”ค -f F

This is equivalent to a gfont F command.

๐Ÿ“ -s n

This is equivalent to a gsize n command. This option is deprecated. eqn normally sets equations at whatever the current point size is when the equation is encountered.

๐Ÿ“ -p n

This says that subscripts and superscripts should be n points smaller than the surrounding text. This option is deprecated. Normally eqn sets subscripts and superscripts at 70% of the size of the surrounding text.

๐Ÿ“š USAGE

Only the differences between GNU eqn and Unix eqn are described here.

GNU eqn emits Presentation MathML output when invoked with the -T MathML option.

GNU eqn sets the input token "..." as three periods or low dots, rather than the three centered dots of classic eqn. To get three centered dots, write cdots or cdot cdot cdot.

Most of the new features of the GNU eqn input language are based on TeX. There are some references to the differences between TeX and GNU eqn below; these may safely be ignored if you do not know TeX.

๐ŸŽ›๏ธ Controlling Delimiters

If not in compatibility mode, eqn recognizes

delim on

to restore the delimiters which have been previously disabled with a call to โ€˜delim offโ€™. If delimiters haven't been specified, the call has no effect.

๐Ÿ“ Automatic Spacing

eqn gives each component of an equation a type, and adjusts the spacing between components using that type. Possible types are described in the table below.

Components of an equation get a type in one of two ways.

type t e

This yields an equation component that contains e but that has type t, where t is one of the types mentioned above. For example, times is defined as

type "binary" \(mu

The name of the type doesn't have to be quoted, but quoting protects from macro expansion.

chartype t text

Unquoted groups of characters are split up into individual characters, and the type of each character is looked up; this changes the type that is stored for each character; it says that the characters in text from now on have type t. For example,

chartype "punctuation" .,;:

would make the characters โ€˜.,;:โ€™ have type punctuation whenever they subsequently appeared in an equation. The type t can also be letter or digit; in these cases chartype changes the font type of the characters. See subsection โ€œFontsโ€ below.

๐Ÿ†• New Primitives

big e

Enlarges the expression it modifies; intended to have semantics like CSS โ€˜largeโ€™. In troff output, the point size is increased by 5; in MathML output, the expression uses

<mstyle mathsize='big'>
e1 smallover e2

This is similar to over; smallover reduces the size of e1 and e2; it also puts less vertical space between e1 or e2 and the fraction bar. The over primitive corresponds to the TeX \over primitive in display styles; smallover corresponds to \over in non-display styles.

vcenter e

This vertically centers e about the math axis. The math axis is the vertical position about which characters such as โ€˜+โ€™ and โ€˜โˆ’โ€™ are centered; also it is the vertical position used for the bar of fractions. For example, sum is defined as

{ type "operator" vcenter size +5 \(*S }

(Note that vcenter is silently ignored when generating MathML.)

e1 accent e2

This sets e2 as an accent over e1. e2 is assumed to be at the correct height for a lowercase letter; e2 is moved down according to whether e1 is taller or shorter than a lowercase letter. For example, hat is defined as

accent { "^" }

dotdot, dot, tilde, vec, and dyad are also defined using the accent primitive.

e1 uaccent e2

This sets e2 as an accent under e1. e2 is assumed to be at the correct height for a character without a descender; e2 is moved down if e1 has a descender. utilde is predefined using uaccent as a tilde accent below the baseline.

split "text"

This has the same effect as simply

text

but text is not subject to macro expansion because it is quoted; text is split up and the spacing between individual characters is adjusted.

nosplit text

This has the same effect as

"text"

but because text is not quoted it is subject to macro expansion; text is not split up and the spacing between individual characters is not adjusted.

e opprime

This is a variant of prime that acts as an operator on e. It produces a different result from prime in a case such as A opprime sub 1: with opprime the 1 is tucked under the prime as a subscript to the A (as is conventional in mathematical typesetting), whereas with prime the 1 is a subscript to the prime character. The precedence of opprime is the same as that of bar and under, which is higher than that of everything except accent and uaccent. In unquoted text a ' that is not the first character is treated like opprime.

special text e

This constructs a new object from e using a troff(1) macro named text. When the macro is called, the string 0s contains the output for e, and the number registers 0w, 0h, 0d, 0skern, and 0skew contain the width, height, depth, subscript kern, and skew of e. (The subscript kern of an object says how much a subscript on that object should be tucked in; the skew of an object says how far to the right of the center of the object an accent over the object should be placed.) The macro must modify 0s so that it outputs the desired result with its origin at the current point, and increase the current horizontal position by the width of the object. The number registers must also be modified so that they correspond to the result.

For example, suppose you wanted a construct that โ€˜cancelsโ€™ an expression by drawing a diagonal line through it.

.EQ
define cancel 'special Ca'
.EN
.de Ca
.  ds 0s \
\Z'\\*(0s'\
\v'\\n(0du'\
\D'l \\n(0wu -\\n(0hu-\\n(0du'\
\v'\\n(0hu'
..

Then you could cancel an expression e with cancel { e }

Here's a more complicated construct that draws a box round an expression:

.EQ
define box 'special Bx'
.EN
.de Bx
.  ds 0s \
\Z'\h'1n'\\*(0s'\
\Z'\
\v'\\n(0du+1n'\
\D'l \\n(0wu+2n 0'\
\D'l 0 -\\n(0hu-\\n(0du-2n'\
\D'l -\\n(0wu-2n 0'\
\D'l 0 \\n(0hu+\\n(0du+2n'\
'\
\h'\\n(0wu+2n'
.  nr 0w +2n
.  nr 0d +1n
.  nr 0h +1n
..
space n

A positive value of the integer n (in hundredths of an em) sets the vertical spacing before the equation, a negative value sets the spacing after the equation, replacing the default values. This primitive provides an interface to groff's \x escape (but with opposite sign).

This keyword has no effect if the equation is part of a pic picture.

๐Ÿ”€ Extended Primitives

col n { ... }
ccol n { ... }
lcol n { ... }
rcol n { ... }
pile n { ... }
cpile n { ... }
lpile n { ... }
rpile n { ... }

The integer value n (in hundredths of an em) increases the vertical spacing between rows, using groff's \x escape (the value has no effect in MathML mode). Negative values are possible but have no effect. If there is more than a single value given in a matrix, the biggest one is used.

๐ŸŽจ Customization

When eqn is generating troff markup, the appearance of equations is controlled by a large number of parameters. They have no effect when generating MathML mode, which pushes typesetting and fine motions downstream to a MathML rendering engine. These parameters can be set using the set command.

set p n

This sets parameter p to value n; n is an integer. For example,

set x_height 45

says that eqn should assume an x height of 0.45 ems.

Possible parameters are as follows. Values are in units of hundredths of an em unless otherwise stated. These descriptions are intended to be expository rather than definitive.

A more precise description of the role of many of these parameters can be found in Appendix H of The TeXbook.

๐Ÿ“ฆ Macros

Macros can take arguments. In a macro body, $n where n is between 1 and 9, is replaced by the nth argument if the macro is called with arguments; if there are fewer than n arguments, it is replaced by nothing. A word containing a left parenthesis where the part of the word before the left parenthesis has been defined using the define command is recognized as a macro call with arguments; characters following the left parenthesis up to a matching right parenthesis are treated as comma-separated arguments; commas inside nested parentheses do not terminate an argument.

sdefine name X anything X

This is like the define command, but name is not recognized if called with arguments.

include "file"
copy "file"

Include the contents of file (include and copy are synonyms). Lines of file beginning with .EQ or .EN are ignored.

ifdef name X anything X

If name has been defined by define (or has been automatically defined because name is the output device) process anything; otherwise ignore anything. X can be any character not appearing in anything.

undef name

Remove definition of name, making it undefined.

Besides the macros mentioned above, the following definitions are available: Alpha, Beta, ..., Omega (this is the same as ALPHA, BETA, ..., OMEGA), ldots (three dots on the base line), and dollar.

๐Ÿ”ค Fonts

eqn normally uses at least two fonts to set an equation: an italic font for letters, and a roman font for everything else. The existing gfont command changes the font that is used as the italic font. By default this is I. The font that is used as the roman font can be changed using the new grfont command.

grfont f

Set the roman font to f.

The italic primitive uses the current italic font set by gfont; the roman primitive uses the current roman font set by grfont. There is also a new gbfont command, which changes the font used by the bold primitive. If you only use the roman, italic and bold primitives to changes fonts within an equation, you can change all the fonts used by your equations just by using gfont, grfont and gbfont commands.

You can control which characters are treated as letters (and therefore set in italics) by using the chartype command described above. A type of letter causes a character to be set in italic type. A type of digit causes a character to be set in roman type.

๐Ÿ“ FILES

/usr/share/groff/1.22.4/tmac/eqnrc โ€” Initialization file.

๐Ÿงฎ MATHML MODE LIMITATIONS

MathML is designed on the assumption that it cannot know the exact physical characteristics of the media and devices on which it will be rendered. It does not support fine control of motions and sizes to the same degree troff does. Thus:

As in its troff mode, eqn in MathML mode leaves the .EQ and .EN delimiters in place for displayed equations, but emits no explicit delimiters around inline equations. They can, however, be recognized as strings that begin with <math> and end with </math> and do not cross line boundaries.

See section โ€œBugsโ€ below for translation limits specific to eqn.

๐Ÿ› BUGS

Inline equations are set at the point size that is current at the beginning of the input line.

In MathML mode, the mark and lineup features don't work. These could, in theory, be implemented with <maligngroup> elements.

In MathML mode, each digit of a numeric literal gets a separate <mn></mn> pair, and decimal points are tagged with <mo></mo>. This is allowed by the specification, but inefficient.

๐Ÿ“š SEE ALSO

groff(1), troff(1), pic(1), groff_font(5), The TeXbook

eqn(1)
๐Ÿ“› NAME ๐Ÿš€ Quick Reference ๐Ÿ“‹ SYNOPSIS ๐Ÿ“ DESCRIPTION โš™๏ธ OPTIONS
๐Ÿ”ค -d xy ๐Ÿ” -C ๐Ÿšซ -N ๐Ÿ“Ÿ -v ๐Ÿ”ฝ -r ๐Ÿ“ -m n ๐Ÿ–ฅ๏ธ -T name ๐Ÿ“ -M dir ๐Ÿšซ -R ๐Ÿ”ค -f F ๐Ÿ“ -s n ๐Ÿ“ -p n
๐Ÿ“š USAGE
๐ŸŽ›๏ธ Controlling Delimiters ๐Ÿ“ Automatic Spacing ๐Ÿ†• New Primitives ๐Ÿ”€ Extended Primitives ๐ŸŽจ Customization ๐Ÿ“ฆ Macros ๐Ÿ”ค Fonts
๐Ÿ“ FILES ๐Ÿงฎ MATHML MODE LIMITATIONS ๐Ÿ› BUGS ๐Ÿ“š SEE ALSO

Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 17:39 @2600:1f28:365:80b0:f8a4:e764:d6bb:8e66
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^