Template:Short description Template:Lowercase title {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other 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.<ref name="Kernighan_Brailsford" />

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 context-free grammar, together with operator precedence and operator associativity rules.<ref name="Kernighan_Cherry_1975" /> The eqn language is similar to the mathematical component of TeX, which appeared several years later, but is simpler and less complete.

An independent compatible implementation of the eqn preprocessor has been developed by GNU as part of groff, the GNU version of troff. The GNU implementation extends the original language by adding a number of new keywords such as smallover and accent. mandoc, a specialised compiler for UNIX man pages, also contains a standalone eqn parser/formatter.

HistoryEdit

Eqn was written using the yacc parser generator.<ref name="Kernighan_Brailsford" />

Syntax examplesEdit

Here is how some examples would be written in eqn<ref name="Kernighan_Cherry_1978" /> (with equivalents in TeX for comparison):

TeX eqn formula
<syntaxhighlight lang="latex" class="" style="" inline="1">a^2</syntaxhighlight> a sup 2 <math>a^2</math>
<syntaxhighlight lang="latex" class="" style="" inline="1">\sum_{k = 1}^N k^2</syntaxhighlight> sum from { k = 1 } to N { k sup 2 } <math>\sum_{k=1}^N k^2</math>
<syntaxhighlight lang="latex" inline>x = {-b \pm \sqrt{b^2 - 4ac} \over 2a}</syntaxhighlight> x = {-b +- sqrt{b sup 2 - 4ac}} over 2a <math>x= {-b \pm \sqrt{b^2 - 4ac} \over 2a}</math>

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 <math display="inline">f(pi r^{2)}</math>, whereas f( pi r sup 2 ) is needed to give the intended <math display="inline">f(\pi r^2)</math>.

ReferencesEdit

Template:Reflist

External linksEdit

Template:Plan 9 commands


Template:Unix-stub