Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Eqn (software)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Preprocessor that formats equations for drawing}} {{lowercase title}} {{Infobox software | name = eqn | logo = | screenshot = | screenshot size = | caption = | author = [[Brian Kernighan]],<br />[[Lorinda Cherry]]<br />([[AT&T Bell Laboratories]]) | developer = Various [[open-source software|open-source]] and [[commercial software|commercial]] developers | released = {{Start date and age|1974|6}} | latest release version = | latest release date = | programming language = [[C (programming language)|C]], [[Yacc]]<ref name="Kernighan_Brailsford" /> | operating system = [[Unix]], [[Unix-like]], [[Plan 9 from Bell Labs|Plan 9]] | platform = [[Cross-platform]] | genre = [[Command (computing)|Command]] | license = Plan 9: [[MIT License]] | website = }} 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 (software)|groff]], the GNU version of troff. The GNU implementation extends the original language by adding a number of new [[keyword (computer programming)|keywords]] such as ''smallover'' and ''accent''. [[mandoc]], a specialised compiler for UNIX [[man pages]], also contains a standalone eqn parser/formatter. == History == Eqn was written using the [[yacc]] parser generator.<ref name="Kernighan_Brailsford" /> == Syntax examples == Here is how some examples would be written in eqn<ref name="Kernighan_Cherry_1978" /> (with equivalents in TeX for comparison): {| class="wikitable" |- !TeX !eqn !formula |- |{{code|lang=latex|a^2}} |<code>a sup 2</code> |<math>a^2</math> |- |{{code|lang=latex|1=\sum_{k = 1}^N k^2}} |<code>sum from { k = 1 } to N { k sup 2 }</code> |<math>\sum_{k=1}^N k^2</math> |- |<syntaxhighlight lang="latex" inline>x = {-b \pm \sqrt{b^2 - 4ac} \over 2a}</syntaxhighlight> |<code>x = {-b +- sqrt{b sup 2 - 4ac}} over 2a</code> |<math>x= {-b \pm \sqrt{b^2 - 4ac} \over 2a}</math> |} Spaces are important in eqn; [[lexical analysis#Token|tokens]] are delimited only by [[whitespace character]]s, tildes ~, braces {} and double-quotes "". Thus <code>f(pi r sup 2)</code> results in <math display="inline">f(pi r^{2)}</math>, whereas <code>f( pi r sup 2 )</code> is needed to give the intended <math display="inline">f(\pi r^2)</math>. ==References== {{Reflist|refs= <ref name="Kernighan_Cherry_1975">{{cite journal|year=1975|title=A System for Typesetting Mathematics|journal=[[Communications of the ACM]]|volume=18|issue=3|pages=151β157 |first1=Brian W. |last1=Kernighan |first2=Lorinda L. |last2=Cherry| author-link = Brian Kernighan| author2-link = Lorinda Cherry |doi=10.1145/360680.360684|s2cid=155801|doi-access=free}}</ref> <ref name="Kernighan_Cherry_1978">{{Citation | last = Kernighan | first = Brian W. | last2 = Cherry | first2 = Lorinda | author-link = Brian Kernighan | author2-link = Lorinda Cherry | year = 1978 | title = Typesetting Mathematics β Userβs Guide | edition = 2nd | url = https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=699ba8cbd336af184c02165bb766832f385880ab | format = PDF }}</ref> <ref name="Kernighan_Brailsford">{{cite web|url=https://www.youtube.com/watch?v=vT_J6xc-Az0 |archive-url=https://ghostarchive.org/varchive/youtube/20211222/vT_J6xc-Az0 |archive-date=2021-12-22 |url-status=live|title=UNIX Special: Profs Kernighan & Brailsford |work=Computerphile |date=September 30, 2015 }}{{cbignore}}</ref> }} == External links == *[http://www.kohala.com/start/troff/v7man/eqn/eqn2e.ps Typesetting Mathematics, User's Guide (Second Edition)] *{{webarchive |url=https://web.archive.org/web/20070808042840/http://www.uwm.edu/cgi-bin/IMT/wwwman?topic=neqn(1)&msection= |date=August 8, 2007 |title=UNIX man page for neqn(1) }} * {{man|1|eqn|Plan 9}} {{Plan 9 commands}} [[Category:Troff|eqn]] [[Category:Plan 9 commands]] {{Unix-stub}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Code
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase title
(
edit
)
Template:Main other
(
edit
)
Template:Man
(
edit
)
Template:Plan 9 commands
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Template other
(
edit
)
Template:Unix-stub
(
edit
)
Template:Webarchive
(
edit
)