Home >> Computers >> Software >> Typesetting >> TeX >> Plain TeX


  Macros
       


TEX, written when TeX around plainly text, occurs as typesetting system created by Donald Knuth. These are popular inside academia, especially in the mathematics, physics and computer science communities. It has largely displaced Unix troff, the more favorite formatter, around several Unix installations.

TeX is typically considered to exist as a better way to typeset complex mathematical system, however, especially in the form of LaTeX and more templet packages, is today too existence utilized for numerous other typesetting tasks.

The name and its pronunciation(s)
The court to Caltech, where Knuth received his doctor's degree, a title TeX is meant to become pronounced "tekh", in which "kh" is a healthy at a prevent of Scottish loch or the title of the German composer Bach (in IPA ). A X is intended to represent a Greek letter χ (chi). TeX is the abbreviation of τέχνη (technē), Greek for "art" & "craft", which is besides a source word of technical indicator. English speakers typically pronounce it "tek", such as a 1st syllable of technology.

A title is properly typeset by owning a "E" beneath a baseline; systems that don't trend lines inferior layout have a approximation "TeX". Fans prefer to proliferate list from either a word "TeX" — like TeXnician (user of TeX software package), TeXpert, TeXhacker (TeX software engineer), TeXmaster (competent TeX software engineer), TeXhax, & TeXnique.

History
Knuth began to write TeX because he got be annoyed at a declining quality of the typesetting inside volumes I personally–Trio of his monumental The Art of Computer Programming. Around the manifestation of the average hackish urge to solve the condition at hand conclusively, he began to project his have typesetting language. He thought he would finish it inside his sabbatical leave in 1978, but a language was non frozen until 1989, more than tenner years late.

Guy Steele happened to be at Stanford in a period of the summertime of 1978, when Knuth was getting his number 1 version of TeX. Whilst Steele returned to MIT that fall, he rewrote TeX's I/O to run under ITS.

A 1st version of TeX was written in the SAIL programming language to run in the PDP-10 under Stanford's WAITS operating system. For late versions of TeX, Knuth invented a construct of literate programming, a way of producing compilable source code and high quality cross-linked documentation (typeset in TeX course) from either a equivalent original file. A language utilized is known as WEB and produces software around Pascal.

TeX has an idiosyncratic version numbering system. Since version Deuce-ace, updates use at times been indicated by adding an additional digit at a prevent of a decimal, then that the version total asymptotically approaches π. A todays version is Deuce-ace.141592. This occurs as reflection of the fact that TeX is currently super stable, & sole minor updates come anticipated. Knuth has stated that a "absolutely final change (to be made after my death)" is to vary a version total to π, at which point completely remaining bugs might be features.

The typesetting system
TeX commands unremarkably run using the backslash and are grouped using curly braces. whole the same, most all of TeX's syntactical properties may be changed on the fly which makes TeX input difficult to parse by anything however TeX itself. TeX occurs as macro and token based language: many commands, including virtually all user-defined ones, come expanded on the fly until sole unexpandable tokens remain which become executed. Expansion itself is practically side-burden loose. Tail recursion of macros requires there is no memory, & in case-so-else constructs come available. This makes TeX the Turing-complete language even at expansion level.

the patterns potty about become divided within quaternion levels: in the number one characters come underst& from either file and assigned a category code. Combinations of the backslash (really: any character of category zero) followed by letters (characters of category Xi) or even one more character come replaced by the control sequence token. In that feel this stage is such as lexical analysis, although it doesn't form prices from either digits. In the next stage, expandable control sequences (like conditionals or even defined macro instruction) come replaced by their replacement text. A input for the third stage is so water of characters, including ones sustaining favorite meaning, & unexpandable control sequences, generally assignments & ocular commands. On text characters acquire assembled into the paragraph. TeX's paragraph breaking algorithmic program works by optimizing breakpoints on top a completely paragraph. Fallowing a paragraph is broken into lines, a vertical listing of lines & more lesson is broken into web sites.

