Content-type: text/html
neqn, checkeq - Typesets mathematical equations and expressions
neqn [-dxy] [-pn] [-sn] [-fn] [file...] |nroff...
checkeq [file...]
The neqn command is an nroff(1) preprocessor for displaying mathematical symbols and equations on terminals. Usage almost always involves preprocessing an nroff source file with neqn and then piping the output through nroff.
The neqn command formatting works best on typesetting devices. Your terminal might not be equipped to display equations and other math symbols in a meaningful way. In fact, you might have difficulty viewing the symbols and examples included in this reference page.
If no files are specified, neqn reads from the standard input. A line beginning with .EQ marks the start of an equation; .EN at the beginning of a line marks the end of an equation. Neither of these lines is altered, so they can be defined in macro packages to produce centering, numbering, and so on.
It is also possible to set two characters as delimiters; subsequent text between delimiters is also treated as input to neqn. Delimiters may be set to any two characters, such as x and y, with the command-line argument -dxy or more commonly by placing delim xy between .EQ and .EN. The left and right delimiters can be identical. Delimiters are turned off by delim off. All text that is neither between delimiters nor between .EQ and .EN is passed through untouched.
The program checkeq reports missing or unbalanced delimiters and .EQ/.EN pairs.
Tokens within neqn are separated by spaces, tabs, newlines, braces, double quotation marks, tildes, or circumflexes. Braces { } are used for grouping. Generally speaking, anywhere a single character could appear, a complicated construction enclosed in braces can be used instead. The tilde (~) represents a full space in the output; the circumflex (^) half as much.
Subscripts and superscripts are produced with the keywords sub and sup.
Fractions use the keyword over.
The sqrt keyword creates square roots.
The keywords from and to are used to express lower and upper limits.
Left and right brackets, braces, and so forth that encompass more than one line are created with the left and right keywords and tildes. Legal characters to use with left and right are {, }, [, ], |, c (ceiling), f (floor), and , meaning `nothing' (to use with the left keyword when you want brackets or braces on the right side only). The right keyword clause is optional.
Vertical piles of things are made with pile, lpile, rpile, and cpile. There can be an arbitrary number of elements in a pile. You use lpile to left-justify a vertical grouping and rpile to right-justify one. The pile and cpile keywords create centered piles but have different vertical spacing.
You use the matrix keyword to create matrixes. The lcol, ccol, and col keywords are used with matrix to specify the alignment within the matrix; that is a left-justified column, centered column, and right-justified column, respectively.
Diacritical marks are made with the following keywords:
dot |
Produces a period (.) over the character
preceding the keyword.
|
dotdot |
Produces two periods (..) over the character
preceding the keyword.
|
hat |
Produces a circumflex (^) over the character
preceding the keyword.
|
tilde |
Produces a tilde (~) over the character preceding
the keyword.
|
bar |
Produces a horizontal bar over the character
preceding the keyword.
|
vec |
Produces a left-pointing arrow over the character
preceding the keyword.
|
dyad |
Produces a bidirectional arrow over the character
preceding the keyword.
|
under |
Produces an underscore under the character
preceding the keyword.
|
Size and font changes are made with the following keywords:
size n | Specifies the size as n points. |
size+n | Increases the size n points. |
size-n | Decreases the size n points. |
roman | Uses roman type font. |
italic | Uses italic type font. |
bold | Uses bold type font. |
font n | Uses the specified type font. |
Size and font can be changed globally in a document by using the gsize n and the gfont n keyword expressions or by the command-line arguments -s n and -f n.
Normally subscripts and superscripts are reduced by three point sizes from the previous size. You can change this default with the -p n command-line argument.
To aline successive display arguments, place the mark keyword before the desired lineup point in the first equation. Then place the lineup keyword at the place that is to line up vertically in subsequent equation lines.
New keywords or new forms of existing keywords can be defined with the define keyword. For example, the following define expression defines the new keyword cc to be C Language:
define cc % C Language %
Whenever cc appears in the source file, processing with neqn causes C Language to appear in the preprocessed or output file. Note that the delimiting character surrounding the replacement string can be any character as long as it does not appear in the replacement string itself.
The following keywords are also recognized for typeset output:
sum | Produces a large Greek sigma indicating summation. |
int | Produces an integration sign. |
inf | Produces an infinity sign. |
>= | Produces a greater-than-or-equals sign. |
<= | Produces a less-than-or-equals sign. |
-> | Produces a right pointing arrow. |
<- | Produces a left pointing arrow. |
!= | Produces a not equal sign. |
Greek letters are spelled out in the desired case, for example,
alpha
or
GAMMA. Mathematical words
like sin, cos, log are output in roman type automatically. Strings enclosed
in double quotation marks ("...") are passed through untouched; this
feature permits keywords to be entered as text.
To embolden digits, parentheses, and so on, you must enclose them in quotation marks after the keyword bold. For example:
bold "12.3".
Input and output for x with subscript i:
x 1
i
y 2
2