eqn (software)
Cross-platform | |
---|---|
Type | Command |
License | Plan 9: MIT License |
Part of the troff suite of Unix document layout tools, eqn is a preprocessor that formats equations for printing. A similar program, neqn, accepted the same input as eqn, but produced output tuned to look better in nroff. The eqn program was created in 1974 by Brian Kernighan and Lorinda Cherry. It was implemented using yacc compiler-compiler.[1]
The input language used by eqn allows the user to write mathematical expressions in much the same way as they would be spoken aloud. The language is defined by a
An independent compatible implementation of the eqn preprocessor has been developed by
History
Eqn was written using the yacc parser generator.[1]
Syntax examples
Here is how some examples would be written in eqn[3] (with equivalents in TeX for comparison):
TeX | eqn | formula |
---|---|---|
a^2
|
a sup 2
|
|
\sum_{k = 1}^N k^2
|
sum from { k = 1 } to N { k sup 2 }
|
|
x = {-b \pm \sqrt{b^2 - 4ac} \over 2a}
|
x = {-b +- sqrt{b sup 2 - 4ac}} over 2a
|
Spaces are important in eqn; tokens are delimited only by whitespace characters, tildes ~, braces {} and double-quotes "". Thus f(pi r sup 2)
results in , whereas f( pi r sup 2 )
is needed to give the intended .
References
- ^ a b c "UNIX Special: Profs Kernighan & Brailsford". Computerphile. September 30, 2015. Archived from the original on 2021-12-22.
- S2CID 155801.
- ^ Kernighan, Brian W.; Cherry, Lorinda (1978), Typesetting Mathematics — User’s Guide (PDF) (2nd ed.)
External links
- Typesetting Mathematics, User's Guide (Second Edition)
- UNIX man page for neqn(1) at the Wayback Machine (archived August 8, 2007)
- Plan 9 Programmer's Manual, Volume 1 –