LinuxCommandLibrary

neqn

Format mathematical equations for troff

SYNOPSIS

neqn [-dXY] [-Tname] [-sn] [-pn] [-ffile] [file ...]

PARAMETERS

-dXY
    Defines the characters X and Y as the default equation delimiters. Equations are usually placed between .EQ and .EN lines, but this option allows inline equations to be marked with custom characters, e.g., -d$$.

-Tname
    Specifies the output terminal type or device for which neqn should generate output. For neqn, this is commonly `nroff` to indicate character-based output.

-sn
    Adjusts the point size of equations by n points relative to the surrounding text. This option influences the relative scaling of equation components.

-pn
    Causes equation sizes to be adjusted by n points. Similar to -s, this affects the relative scaling of equation components.

-ffile
    Reads font information from the specified file. While more relevant for troff, this option is part of the shared eqn/neqn interface.

--help
    Displays a help message and exits.

--version
    Displays version information and exits.

DESCRIPTION

neqn is a preprocessor for the nroff text formatting system, designed to typeset mathematical equations for character-based output devices such as terminals and line printers.

While its counterpart, eqn, is primarily used with troff for high-resolution phototypesetting, neqn generates output suitable for display on standard alphanumeric devices. It reads text files that contain embedded equation descriptions using a simple, intuitive language.

When neqn processes a file, it translates these equation descriptions into appropriate nroff commands and macros, which then format the equations correctly within the overall document. This allows users to include complex mathematical expressions in documents like Unix manual pages without needing specialized typesetting hardware, making mathematical content accessible in plain text environments.

CAVEATS

neqn is primarily designed for character-based output, making it less suitable for high-resolution printing or PDF generation compared to eqn used with troff. Its output is optimized for readability on terminals and line printers, which may result in less visually sophisticated formatting for complex equations compared to graphical typesetting systems.

<I>EQUATION DELIMITERS</I>

By default, neqn processes text between lines containing only .EQ and .EN as equations. For example:

.EQ
a over b
.EN

This allows neqn to correctly identify and format the mathematical expressions within a larger document. The -d option allows specifying custom delimiters for inline equations.

<I>BASIC SYNTAX</I>

neqn uses a relatively simple and intuitive language for describing equations. For instance:
`a over b` produces a fraction.
`sqrt x` produces a square root of x.
`sum from i=1 to n x sub i` produces a summation.
`x sup 2` produces x squared.

The language is designed to be human-readable and relatively easy to learn for basic mathematical expressions.

HISTORY

neqn was developed as part of the original Unix text processing suite at Bell Labs. It emerged alongside eqn, nroff, and troff to provide a comprehensive system for document preparation. While eqn focused on output for phototypesetters, neqn addressed the need for equation typesetting on simpler, character-oriented devices that were common in the early days of computing. It has been maintained and evolved as part of the GNU troff (groff) project, ensuring its continued availability and functionality in modern Unix-like environments. Its core purpose remains to bridge the gap between plain text documents and formatted mathematical expressions.

SEE ALSO

eqn(1), nroff(1), troff(1), man(1)

Copied to clipboard