|
|
Line 1: |
Line 1: |
| {{For|help displaying mathematical formulae in Wikipedia|Help:Displaying a formula}}
| | Hi, everybody! <br>I'm Italian male :D. <br>I really like Fossil hunting!<br><br>My blog: [http://sz160.cc/plus/guestbook.php FIFA 15 coin Hack] |
| {{use dmy dates|date=January 2012}}
| |
| {{Infobox software
| |
| | name = TeX
| |
| | logo = [[File:TeX logo.svg|100px|The TeX logo]]
| |
| | developer = [[Donald Knuth]]
| |
| | released = {{start date and age|df=yes|1978}}
| |
| | latest_release_version = 3.14159265
| |
| | latest_release_date = {{start date and age|df=yes|2014|1}}
| |
| | latest preview version =
| |
| | latest preview date = <!-- {{Start date and age|df=yes|YYYY|MM|DD}} -->
| |
| | operating_system = [[Cross-platform]]
| |
| | genre = [[Typesetting]]
| |
| | programming_language = Originally [[WEB]]
| |
| | status = Maintained
| |
| | license = [[Permissive free software license|Permissive free software]]
| |
| | website = {{URL|tug.org}}
| |
| }}
| |
| {{Infobox file format
| |
| | name = TeX
| |
| | icon =
| |
| | logo =
| |
| | screenshot =
| |
| | caption =
| |
| | extension = .tex
| |
| | mime = application/x-tex
| |
| | type code =
| |
| | uniform type =
| |
| | magic =
| |
| | owner =
| |
| | released = {{Start date and age|1978|df=yes}}
| |
| | latest release version =
| |
| | latest release date =
| |
| | genre = [[Document file format]]
| |
| | container for =
| |
| | contained by =
| |
| | extended from =
| |
| | extended to =
| |
| | standard =
| |
| | url =
| |
| }}
| |
| | |
| '''TeX''' ({{IPAc-en|ˈ|t|ɛ|x}} {{Respell|tekh}} as in [[Modern Greek|Greek]], but often pronounced {{IPAc-en|ˈ|t|ɛ|k}} {{Respell|tek}} in [[English language|English]]) is a [[typesetting system]] designed and mostly written by [[Donald Knuth]]<ref>{{cite web |url= http://gcc.gnu.org/ml/java/1999-q2/msg00419.html |title=Per Bothner (assistant of Knuth) discusses authorship |quote= Knuth definitely wrote most of the code himself, at least for the Metafont re-write, for which I have pe[r]sonal knowledge. However, some of his students (such as Michael Plass and John Hobby) did work on the algorithms used in TeX and Metafont.}}</ref> and released in 1978. Within the typesetting system, its name is formatted as {{TeX}}.
| |
| | |
| Together with the [[Metafont]] language for font description and the [[Computer Modern]] family of [[typeface]]s, TeX was designed with two main goals in mind: to allow anybody to produce high-quality books using a reasonably minimal amount of effort, and to provide a system that would give exactly the same results on all computers, now and in the future.<ref>{{cite journal | ssrn = 908946 | title = Do Open Source Developers Respond to Competition?: The (La)TeX Case Study | first =Alexia | last = Gaudeul | date=27 March 2006}}</ref>
| |
| | |
| TeX is a popular means by which to typeset complex [[mathematical formulae]]; it has been noted as one of the most sophisticated digital typographical systems in the world.<ref>Yannis Haralambous. ''Fonts & Encodings (Translated by P. Scott Horne)''. Beijing; Sebastopol, Calif: O’Reilly Media, 2007, pp. 235.</ref> TeX is popular in [[academia]], especially in [[mathematics]], [[computer science]], [[economics]], [[engineering]], [[physics]], [[statistics]], and [[quantitative psychology]]. It has largely displaced [[Unix]] [[troff]], the other favored formatter, in many Unix installations, which use both for different purposes. It is also used for many other typesetting tasks, especially in the form of [[LaTeX]], [[ConTeXt]] and other template packages.
| |
| | |
| The widely used [[MIME type]] for TeX is <code>application/x-tex</code>. TeX is [[free software]].
| |
| | |
| ==History==
| |
| When the first volume of [[Donald Knuth]]'s ''[[The Art of Computer Programming]]'' was published in 1969, it was typeset using hot metal type set by a [[Monotype Corporation]] typecaster with a [[hot metal typesetting]] machine from the 19th century which produced a "good classic style" appreciated by Knuth. When the second edition of the second volume was published, in 1976, the whole book had to be typeset again because the Monotype technology had been largely replaced by photographic techniques, and the original fonts were no longer available.<ref>{{Citation | first = Donald Ervin | last = Knuth | title = Digital Typography | chapter = 1. Commemorative lecture for the [[Kyoto Prize]], [[Kyoto]], 1996}}.</ref> When Knuth received the [[galley proof]]s of the new book on 30 March 1977, he found them awful.<ref>''Digital Typography'', p. 5. "I had spent 15 years writing those books, but if they were going to look awful I didn't want to write any more."</ref> Around that time, Knuth saw for the first time the output of a high-quality digital typesetting system, and became interested in digital typography. The disappointing galley proofs gave him the final motivation to solve the problem at hand once and for all by designing his own typesetting system. On 13 May 1977, he wrote a memo to himself describing the basic features of TeX.<ref>{{Citation | first = Donald Ervin | last = Knuth | chapter = 24. ''[http://www.saildart.org/TEXDR.AFT[1,DEK]1 <tt>TEXDR.AFT</tt>]'' | title = Digital Typography}}.</ref>
| |
| | |
| He planned to finish it on his [[sabbatical]] in 1978, but as it happened the language was not [[Freeze (software engineering)|frozen]] until 1989, more than ten years later. [[Guy L. Steele, Jr.|Guy Steele]] happened to be at [[Stanford University|Stanford]] during the summer of 1978, when Knuth was developing his first version of TeX. When Steele returned to [[Massachusetts Institute of Technology|MIT]] that autumn, he rewrote TeX's I/O to run under the [[Incompatible Timesharing System|ITS]] operating system. The first version of TeX was written in the [[SAIL programming language]] to run on a [[PDP-10]] under Stanford's [[WAITS]] operating system. For later versions of TeX, Knuth invented the concept of [[literate programming]], a way of producing compilable [[source code]] and cross-linked documentation typeset in TeX from the same original file. The language used is called [[WEB]] and produces programs in DEC PDP-10 [[Pascal programming language|Pascal]].
| |
| | |
| A new version of TeX, rewritten from scratch and called TeX82, was published in 1982. Among other changes, the original [[hyphenation algorithm]] was replaced by a new algorithm written by [[Frank Liang]]. TeX82 also uses [[fixed-point arithmetic]] instead of [[floating-point arithmetic|floating-point]], to ensure reproducibility of the results across different computer hardware,<ref>Knuth and Plass, p. 144</ref> and includes a real, [[Turing completeness|Turing-complete]] programming language, following intense lobbying by Guy Steele.<ref>Donald E. Knuth, ''[http://maps.aanhet.net/maps/pdf/16_15.pdf Knuth meets NTG members]'', NTG: MAPS. '''16''' (1996), 38–49. Reprinted as ''Questions and Answers, III'', chapter 33 of ''Digital Typography'', p. 648.</ref>
| |
| | |
| In 1989, Donald Knuth released new versions of TeX and [[METAFONT]].<ref>Donald E. Knuth. [http://www.tug.org/TUGboat/Articles/tb10-3/tb25knut.pdf ''The New Versions of TeX and METAFONT''], TUGboat '''10''' (1989), 325–328; '''11''' (1990), 12. Reprinted as chapter 29 of ''Digital Typography''.</ref> Despite his desire to keep the program stable, Knuth realised that 128 different characters for the text input were not enough to accommodate foreign languages; the main change in version 3.0 of TeX is thus the ability to work with 8-bit inputs, allowing 256 different characters in the text input.
| |
| | |
| Since version 3, TeX has used an idiosyncratic [[Software versioning|version numbering system]], where updates have been indicated by adding an extra digit at the end of the decimal, so that the version number [[Asymptote|asymptotically]] approaches [[Pi|{{pi}}]]. This is a reflection of the fact that TeX is now very stable, and only minor updates are anticipated. The current version of TeX is 3.14159265; it was last updated in 12 January 2014.<ref>{{cite web|title=TeX 14 release|url=ftp://ftp.cs.stanford.edu/pub/tex/tex14.tar.gz|accessdate=20 January 2014}}</ref> The design was frozen after version 3.0, and no new feature or fundamental change will be added, so all newer versions will contain only [[Software bug|bug]] fixes. Even though Donald Knuth himself has suggested a few areas in which TeX could have been improved, he indicated that he firmly believes that having an unchanged system that will produce the same output now and in the future is more important than introducing new features. For this reason, he has stated that the "absolutely final change (to be made after my death)" will be to change the version number to {{pi}}, at which point all remaining bugs will become features.<ref>Donald E. Knuth. [http://www.ntg.nl/maps/05/34.pdf ''The future of TeX and METAFONT''], NTG journal MAPS (1990), 489. Reprinted as chapter 30 of ''Digital Typography'', p. 571.</ref>
| |
| Likewise, versions of METAFONT after 2.0 asymptotically approach [[E (mathematical constant)|{{math|''e''}}]], and a similar change will be applied after Knuth's death.
| |
| <!-- see TeX's bug list for reference -->
| |
| | |
| Since the source code of TeX is essentially in the [[public domain]] (see below), other programmers are allowed (and explicitly encouraged) to improve the system, but are required to use another name to distribute the modified TeX, meaning that the source code can still evolve. For example, the [[Omega (TeX)|Omega]] project was developed after 1991, primarily to enhance TeX's multilingual typesetting abilities. Donald Knuth himself created "unofficial" modified versions, such as [[TeX-XeT]], which allows a user to mix texts written in [[Bi-directional text|left-to-right and right-to-left]] [[writing system]]s in the same document.<ref name="tex-xet">Donald E. Knuth and Pierre MacKay. [http://www.tug.org/TUGboat/Articles/tb08-1/tb17knutmix.pdf ''Mixing Right-to-Left Texts with Left-to-Right Texts''], TUGboat '''8''' (1987), 14–25. Reprinted as chapter 4 of ''Digital Typography''.</ref>
| |
| | |
| ==Typesetting system==
| |
| TeX commands commonly start with a [[backslash]] and are grouped with [[Bracket|curly braces]]. Almost all of TeX's syntactic properties can be changed on the fly which makes TeX input hard to parse by anything but TeX itself. TeX is a [[Macro (computer science)|macro]] and [[token (parser)|token]]-based language: many commands, including most user-defined ones, are expanded on the fly until only unexpandable tokens remain which get executed. Expansion itself is practically side-effect free. [[Tail recursion]] of macros takes no memory, and if-then-else constructs are available. This makes TeX a [[Turing completeness|Turing-complete]] language even at the expansion level.<ref>{{Citation | first = Alan | last = Jeffrey | url = http://tug.org/TUGboat/Articles/tb11-2/tb28jeffrey.pdf | title = Lists in TeX's Mouth | journal = TUGboat | volume = 11 | number = 2 | year = 1990 | pages = 237–45}}.</ref>
| |
| | |
| The system can be divided into four levels: in the first, characters are read from the input file and assigned a category code (sometimes called "catcode", for short). Combinations of a backslash (really: any character of category zero) followed by letters (characters of category 11) or a single other character are replaced by a control sequence token. In this sense this stage is like lexical analysis, although it does not form numbers from digits. In the next stage, expandable control sequences (such as conditionals or defined macros) are replaced by their replacement text. The input for the third stage is then a stream of characters (including ones with special meaning) and unexpandable control sequences (typically assignments and visual commands). Here characters get assembled into a paragraph. TeX's paragraph breaking algorithm works by optimizing breakpoints over the whole paragraph. The fourth stage breaks the vertical list of lines and other material into pages.
| |
| | |
| The TeX system has precise knowledge of the sizes of all characters and symbols, and using this information, it computes the optimal arrangement of letters per line and lines per page. It then produces a [[DVI file format|DVI]] file ("DeVice Independent") containing the final locations of all characters. This dvi file can be printed directly given an appropriate printer driver, or it can be converted to other formats. Nowadays, [[pdfTeX|PDFTeX]] is often used which bypasses DVI generation altogether.
| |
| | |
| The base TeX system understands about 300 commands, called ''primitives''.{{Sfn|Knut|1984|p=9}} These low-level commands are rarely used directly by users, and most functionality is provided by format files (predumped memory images of TeX after large macro collections have been loaded). Knuth's original default format, which adds about 600 commands, is Plain TeX.<ref>{{citation | title = Plain {{TeX}} | type = source code | url = ftp://tug.ctan.org/pub/tex-archive/systems/knuth/dist/lib/plain.tex | publisher = CTAN}}.</ref> The most widely used format is [[LaTeX]], originally developed by [[Leslie Lamport]], which incorporates document styles for books, letters, slides, etc., and adds support for referencing and automatic numbering of sections and equations. Another widely used format, [[AMS-TeX]], is produced by the [[American Mathematical Society]], and provides many more user-friendly commands, which can be altered by journals to fit with their house style. Most of the features of AMS-TeX can be used in LaTeX by using the AMS "packages". This is then referred to as [[AMS-LaTeX]]. Other formats include [[ConTeXt]], used primarily for desktop publishing and written mostly by Hans Hagen at [[PRAGMA Advanced Document Engineering|Pragma]].
| |
| | |
| ===How TeX is run===
| |
| [[File:LaTeX sample.png|thumb|A sample page produced using TeX with the [[LaTeX]] macros]]
| |
| A sample [[Hello world program]] in plain TeX is:
| |
| <source lang=latex>
| |
| Hello, World
| |
| \bye % marks the end of the file; not shown in the final output
| |
| </source>
| |
| | |
| This might be in a file ''myfile.tex'', as ''.tex'' is a common [[file extension]] for plain TeX files.
| |
| | |
| By default, everything that follows a percent sign on a line is a comment, ignored by TeX. Running TeX on this file (for example, by typing <code>tex myfile.tex</code> in a [[command line interpreter]], or by calling it from a [[graphical user interface]]) will create an output file called ''myfile.dvi'', representing the content of the page in a '''d'''e'''v'''ice '''i'''ndependent format ([[DVI file format|DVI]]). A DVI file could then be either viewed on screen or converted to a suitable format for any of the various printers that a device driver existed for (printer support was generally not an operating system feature at the time that TeX was created).
| |
| | |
| Knuth has said that there is nothing inherent in TeX that requires DVI as the output format, and later versions of TeX, notably pdfTeX, XeTeX and LuaTeX, all support output directly to PDF.
| |
| | |
| ===Mathematical example===
| |
| {{anchor|math mode|mathematics mode|mathematical mode}}
| |
| TeX provides a different text syntax specifically for mathematical formulae. For example, the [[quadratic formula]] (which is the solution of the [[quadratic equation]]) appears as:
| |
| {{markup|
| |
| <source lang="latex" enclose="none">
| |
| The quadratic formula is $-b \pm \sqrt{b^2 - 4ac} \over 2a$
| |
| \bye
| |
| </source>
| |
| |
| |
| <math>\hbox{The quadratic formula is } \textstyle{-b \pm \sqrt{b^2 - 4ac} \over 2a}</math>
| |
| }}
| |
| | |
| The formula is printed in a way a person would write by hand, or typeset the equation. In a document, entering ''[[TeX#math mode|mathematics mode]]'' is done by starting with a $ symbol, then entering a formula in TeX syntax, and closing again with another $ symbol. Knuth explained in jest that he chose the dollar sign to indicate the beginning and end of mathematical mode in plain TeX because typesetting mathematics was traditionally supposed to be expensive.{{Sfn | Knuth | 1984 | loc = Ch. 16: Typing Math Formulas | p = 127}} ''Display mathematics'' (mathematics presented centered on a new line) is similar but uses $$ instead of a single $ symbol. For example, the above with the quadratic formula in display math:
| |
| {{markup|
| |
| <source lang="latex" enclose="none">
| |
| The quadratic formula is $$-b \pm \sqrt{b^2 - 4ac} \over 2a$$
| |
| \bye
| |
| </source>
| |
| |
| |
| <math>\hbox{The quadratic formula is}\,</math><center><math>-b \pm \sqrt{b^2 - 4ac} \over 2a</math>
| |
| }}
| |
| | |
| ==Novel aspects==
| |
| The TeX software incorporates several aspects that were not available, or were of lower quality, in other typesetting programs at the time when TeX was released. Some of the innovations are based on interesting algorithms, and have led to several theses for Knuth's students. While some of these discoveries have now been incorporated into other typesetting programs, others, such as the rules for mathematical spacing, are still unique.
| |
| | |
| ===Mathematical spacing===
| |
| [[File:AMS Euler sample math.svg|right|280px|thumb|Mathematical text typeset using TeX and the [[AMS Euler]] font]]
| |
| | |
| Since the primary goal of the TeX language is high-quality typesetting for publishers of books, [[Donald Knuth|Knuth]] gave a lot of attention to the spacing rules for mathematical formulae.<ref>{{citation|title=Portrait in Silicon|first=Robert|last=Slater|publisher=MIT Press|year=1989|isbn=9780262691314|page=349|url=http://books.google.com/books?id=aWTtMyYmKhUC&pg=PA349}}.</ref><ref>{{citation|title=Digital Typography Using LaTeX|first1=Apostolos|last1=Syropoulos|first2=Antonis|last2=Tsolomitis|first3=Nick|last3=Sofroniou|publisher=Springer|year=2003|isbn=9780387952178|page=93|url=http://books.google.com/books?id=LLYYisjrFdEC&pg=PA92}}.</ref> He took three bodies of work that he considered to be standards of excellence for mathematical typography: the books typeset by [[Addison-Wesley|Addison-Wesley Publishing]]'s house (the publisher of ''The Art of Computer Programming''), in particular the work done by Hans Wolf and [[Joseph Louis Lagrange]] (thermodynamics innovation, +1856); editions of the mathematical journal ''[[Acta Mathematica]]'' dating from around 1910; and a copy of ''[[Indagationes Mathematicae]]'', a [[Netherlands|Dutch]] mathematics journal. Knuth looked closely at these printed papers to sort out and look for a set of rules for spacing calling it TeX.<ref>Donald E. Knuth. ''Questions and Answers II'', TUGboat '''17''' (1996), p. 355–367. Reprinted as chapter 32 of ''Digital Typography'', p. 620–624.</ref> While TeX provides some basic rules and the tools needed to specify proper spacing, the exact parameters depend on the font used to typeset the formula. For example, the spacing for Knuth's [[Computer Modern]] fonts has been precisely fine-tuned over the years and is now set, but when other fonts, such as [[AMS Euler]], were used by Knuth for the first time, new spacing parameters had to be defined.<ref>Donald E. Knuth. [http://www.tug.org/TUGboat/Articles/tb10-1/tb23knut.pdf ''Typesetting Concrete Mathematics''], TUGboat '''10''' (1989), p. 31–36, p. 342. Reprinted as chapter 18 of ''Digital Typography'', p. 367–378.</ref>
| |
| | |
| ===Hyphenation and justification===
| |
| In comparison with manual typesetting, the problem of [[Justification (typesetting)|justification]] is easy to solve with a digital system such as TeX, which, provided that good points for line breaking have been defined, can automatically spread the spaces between words to fill in the line. The problem is thus to find the set of breakpoints that will give the most pleasing result. Many line breaking algorithms use a [[greedy algorithm|''first-fit'' approach]], where the breakpoints for each line are determined one after the other, and no breakpoint is changed after it has been chosen.<ref>{{Citation | first = Michael P | last = Barnett | title = Computer Typesetting: Experiments and Prospects | place = [[Cambridge, Massachusetts|Cambridge]], [[Massachusetts|MA]] | publisher = [[MIT Press]] | year = 1965}}.</ref> Such a system is not able to define a breakpoint depending on the effect that it will have on the following lines. In comparison, the ''total-fit'' line breaking algorithm used by TeX and developed by Donald Knuth and [[Michael Plass]] considers ''all'' the possible breakpoints in a paragraph, and finds the combination of line breaks that will produce the most globally pleasing arrangement.
| |
| | |
| Formally, the algorithm defines a value called ''badness'' associated with each possible line break; the badness is increased if the spaces on the line must stretch or shrink too much to make the line the correct width. Penalties are added if a breakpoint is particularly undesirable: for example, if a word must be hyphenated, if two lines in a row are hyphenated, or if a very loose line is immediately followed by a very tight line. The algorithm will then find the breakpoints that will minimize the sum of squares of the badness (including penalties) of the resulting lines. If the paragraph contains <math>n</math> possible breakpoints, the number of situations that must be evaluated naively is <math>2^n</math>. However, by using the method of [[dynamic programming]], the complexity of the algorithm can be brought down to <math>O(n^2)</math> (see [[Big O notation]]). Further simplifications (for example, not testing extremely unlikely breakpoints such as a hyphenation in the first word of a paragraph) lead to an efficient algorithm whose running time is almost always of order <math>n</math>. A similar algorithm is used to determine the best way to break paragraphs across two pages, in order to avoid [[Widow (typesetting)|widows]] or [[Orphan (typesetting)|orphans]] (lines that appear alone on a page while the rest of the paragraph is on the following or preceding page). However, in general, a thesis by [[Michael Plass]] shows how the page breaking problem can be [[NP-complete]] because of the added complication of placing figures.{{Sfn | Knuth | Plass | 1981}}
| |
| | |
| TeX's line breaking algorithm has been adopted by several other programs, such as [[Adobe InDesign]] (a [[desktop publishing]] [[Computer application|application]])<ref>{{Citation | publisher = [[Advogato]] | url = http://www.advogato.org/article/28.html | type = interview | title = Donald E. Knuth | format = PDF | journal = TUGboat | volume = 21 | year = 2000 | pages = 103–10}}.</ref> and the [[GNU]] [[fmt]] [[Unix]] [[command line]] utility.<ref>{{Citation | publisher = GNU Project | url = http://www.gnu.org/software/textutils/manual/textutils/html_node/textutils_9.html#SEC9 | title = GNU text utilities manual | chapter = 4.1 fmt: Reformat paragraph text | year = 2000}}.</ref>
| |
| | |
| If no suitable line break can be found for a line, the system will try to [[hyphen]]ate a word. The original version of TeX used a [[hyphenation algorithm]] based on a set of rules for the removal of prefixes and suffixes of words, and for deciding if it should insert a break between the two consonants in a pattern of the form [[vowel]]–[[consonant]]–[[consonant]]–[[vowel]] (which is possible most of the time).{{Sfn | Liang | 1983 | p = 3}} TeX82 introduced a new hyphenation algorithm, designed by [[Frank Liang]] in 1983, to assign priorities to breakpoints in letter groups. A list of hyphenation patterns is first generated automatically from a corpus of hyphenated words (a list of 50,000 words). If TeX must find the acceptable hyphenation positions in the word ''encyclopedia'', for example, it will consider all the subwords of the extended word ''.encyclopedia.'', where ''.'' is a special marker to indicate the beginning or end of the word. The list of subwords include all the subwords of length 1 (''.'', ''e'', ''n'', ''c'', ''y'', etc.), of length 2 (''.e'', ''en'', ''nc'', etc.), etc., up to the subword of length 14, which is the word itself, including the markers. TeX will then look into its list of hyphenation patterns, and find subwords for which it has calculated the desirability of hyphenation at each position. In the case of our word, 11 such patterns can be matched, namely <sub>1</sub>c<sub>4</sub>l<sub>4</sub>, <sub>1</sub>cy, <sub>1</sub>d<sub>4</sub>i<sub>3</sub>a, <sub>4</sub>edi, e<sub>3</sub>dia, <sub>2</sub>i<sub>1</sub>a, ope<sub>5</sub>d, <sub>2</sub>p<sub>2</sub>ed, <sub>3</sub>pedi, pedia<sub>4</sub>, y<sub>1</sub>c. For each position in the word, TeX will calculate the ''maximum value'' obtained among all matching patterns, yielding en<sub>1</sub>cy<sub>1</sub>c<sub>4</sub>l<sub>4</sub>o<sub>3</sub>p<sub>4</sub>e<sub>5</sub>d<sub>4</sub>i<sub>3</sub>a<sub>4</sub>. Finally, the acceptable positions are those indicated by an [[even and odd numbers|odd]] number, yielding the acceptable hyphenations ''en-cy-clo-pe-di-a''. This system based on subwords allows the definition of very general patterns (such as <sub>2</sub>i<sub>1</sub>a), with low indicative numbers (either odd or even), which can then be superseded by more specific patterns (such as <sub>1</sub>d<sub>4</sub>i<sub>3</sub>a) if necessary. These patterns find about 90% of the hyphens in the original dictionary; more importantly, they do not insert any spurious hyphen. In addition, a list of exceptions (words for which the patterns do not predict the correct hyphenation) are included with the Plain TeX format; additional ones can be specified by the user.{{Sfn | Liang | 1983}}{{Rp | needed = yes | date = March 2013}}<ref>{{Citation | title = The TeXbook | chapter = Appendix H: Hyphenation | pages = 449–55}}.</ref>
| |
| | |
| ===Metafont===
| |
| {{main|Metafont}}
| |
| Metafont, not strictly part of TeX, is a font description system which allows the designer to describe characters algorithmically. It uses [[Bézier curve]]s in a fairly standard way to generate the actual characters to be displayed, but Knuth devotes lots of attention to the [[font rasterization|rasterizing]] problem on [[Raster graphics|bitmap]]ped displays. Another thesis, by [[John Hobby]], further explores this problem of digitizing "brush trajectories". This term derives from the fact that Metafont describes characters as having been drawn by abstract brushes (and erasers).
| |
| | |
| It is commonly believed that TeX is based on bitmap fonts but, in fact, these programs know nothing about the fonts that they are using other than their dimensions. It is the responsibility of the device driver to appropriately handle fonts of other types, including PostScript Type 1 and TrueType. Computer Modern (commonly known as "the TeX font") is freely available in Type 1 format, as are the AMS math fonts. Users of TeX systems that output directly to PDF, such as pdfTeX, XeTeX, or LuaTeX, generally never use Metafont output at all.
| |
| | |
| ===Macro language===
| |
| TeX provides an unusual macro language; the definition of a macro not only includes a list of commands but also the syntax of the call. Macros are completely integrated with a full-scale interpreted compile-time language that also guides processing.
| |
| | |
| TeX's macro level of operation is lexical, but it is a built-in facility of TeX, that makes use of syntax interpretation. Comparing with most widely used [[preprocessor#Lexical preprocessors|lexical preprocessors]] like [[M4 (computer language)|M4]], it differs slightly, as the body of a macro gets tokenized at definition time, that is, it is not completely raw text. Except for a few very special cases, this gives the same behaviour.
| |
| | |
| The TeX macro language has been successfully used to extend TeX to, for instance, [[LaTeX]] and [[ConTeXt]].
| |
| | |
| ==Development==
| |
| The original source code for the current TeX software is written in [[WEB]], a mixture of documentation written in TeX and a [[Pascal programming language|Pascal]] subset in order to ensure portability. For example, TeX does all of its dynamic allocation itself from fixed-size arrays and uses only [[fixed-point arithmetic]] for its internal calculations. As a result, TeX has been ported to almost all [[operating system]]s, usually by using the [[web2c]] program to convert the source code into [[C (programming language)|C]] instead of directly compiling the Pascal code.
| |
| | |
| Knuth has kept a very detailed log of all the bugs he has corrected and changes he has made in the program since 1982; {{As of|2008|lc=on}}, the list contains 427 entries, not including the version modification that should be done after his death as the final change in TeX.<ref>Donald E. Knuth, [ftp://tug.ctan.org/pub/tex-archive/systems/knuth/dist/errata/tex82.bug List of updates to the TeX82 listing published in September 1982], available on [[CTAN]].</ref><ref>Donald E. Knuth, [ftp://tug.ctan.org/pub/tex-archive/systems/knuth/dist/errata/errorlog.tex Appendix to the ''Errors of TeX'' paper], available on CTAN, last modified in January 2003.</ref> Donald Knuth offers [[Knuth reward check|monetary awards]] to people who find and report a [[Computer bug|bug]] in TeX. The award per bug started at $2.56 (one "hexadecimal dollar"<ref>[http://sunburn.stanford.edu/~knuth/faq.html Frequently Asked Questions] on [http://sunburn.stanford.edu/~knuth/ Don Knuth's webpage]</ref>) and doubled every year until it was frozen at its current value of $327.68. Knuth has lost relatively little money as there have been very few bugs claimed. In addition, recipients have been known to frame their check as proof that they found a bug in TeX rather than cashing it.<ref name="stanfordmag">Kara Platoni, [http://www.stanfordalumni.org/news/magazine/2006/mayjun/features/knuth.html Love at First Byte]. Stanford Magazine, May–June 2006</ref><ref>The [http://www.tug.org/whatis.html History of TeX]</ref>
| |
| Due to scammers finding scanned copies of his checks on the internet and using them to try to drain his bank account, Knuth no longer sends out real checks, but those who submit bug reports can get credit at [[San Serriffe#National Bank|The Bank of San Serriffe]] instead.<ref>[http://sunburn.stanford.edu/~knuth/news08.html Knuth: Recent News<!-- Bot generated title -->]</ref>
| |
| | |
| ===Packages===
| |
| TeX is usually provided in the form of an easy-to-install bundle of TeX itself along with [[METAFONT]] and all the necessary fonts, documents formats, and utilities needed to use the typesetting system. On [[Unix|UNIX]]-compatible systems, including [[GNU]]/[[Linux]] and [[Apple, Inc.|Apple]] [[Mac OS X]], TeX is distributed in the form of the [[teTeX]] distribution and more recently the [[TeX Live]] distribution. On [[Microsoft Windows]], there is the [[MiKTeX]] distribution (enhanced by [[proTeXt]]) and the [[Microsoft|MS]] Windows version of TeX Live.
| |
| | |
| Several document processing systems are based on TeX, notably [[jadeTeX]], which uses TeX as a backend for printing from [[James Clark (XML expert)|James Clark]]'s [[DSSSL Engine]], the [[Arbortext]] publishing system, and [[Texinfo]], the [[GNU]] documentation processing system. TeX has been the official typesetting package for the [[GNU|GNU operating system]] since 1984.
| |
| | |
| [[XeTeX]] is a new TeX engine that supports [[Unicode]]. Originally making use of advanced Apple [[Mac OS X]]-specific font technologies, it now supports [[OpenType]] and is available on GNU/Linux and MS Windows.
| |
| | |
| Numerous extensions and companion programs for TeX exist, among them [[BibTeX]] for bibliographies (distributed with [[LaTeX]]), [[pdfTeX]], which bypasses dvi and produces output in [[Adobe Systems]]' [[Portable Document Format]], and [[Omega (TeX)|Omega]], which allows TeX to use the [[Unicode]] character set. Most TeX extensions are available for free from [[CTAN]], the Comprehensive TeX Archive Network.
| |
| | |
| ===Editors===
| |
| {{See also|Comparison of TeX editors}}
| |
| There are a variety of [[:Category:TeX editors|editors designed to work with TeX]].
| |
| | |
| The [[GNU TeXmacs|TeXmacs]] text editor is a [[WYSIWYW]] scientific text editor that is inspired by both TeX and [[Emacs]]. It uses Knuth's fonts, and can generate TeX output.
| |
| | |
| [[LyX]] is a [[WYSIWYM]] document processor which runs on a variety of platforms including GNU/Linux, MS Windows (newer versions require MS Windows 2000 or later) or Apple Mac OS X (using a non-native [[Qt (toolkit)|Qt]] front-end).
| |
| | |
| [[TeXShop]] for Apple [[Mac OS X]], [[TeXworks]] for GNU/[[Linux]], [[Mac OS X]] and [[Microsoft Windows|MS Windows]], and [[WinShell]] for [[Microsoft Windows|MS Windows]] are similar tools and provide an integrated development environment (IDE) for working with LaTeX or TeX. For [[KDE]]/[[Qt (framework)|Qt]], [[Kile]] provides such an IDE.
| |
| | |
| [[Texmaker]] is the Pure [[Qt (framework)|Qt]] equivalent of Kile, with a user interface that is nearly the same as Kile's.
| |
| | |
| [http://texstudio.sourceforge.net/ TeX Studio] is an open-source fork (2009) of Texmaker that offers a
| |
| different approach to configurability and features. Free downloadable binaries are provided for Windows, Linux, Mac OS X, OS/2, and FreeBSD.
| |
| | |
| [[GNU Emacs]] has various built-in and third party packages with support for TeX, the major one being [[AUCTeX]].
| |
| | |
| For [[Vim (text editor)|Vim]] possible plugins include Vim-LaTeX Suite,<ref>{{Citation | title = Vim‐La{{Tex}} | publisher = Source forge | url = http://vim-latex.sourceforge.net/}}.</ref> Automatic TeX<ref>{{Citation | title = Automatic {{TeX}} plugin | url = https://launchpad.net/automatictexplugin | publisher = Launch pad}}.</ref> and TeX-9.<ref>{{Citation | title = TeX-9 | url = http://www.vim.org/scripts/script.php?script_id=3508 | publisher = Vim.org}}</ref>
| |
| | |
| ===License===
| |
| Donald Knuth has indicated several times<ref>{{Citation | chapter = The future of TeX and METAFONT | page = 572 | title = Digital Typography}}.</ref><ref>{{Citation | first = Donald E | last = Knuth | format = [[PDF]] | title = Computers and Typesettings | url = http://www.tug.org/TUGboat/Articles/tb07-2/tb15gordon.pdf | journal = TUGboat | volume = 7 | year = 1986 | pages = 95–98}}.</ref><ref>{{Citation | chapter = 28 | format = PDF | title = Digital Typography | url = http://www.tug.org/TUGboat/Articles/tb07-2/tb15knut.pdf | page = 560}}.</ref> that the source code of TeX has been placed into the "public domain," and he strongly encourages modifications or experimentations with this source code. Since the code is still copyrighted, it is technically [[free software|free]]/[[open-source software]] but is not in the [[public domain]] in the legal sense.{{citation needed|date = April 2011}} In particular, since Knuth highly values the reproducibility of the output of all versions of TeX, any changed version must not be called {{TeX}}, TeX, or anything confusingly similar. To enforce this rule, any implementation of the system must pass a test suite called the TRIP test<ref>{{Citation | url = ftp://tug.ctan.org/pub/tex-archive/systems/knuth/dist/tex/trip.tex | title = CTAN | contribution = Trip | type = source code | format = {{TeX}}}}.</ref> before being allowed to be called TeX. The question of license is somewhat confused by the statements included at the beginning of the TeX source code,{{Sfn | Knuth | 1986}} which indicate that "all rights are reserved. Copying of this file is authorized only if (...) you make absolutely no changes to your copy". This restriction should be interpreted as a prohibition to change the source code ''as long as the file is called tex.web''. This interpretation is confirmed later in the source code when the TRIP test is mentioned ("If this program is changed, the resulting system should not be called '{{TeX}}'").
| |
| | |
| The [[American Mathematical Society]] tried in the early 1980s to claim a [[trademark]] for TeX. This was rejected because at the time "TEX" (all caps) was registered by [[Honeywell]] for the "Text EXecutive" text processing system.{{Citation needed|date=April 2010}}
| |
| | |
| ==Use of TeX==
| |
| In several technical fields, in particular, computer science, mathematics, engineering, and physics, TeX has become a [[de facto standard]]. Many thousands of books have been published using TeX, including books published by [[Addison-Wesley]], [[Cambridge University Press]], [[Elsevier]], [[Oxford University Press]] and [[Springer Science+Business Media|Springer]]. Numerous journals in these fields are produced using TeX or LaTeX, allowing authors to submit their raw manuscript written in TeX.{{sfn|Beebe|p=10}}
| |
| | |
| While many publications in other fields, including dictionaries and legal publications, have been produced using TeX, it has not been as successful as in more technical fields, because TeX was primarily designed for mathematics. When he designed TeX, Donald Knuth did not believe that a single typesetting system would fit everyone's needs; instead, he designed many hooks inside the program so that it would be possible to write extensions, and released the source code, hoping that publishers would design versions tailored to their needs. While such extensions have been created (including some by Knuth himself<ref name=autogenerated1>{{Citation | first1 = Donald Ervin | last1 = Knuth | first2 = Pierre | last2 = MacKay | format = [[PDF]] | url = http://www.tug.org/TUGboat/Articles/tb08-1/tb17knutmix.pdf | title = Mixing Right-to-Left Texts with Left-to-Right Texts | journal = TUGboat | volume = 8 | year = 1987 | pages = 14–25}}. Reprinted as {{Citation | chapter = 4 | title = Digital Typography}}.</ref>), most people have extended TeX only using macros and it has remained a system associated with technical typesetting.<ref>{{Citation | first = Donald Ervin | last = Knuth | title = Questions and Answers I | journal = TUGboat | volume = 17 | year = 1996 | pages = 7–22}}. Reprinted as {{Citation | chapter = 31 | title = Digital Typography | page = 598}}.</ref><ref>{{Citation | first = Donald Ervin | last = Knuth | title = Questions and Answers II | journal = TUGboat | volume = 17 | year = 1996 | pages = 355–67}}. Reprinted as {{Citation | chapter = 32 | title = Digital Typography | pages = 616–17}}.</ref>
| |
| | |
| It is possible to use TeX for automatic generation of sophisticated layout for XML data. The differences in syntax between the two description languages can be overcome with the help of [[TeXML]]. In the context of XML publication, TeX can thus be considered an alternative to [[XSL Formatting Objects|XSL-FO]].
| |
| | |
| ==Pronouncing and writing "TeX"==
| |
| The name TeX is intended by its developer to be {{IPAc-en|ˈ|t|ɛ|x}}, with the final consonant of ''loch'' or ''Bach.''<ref>Donald E. Knuth, ''The TeXbook'', Ch. 1: The Name of the Game, p. 1.</ref> The letters of the name are meant to represent the [[capital letter|capital]] [[Greek alphabet|Greek]] letters [[tau]], [[epsilon]], and [[chi (letter)|chi]], as TeX is an abbreviation of [[techne|τέχνη]] (ΤΕΧΝΗ – ''technē''), Greek for both "art" and "craft", which is also the root word of ''technical''. English speakers often pronounce it {{IPA|/ˈtɛk/}}, like the first syllable of ''technical''.
| |
| | |
| Donald Knuth instructs that it be typeset with the "E" below the baseline and reduced spacing between the letters. This is done, as Knuth mentions in his ''TeXbook'', to distinguish TeX from other system names such as TEX, the Text EXecutive processor (developed by Honeywell Information Systems).<ref>Donald E. Knuth. [http://www.tug.org/TUGboat/Articles/tb07-2/tb15knutlogo.pdf ''The TeX Logo in Various Fonts''], [[TUGboat]] '''7''' (1986), 101. Reprinted as chapter 6 of ''Digital Typography''.</ref> Fans like to proliferate names from the word "TeX" – such as ''TeXnician'' (user of TeX software), ''TeXhacker'' (TeX programmer), ''TeXmaster'' (competent TeX programmer), ''TeXhax'', and ''TeXnique''.
| |
| | |
| ==Community==
| |
| [[File:Logo TUG.svg|thumb|upright=0.4|TeX Users Group's logo]]
| |
| | |
| Notable entities in the TeX community include the TeX Users Group, which publishes [[TUGboat]] and [[The PracTeX Journal]], covering a wide range of topics in [[digital typography]] relevant to TeX. The [[Deutschsprachige Anwendervereinigung TeX]] is a large user group in Germany. The TeX Users Group was founded in 1980 for educational and scientific purposes, provides an organization for those who have an interest in typography and font design, and are users of the TeX typesetting system invented by [[Donald Knuth]]. The TeX Users Group represents the interests of TeX users worldwide. The TeX Users Group publishes the [[scientific journal|journal]] [[TUGboat]] three times per year.
| |
| | |
| [http://tex.stackexchange.com/ tex.stackexchange.com] is an active question and answer site for new (and experienced) TeX users.
| |
| | |
| ==See also==
| |
| {{div col}}
| |
| * [[List of document markup languages]]
| |
| * [[Comparison of document markup languages]]
| |
| * [[Formula editor]]
| |
| * [[PSTricks]]
| |
| * [[PGF/TikZ]]
| |
| * [[New Typesetting System]] – a TeX reimplementation (discontinued)
| |
| * [[MathTime]]
| |
| * [[xdvi]] – a program for viewing .dvi files
| |
| {{div col end}}
| |
| {{Portal bar|Free software|Mathematics|Computing}}
| |
| | |
| ==Notes==
| |
| {{reflist|colwidth =30em}}
| |
| | |
| ==References==
| |
| {{refbegin|2}}
| |
| * {{FOLDOC}}
| |
| * {{Citation | first = Nelson HF | last = Beebe | url = http://www.tug.org/TUGboat/Articles/tb25-1/beebe-2003keynote.pdf | title = 25 Years of {{TeX}} and METAFONT: Looking Back and Looking Forward | journal = TUGboat | volume = 25 | year = 2004 | pages = 7–30 | format = [[PDF]]}}.
| |
| * {{Citation | first = Donald Ervin | last = Knuth | title = The TeXbook | series = [[Computers and Typesetting]] | volume = A | place = Reading, [[Massachusetts|MA]] | publisher = Addison-Wesley | year = 1984 | ISBN = 0-201-13448-9}}. The [http://www.ctan.org/tex-archive/systems/knuth/dist/tex/texbook.tex source code of the book in TeX] (and a needed set of macros [ftp://tug.ctan.org/pub/tex-archive/systems/knuth/dist/lib/manmac.tex]) is available online on [[CTAN]]. It is provided only as an example and its use to prepare a book like The TeXbook is not allowed.
| |
| * {{Citation | first = Donald Ervin | last = Knuth | author-mask = 3 | title = TeX: The Program | series = Computers and Typesetting | volume = B | place = Reading, [[Massachusetts|MA]] | publisher = Addison-Wesley | year = 1986 | ISBN = 0-201-13437-3}}. The full source code of TeX; also [ftp://tug.ctan.org/pub/tex-archive/systems/knuth/dist/tex/tex.web available] on [[CTAN]]. Being written using [[literate programming]], it contains plenty of human-readable documentation.
| |
| * {{Citation | first = Donald Ervin | last = Knuth | author-mask = 3 | title = Digital Typography | series = Lecture notes | number = 78 | publisher = Center for the Study of Language and Information | year = 1999 | ISBN = 1-57586-010-4}}.
| |
| * {{Citation | first1 = Donald Ervin | last1 = Knuth | author-mask = 3 | first2 = Michael F | last2 = Plass | title = Breaking Paragraphs Into Lines | journal = Software — Practice and Experience | volume = 11 | year = 1981 | pages = 1119–84}}. Reprinted as {{Citation | chapter = 3 | title = Digital Typography | pages = 67–155}}.
| |
| * {{Citation | first = Donald Ervin | last = Knuth | author-mask = 3 | url = http://www.tex.ac.uk/ctan/systems/knuth/dist/tex/ | title = TeX | type = source code | format = [[WEB]]}} contains extensive documentation about the algorithms used in TeX.
| |
| * {{Citation | first = Leslie | last = Lamport | author-link = Leslie Lamport | title = [[LaTeX]]: A Document Preparation System | place = Reading, [[Massachusetts|MA]] | publisher = Addison-Wesley | edition = 2nd | year = 1994 | ISBN = 0-201-52983-1}}.
| |
| * {{Citation | first = Franklin Mark | last = Liang | url = http://www.tug.org/docs/liang/ | title = Word Hy-phen-a-tion by Com-put-er | type = [[PhD]] thesis | publisher = Department of Computer Science, [[Stanford University]] |date=August 1983}}.
| |
| * {{Citation | first = David | last = Salomon | title = The Advanced TeXbook | publisher = Springer | year = 1995 | ISBN = 0-387-94556-3}}.
| |
| * {{Citation | first = MD | last = Spivak | title = The Joy of TeX | edition = 2nd | publisher = American Mathematical Society | year = 1990 | ISBN = 0-8218-2997-1 | type = reference}} on AMS-TeX.
| |
| * {{Citation | first = Michael | last = Vulis | url = http://books.google.com/books?id=UfUdto-Sz9QC&printsec=frontcover | title = Modern TeX and Its Applications | publisher = CRC Press | year = 1992 | ISBN = 0-8493-4431-X}}.
| |
| {{Refend}}
| |
| | |
| ==External links==
| |
| {{Sisterlinks|b=TeX|commons=TeX}}
| |
| * {{Citation | url = http://www.tug.org/texlive//devsrc/Master/texmf-dist/doc/generic/knuth/tex/tex.pdf | title = TeX82 | type = documentation | first = Donald Ervin | last = Knuth | format = [[PDF]] | year = 1982 | publisher = Tug}}.
| |
| * {{Citation | url = http://infohost.nmt.edu/tcc/help/pubs/texcrib.pdf | title = Plain TeX Quick Reference | format = PDF | publisher = NMT}}.
| |
| * {{Citation | url = http://tex.stackexchange.com/ | title = TeX | type = questions and answers | publisher = StackExchange}}.
| |
| * {{Citation | url = http://www.tug.org/ | title = TeX Users' Group}}.
| |
| * {{Citation | url = http://uk.tug.org/ | place = UK | title = TeX Users' Group}}
| |
| * {{Citation | url = http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes | place = UK | publisher = List of TeX | title = FAQ}}
| |
| * {{Citation | first = Simon | last = Eveson | url = http://www-users.york.ac.uk/~spe1/texnotes07.pdf | title = An Introduction to Mathematical Document Production Using AmSLaTeX | publisher = York | place = [[England|ENG]], [[United Kingdom|UK]] | format = [[PDF]]}}.
| |
| * {{Citation | url = http://purl.umn.edu/107413 | title = Oral history | type = interview | first = Donald E | last = Knuth | publisher = [[Charles Babbage Institute]], University of Minnesota | place = Minneapolis}}. Knuth discusses software patenting, [[structured programming]], collaboration and his development of TeX. The oral history discusses the writing of ''[[The Art of Computer Programming]]''.
| |
| * {{official website|tug.org}}
| |
| * Eijkhout, Victor. [http://www.eijkhout.net/tbt/ ''TeX by Topic'']
| |
| * [ftp://ftp.gwdg.de/pub/dante/info/impatient/book.pdf ''TeX for the Impatient'']
| |
| * Walsh, Norman. [http://makingtexwork.sourceforge.net/mtw/ ''Making TeX Work'']
| |
| * [http://books.google.at/books?hl=en&id=lowdvusVjTwC&dq=tex&printsec=frontcover&source=web&ots=qX1xgHdwnh&sig=8CARQDtcNjo9rMBXyn3IpRRDgcU&sa=X&oi=book_result&resnum=8&ct=result TeX Reference Manual] via Google Book Search
| |
| * [http://www.webofstories.com/play/17110?o=MS Knuth tells the story of TeX's creation] link to the first clip in the series.
| |
| * [http://scpd.stanford.edu/knuth/ Knuth lectures on TeX ] – Filmed in the 1980s, Stanford university.
| |
| * [http://river-valley.tv/tug-2010/an-earthshaking-announcement Knuth declares TeX obsolete, unveils successor] at TUG 2010
| |
| | |
| {{TeX navbox}}
| |
| {{TeX editors}}
| |
| {{Free and open source typography}}
| |
| {{Donald Knuth navbox}}
| |
| | |
| {{DEFAULTSORT:Tex}}
| |
| [[Category:Desktop publishing software]]
| |
| [[Category:Digital typography]]
| |
| [[Category:Free TeX software]]
| |
| [[Category:Macro programming languages]]
| |
| [[Category:Typesetting]]
| |
| [[Category:TeX| ]]
| |
| [[Category:Donald Knuth]]
| |
| [[Category:Typesetting software]]
| |
| [[Category:1978 software]]
| |