What is TeX?
TeX is a low-level markup and programming language created by Donald Knuth to typeset documents attractively and consistently. Knuth started writing the TeX typesetting engine in 1977 to explore the potential of the digital printing equipment that was beginning to infiltrate the publishing industry at that time, especially in the hope that he could reverse the trend of deteriorating typographical quality that he saw affecting his own books and articles. With the release of 8-bit character support in 1989, TeX development has been essentially frozen with only bug fixes released periodically. TeX is a programming language in the sense that it supports the if-else construct: you can make calculations with it (that are performed while compiling the document), etc., but you would find it very hard to do anything else but typesetting with it. The fine control TeX offers over document structure and formatting makes it a powerful—and formidable—tool. TeX is renowned for being extremely stable, for running on many different kinds of computers, and for being virtually bug free. The version numbers of TeX are converging toward , with a current version number of 3.1415926.
The name TeX is intended by its developer to be /'tɛx/, /x/ being the velar fricative, the final consonant of loch and Bach. (Donald E. Knuth, The TeXbook) The letters of the name are meant to represent the capital Greek letters tau, epsilon, and chi, as TeX is an abbreviation of τέχνη (ΤΕΧΝΗ – technē), Greek for both "art" and "craft", which is also the root word of technical. English speakers often pronounce it /'tɛk/, like the first syllable of technical.
Programming in TeX generally progresses along a very gradual learning curve, requiring a significant investment of time to build custom macros for text formatting. Fortunately, document preparation systems based on TeX, consisting of collections of pre-built macros, do exist. These pre-built macros are time saving, and automate certain repetitive tasks and help reduce user introduced errors; however, this convenience comes at the cost of complete design flexibility. One of the most popular macro packages is called LaTeX.
What is LaTeX?
LaTeX (pronounced either "Lah-tech" or "Lay-tech") is a macro package based on TeX created by Leslie Lamport. Its purpose is to simplify TeX typesetting, especially for documents containing mathematical formulae. Within the typesetting system, its name is formatted as LaTeX.
Many later authors have contributed extensions, called packages or styles, to LaTeX. Some of these are bundled with most TeX/LaTeX software distributions; more can be found in the Comprehensive TeX Archive Network (CTAN).
Since LaTeX comprises a group of TeX commands, LaTeX document processing is essentially programming. You create a text file in LaTeX markup, which LaTeX reads to produce the final document.
- You don't (usually) see the final version of the document when editing it.
- You generally need to know the necessary commands for LaTeX markup.
- It can sometimes be difficult to obtain a certain look for the document.
On the other hand, there are certain advantages to the LaTeX approach:
- Document sources can be read with any text editor and understood, unlike the complex binary and XML formats used with WYSIWYG programs.
- You can concentrate purely on the structure and contents of the document, not get caught up with superficial layout issues.
- You don't need to manually adjust fonts, text sizes, line heights, or text flow for readability, as LaTeX takes care of them automatically.
- In LaTeX the document structure is visible to the user, and can be easily copied to another document. In WYSIWYG applications it is often not obvious how a certain formatting was produced, and it might be impossible to copy it directly for use in another document.
- The layout, fonts, tables and so on are consistent throughout the document.
- Mathematical formulae can be easily typeset.
- Indexes, footnotes, citations and references are generated easily.
- Since the document source is plain text, tables, figures, equations, etc. can be generated programmatically with any language.
- You are forced to structure your documents correctly.
The LaTeX document is a plain text file containing the content of the document, with additional markup. When the source file is processed by the macro package, it can produce documents in several formats. LaTeX natively supports DVI and PDF, but by using other software you can easily create PostScript, PNG, JPEG, etc.
Philosophy of use
Flexibility and modularity
One of the most frustrating things beginners and even advanced users might encounter using LaTeX is the lack of flexibility regarding the document design and layout. If you want to design your document in a very specific way, you may have trouble accomplishing this. Keep in mind that LaTeX does the formatting for you, and mostly the right way. If it is not exactly what you desired, then the LaTeX way is at least not worse, if not better. One way to look at it is that LaTeX is a bundle of macros for TeX that aims to carry out everything regarding document formatting, so that the writer only needs to care about content. If you really want flexibility, use plain TeX instead.
One solution to this dilemma is to make use of the modular possibilities of LaTeX. You can build your own macros, or use macros developed by others. You are likely not the first person to face some particular formatting problem, and someone who encountered a similar problem before may have published their solution as a package.
CTAN is a good place to find many resources regarding TeX and derivative packages. It is the first place where you should begin searching.
Questions and documentation
Besides internet resources being plentiful, the best documentation source remains the official manual for every specific package, and the reference documentation, i.e., the TeXbook by D. Knuth and LaTeX: A document preparation system by L. Lamport.
Therefore before rushing on your favorite web search engine, we really urge you to have a look at the package documentation that causes troubles. This official documentation is most commonly installed along your TeX distribution, or may be found on CTAN.
Terms regarding TeX
- Document preparation systems
LaTeX is a document preparation system based on TeX. So the system is the combination of the language and the macros.
TeX distributions are collections of packages and programs (compilers, fonts, and macro packages) that enable you to typeset without having to manually fetch files and configure things.
An engine is an executable that can turn your source code into a printable output format. The engine by itself only handles the syntax. It also needs to load fonts and macros to fully understand the source code and generate output properly. The engine will determine what kind of source code it can read, and what format it can output (usually DVI or PDF).
All in all, distributions are an easy way to install what you need to use the engines and the systems you want. Distributions usually target specific operating systems. You can use different systems on different engines, but sometimes there are restrictions. Code written for TeX, LaTeX or ConTeXt are (mostly) not compatible. Additionally, engine-specific code (like font for XeTeX) may not be compiled by every engine.
|ConTeXt||A TeX-based document preparation system (as LaTeX is) with a very consistent and easy syntax and support for pdfTeX, XeTeX and LuaTeX engines.
It does not have the same objective as LaTeX however.
|LaTeX||A TeX-based document preparation system designed by Leslie Lamport. It is actually a set of macros for TeX. It aims at taking care of the formatting process.|
|MetaFont||A high-quality font system designed by Donald Knuth along with TeX.|
|MetaPost||A descriptive vector graphics language based on MetaFont.|
|TeX||The original language designed by Donald Knuth.|
|xetex, xelatex||a TeX engine which supports Unicode input and .ttf and .otf fonts. See Fonts.|
|luatex, lualatex||A TeX engine with embedded Lua support, aimed aiming at making TeX internals more flexible. Like XeTeX, supports Unicode input and modern font files.|
|pdftex, pdflatex||Generates PDF output.|
|tex, latex||The "original" TeX engine. Generates DVI output.|
|MacTeX||A TeX Live based distribution targetting Mac OS X.|
|MiKTeX||A TeX distribution for Windows.|
|TeX Live||A cross-platform TeX distribution.|
Throughout this book you should also utilise other means for learning about LaTeX. Good sources are:
- the #latex IRC channel on Freenode,
- the TeX Stack Exchange Q&A,
- the TeX FAQ,
- and the TeXample.net Community.