eqn Command

Purpose

Formats mathematical text for the troff command.

Syntax

eqn [ -d Delimiter1Delimiter2 ] [ -f Font ] [ -p Number ] [ -s Size ] [ -T Name ] [ ] [ File ... | - ]

Description

The eqn command is a troff preprocessor for typesetting mathematical text on a phototypesetter or comparable device. The output of the eqn command is generally piped into the troff command, as follows:

eqn [Flag...] File... | troff [Flag...] | [Typesetter]

The eqn command reads files specified by the File parameter. It reads standard input when a - (minus sign) is specified as the last parameter. A line beginning with the .EQ macro marks the start of equation text. The end of equation text is marked by a line beginning with the .EN macro. These lines are not altered by the troff command, so they can be defined in macro packages to provide additional formatting function such as centering and numbering.

Keywords

The following are keywords known to both the eqn and neqn commands.

above      dot       gsize      over       tdefine
back       dotdot    hat        pile       tilde
bar        down      italic     rcol       to
bold       dyad      lcol       right      under
ceiling    fat       left       roman      up
ccol       floor     lineup     rpile      vec
col        font      lpile      size  
cpile      from      mark       sqrt  
define     fwd       matrix     sub
delim      gfont     ndefine    sup

Keywords recognized by the eqn command can be set apart with spaces, tabs, new lines, braces, double quotes, tildes, and circumflexes. Use { } (braces) for groupings; anywhere you can use a single character, such as X, you can substitute a complicated construction enclosed in braces. The ~ (tilde) represents a full space in the output, and the ^ (circumflex) represents a half-space.

Produce subscripts and superscripts using the sub and sup keywords. Produce fractions with the overkeyword. Produce square roots with the sqrt keyword.

Introduce lower and upper limits using the from and to keywords. Produce delimiters (such as left and right brackets and braces) of the correct height using the left and right keywords. Legal characters after the left and right keywords are braces, brackets, bars, c and f for ceiling and floor, and “ ” (double quotes) for nothing at all (which is useful for a right-side-only bracket). A left character does not need a matching right character, but a right character must have a matching left character.

Vertical lists (piles) of things are made with the pile, lpile, cpile, and rpile keywords. Piles can have arbitrary numbers of elements. The lpile keyword left-justifies, the pile and cpile keywords center (but with different vertical spacing), and the rpile keyword right-justifies. Matrices are made with the matrix keyword. In addition, there is an rcol keyword for a right-justified column.

Diacritical marks are made with the dot, dotdot, hat, tilde, bar, vec, dyad, and under keywords.

You can change point sizes and fonts with the size Number (or size +/-Number), roman, italic, bold, and font Number keywords. You can change point sizes and fonts globally in a document with the gsize Number and gfont Number keywords, or with the command-line -sNumber and -fNumber flags.

Normally, subscripts and superscripts are reduced by three points from the previous size. You can change this with the command-line -pNumber flag.

You can line up successive display parameters. Place the mark keyword before the desired lineup point in the first equation; place the lineup keyword where it is to line up vertically in subsequent equations.

You can define shorthands or redefine existing keywords with the define keyword; for example:

define  Thing%Replacement%

The preceding example defines a new token called Thing that is replaced by Replacement whenever it appears thereafter. The % (percent sign) can be any character that does not occur in Replacement.

Keywords such as sum, int, inf, and shorthands such as >=, !=, and -> are recognized. Greek letters are spelled out in the desired case, as in alpha or GAMMA. Mathematical words such as sin, cos, and log are made Roman automatically. The troff command 4-character escapes, such as \(dd, which produces the double dagger, can be used anywhere. Strings enclosed in “ ” (double quotes) are passed through untouched. This permits keywords to be entered as text, and can always be used to communicate with the troff command.

Flags

Item Description
-dDelimiter1Delimiter2 Sets two ASCII characters, Delimiter1 and Delimiter2, as delimiters of the text to be processed by the eqn command, in addition to the input enclosed by the .EQ and .EN macros. The text between these delimiters is treated as input to the eqn command.
Note: Within a file, you can also set delimiters for eqn text using the delim Delimiter1Delimiter2command. They are turned off by the delim off command. All text not between .EQ and .EN macros is passed through unprocessed.
-fFont Changes font in all the eqn command processed text to the value specified by the Font variable. The Font value (a font name or position) must be one or two ASCII characters.
-pNumber Reduces subscripts and superscripts the specified number of points in size (the default is 3).
-sSize Changes point size in all the eqn command processed text to the value specified by the Size variable.
-TName Prepares the output for the specified printing device. Terminal Names for Phototypesetter or Comparable Devices provides Name variables. The default is ibm3816.
- Forces input to be read from standard input.
(double dash) Indicates the end of flags.

Files

Item Description
/usr/share/lib/pub/eqnchar Contains special character definitions.