A TeX body has exact noesis of a sizes of completely characters & symbols, & utilizing this site, it computes the optimum arrangement of letters by the line & lines by the page. It so produces the DVI file (for "device independent") containing the final locations of a lot characters. This dvi file may be printed directly given an appropriate printer driver, or even it may be converted to more formats. Today, PDFTeX is often utilized which bypasses DVI generation altogether.

Virtually all functionality is provided by format files (predumped memory images of TeX fallowing big macro collections keep around been loaded). Most common formats come Knuth's original basic plain TeX, LaTeX (ubiquitous in the technical indicator sciences), & ConTeXt (which is used primarily for Desktop Publishing).

A ultimate book of facts for TeX come a number 1 both volumes of Knuth's Computers and Typesetting, The TeXbook & TeX: A Program (which includes a complete documented source code for TeX).

TeX is unremarkably distributed together by using Metafont, a companion program besides developed by Knuth which allows algorithmic description of fonts. the organisation of the directories inside the TeX / Metafont installation is standardized inside a tree known as texmf.

License
A license allows loose distribution & modification, however demands that any changed versions must non become known as TEX, TeX, or even anything bewilderingly similar. A American Mathematical Society has registered a trademark for TEX. a line 2 text suite known as the TRIP test has been made to help touching whether an implementation is really the TEX.

Quality
TeX is written within WEB, the mixture of documentation written around TeX & a quite restricted Pascal subset. For instance, TeX does everthing of its dynamic allocation itself from either fixed-size arrays. Following, TeX has been ported to nigh tons operating systems (usually by using the web2c convertor).

Knuth offers monetary awards to people world health organization call for & report the bug in it. A award by the bug began at $2.56 & two-fold each year until it was frozen at its todays value of $327.68. This hwhen non manufactured Knuth unfortunate, but, as there own been super pack bugs & around any experience the bank check proving that the creator observed a bug in TeX is ordinarily framed instead of cashed.

Computer-science aspects of TeX

the TeX software system incorporates many interesting algorithmic rule, & has led to a total of theses of Knuth's students. E.g., the hyphenation algorithmic rule (function by Frank Liang) is used that assigns priorities to breakpoints inside letter groups. The listing of hyphenation system may be generated automatically from either the corpus of hyphenated words.

A line breaking algorithmic program is an case of dynamic programming. the conditionorth of breaking the paragraph of north words into lines has a naif complexness of Iin, however by using dynamic programming a globally optimum layout may be derived eventually proportional to the total of words & the total of words by the line. The thesis by Michael Plass shows how a report breaking condition may be NP-complete because of the added complication of placing figures.

A companion program Metafont for character generation uses Bezier curves in the fairly standard way, however Knuth devotes lots of attentiin to the rasterizing condition on bitmapped displays. A second thesis, by John Hobby, further explores this condition of digitizing "brush trajectories". This term derives from either a fact that Metafont describes characters when with been drawn by abstract brushes. When TeX has been extremely successful, Metafont has non been accepted by broker nature & severity designers, and fonts produced by using it such as Computer Modern have been harshly criticized.

Derived works
Many document processing systems come according to TeX, notably: LaTeX (Lamport TeX), which incorporates document styles for books, letters, slides, etc., & adds trend lines for referencing & automatic enumeration of sections and equations, ConTeXt, written mostly by Hans Hagen at Pragma is a document designing tool according to TeX. It's good deal immature than LaTeX. AMS-TeX, produced by a American Mathematical Society, has many additional user-friendly commands, which may be altered by journals to healthy using a home style. Virtually all of the features of AMS-TEX may be utilized inside LTheTEX by using the AMS "packages". This is so known as AMS-LATEX. A virtually all popular book in AMS-TEX was written by Michael Spivak, and is entitled The Joy of TeX. jadeTeX which uses TeX as a backend for printing from either James Clark's DSSSL Engine, Texinfo, the GNU documentation processing system. XeTeX is a new TeX engine that supports Unicode and the advanced Mac OS X font technologies. Many extensions & companion software online for TeX survive, among the babies BibTeX for bibliographies (distributed with LaTeX), PDFTeX, which bypasses dvi and green groceries output around Adobe Systems' Portable Document Format, and Omega, which allows TeX to use a Unicode character set. Altogether TeX extensions come available gratis from either CTAN, the Comprehensive TeX Archive Network.

