LinuxCommandLibrary

eqn2graph

Convert equations written in EQN to graphs

SYNOPSIS

eqn2graph [files…]

PARAMETERS

files
    Input files containing eqn; defaults to stdin. Outputs pic to stdout.

DESCRIPTION

eqn2graph is a groff utility that translates mathematical equations in EQN markup language into pic picture language commands. This enables embedding equations as graphical elements within pic diagrams in troff-formatted documents.

It processes input containing mixed text and eqn constructs, converting eqn elements like fractions (&frac{a}{b}), integrals (&int), sums (&sum), square roots (&sqrt{}), superscripts/subscripts, and matrices into pic primitives such as boxes, lines, circles, and positioning commands.

Usage fits into a groff preprocessing pipeline: pipe eqn-enhanced text through eqn2graph to generate pic code, then process with pic, tbl, eqn (for remaining math), and groff or troff for final output (e.g., PostScript, PDF).

Ideal for technical documents needing math integrated into figures, like scientific papers or manuals. Limitations include support only for eqn features mappable to 2D graphics; advanced typesetting like stacked equations may lose fidelity.

CAVEATS

Supports subset of eqn constructs graphical in pic; complex layouts (e.g., piled, over/under) may simplify or fail. No options for customization.

EXAMPLE

echo 'S: circle at 1i right of B
frac {1}{x + sqrt {x^2 + 1}} with .l at S.l' | eqn2graph

Outputs pic code drawing the fraction as boxes/lines.

PIPELINE

Use as: eqn input.roff | eqn2graph | pic | groff -Tps > output.ps

HISTORY

Part of GNU groff (GNU roff) since early 1990s, extending AT&T Unix troff tools. Created to bridge eqn and pic preprocessors, absent in original Unix.

SEE ALSO

eqn(7), pic(1), groff(1), grap(1)

Copied to clipboard