Compatible tools
In UNIX-compatible systems (including Mac OS X), TeX is distributed in the form of [http://www.tug.org/teTeX/ teTeX]. In Windows, there is a [http://www.miktex.org/ MiKTeX] distribution & a [http://www.fptex.org/ fpTeX] distribution.

A TeXmacs text editor is a WYSIWYG scientific text editor that is intended to become compatible using TeX. It utilizes Knuth's fonts, & might generate TeX output. LyX for UNIX, TeXShop for Mac OS X, and WinShell for Windows are similar tools.

A KDE windowing system for Unix has a program, Kile, for editing LaTeX and TeX.

GNU Emacs has various built-in & third person packages sustaining trend lines for TeX, a major 1 existence AUCTeX.

Examples
The elementary obviously TeX lesson - Produce the document myfile.tex sustaining a as a result content: hello \bye

So open the command line interpreter and type tex myfile.tex

TeX so creates the file myfile.dvi Utilize a viewer to view the file. MikTeX for instance contains the viewer known as yap: gob myfile.dvi

A viewer shows howdy in the document. \bye occurs as TeX comm& which marks a prevent of the file and is non shown in the final output.

the dvi file potty either exist as printed directly from either a viewer or even converted to a extra park format like PostScript using the dvips program.

Alternatively PDF files may be created directly, utilizing pdfTeX: pdftex myfile.tex

pdfTeX was originally created because converting generated PostScript into PDF resulted inside unfortunate font display, though printing performance was mulct. This was because TeX natively utilizes bitmap fonts, which are exclusively designed to display swell at one particular size, whereas PostScript usually utilizes scalable Type 1 fonts.

These are okay, imaginable to produce dvips output scalable fonts using the little of tweaking (freshly versions of Ghostscript trend lines it), however straight conversion to PDF has more advantages: these are a a single-step, non both-step run, & pdfTeX will bring facilities like bookmarker & hyperlinks non detected inside PostScript.

Mathematical examples
To understand TeX farther around action, view its data formatting of mathematical system. E.g., to write a easily-known quadratic formula, try entering A quadratic formula is $$ \bye

Apply TeX when above, & smart shoppers should make their way something that looks like Notice how else a formula is printed inside how else a human would write by hand, or even typeset the equation. Within the document, typing maths mode is handle starting by using the $, so typing the formula around TeX semantics & closing over again sustaining an additional $. Display math, or even maths conferred centered in the just released line is treat utilizing $$. For instance, a above by having a quadratic formula inside display maths:

A quadratic formula is $$$$ \bye

renders as

LaTeX examples
LaTeX is a collection of macros written in TeX. There are numerous predefined guide (by having predefined styles) of these could apply. These are tremendously other integrated than TeX, providing the placed of macro instruction & utilities for indexing, tables, lists and so forth. E.g.: \documentclass[a4paper]\begin\section\subsection%% A text goes here \end

To render a book as a PostScript file, have: latex myfile.tex dvips myfile.dvi Or else, a single way to render a book as a PDF file is pdflatex myfile.tex

TeX Reference and Examples by David Bausum
Complete overview of TeX primitive control sequences.

Plain TeX Reference
A help file for Plain TeX derived from Anthony Stark's Plain TeX Reference. Compiled by Norman Walsh.






© 2005 GeneralAnswers.org