LaTeX/Introduction
What is TeX?
editTeX is a 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, in the hope that he could reverse the trend of deteriorating typographical quality that he saw affecting his own books and articles. While TeX is a programming language in the sense that it is Turing complete, its main job is to serve as a markup language for describing how your document should look. 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 the mathematical constant , with the current version number being 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.
The tools TeX offers "out of the box" are relatively primitive, and learning how to perform common tasks can require a significant time investment. Fortunately, document preparation systems based on TeX, consisting of collections of pre-built commands and macros, do exist. These systems save time by automating certain repetitive tasks; however, this convenience comes at the cost of complete design flexibility. One of the most popular macro packages is called LaTeX.
What is LaTeX?
editLaTeX (pronounced either "Lah-tech" or "Lay-tech") is a set of macros for TeX created by Leslie Lamport. Its purpose is to simplify the TeX typesetting, especially for documents containing mathematical formulae. Within the typesetting system, its name is formatted as LaTeX.
TeX is both a typographical and logical markup language, and one has to take account of both issues when writing a TeX document. In creating LaTeX, Lamport's aim was to split those two aspects. A typesetter can make a template and the writers can focus on LaTeX logical markup despite perhaps not knowing anything about typesetting.
In addition to the commands and options LaTeX offers, many other authors have contributed extensions, called packages or styles, which you can use for your documents. Many of these are bundled with most TeX/LaTeX software distributions; more can be found in the Comprehensive TeX Archive Network (CTAN).
Why should I use LaTeX?
editMost readers will be familiar with WYSIWYG (What You See Is What You Get) typesetting systems such as LibreOffice Writer, Microsoft Word, or Google Docs. Using LaTeX is fundamentally different from using these other programs—instead of seeing your document as it comes together, you describe how you want it to look using commands in a text file, then run that file through the LaTeX program to build the result. While this has the disadvantage of needing to pause your work and take multiple steps to see what your document looks like, there are many advantages to using LaTeX:
- You can concentrate purely on the structure and contents of the document. LaTeX will automatically ensure that the typography of your document—fonts, text sizes, line heights, and other layout considerations—are consistent according to the rules you set.
- 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.
- Indexes, footnotes, citations and references are generated easily and automatically.
- Mathematical formulae can be easily typeset. (Quality mathematics was one of the original motivations of TeX.)
- Since the document source is plain text,
- Document sources can be read and understood with any text editor, unlike the complex binary and XML formats used with WYSIWYG programs.
- Tables, figures, equations, etc. can be generated programmatically with any language.
- Changes can be easily tracked with version control software.
- Some academic journals only accept or strongly recommend submissions in the form of LaTeX documents. Publishers offer LaTeX templates.
When the source file is processed by the LaTeX program, or engine, 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.
Terms regarding TeX
edit- Document preparation systems
LaTeX is a document preparation system based on TeX. So the system is the combination of the language and the macros.
- Distributions
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.
- Engines
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.
When searching for information on LaTeX, you might also stumble upon XeTeX, ConTeXt, LuaTeX or other names with a -TeX suffix. Let's recap most of the terms in this table.
Systems | Descriptions |
---|---|
AMSTeX | A legacy TeX macro-based document preparation system used by the American Mathematical Society (AMS) from 1982 to 1985. It evolved into the AMS-LaTeX collection which includes the amsmath package used in nearly every LaTeX document as well as multiple AMS publication layout standards (document classes). |
ConTeXt | A TeX macro-based document preparation system designed by Hans Hagen and Ton Otten of Pragma ADE in the Netherlands around 1991. It is compatible with the pdfTeX, XeTeX and LuaTeX engines.
ConTeXt assumes the content author (writer of the document’s text) and the style author (designer of the document’s layout and appearance) are the same. It has a consistent and easy to understand syntax that provides the author with the tools and freedom necessary to produce a document with any desired layout. In cases where there are no standards to follow, ConTeXt provides creative freedom at the expense of required additional effort. ConTeXt excels at producing high-quality works with creative flair, such as textbooks and literature with artistically distinctive layouts. |
LaTeX | A TeX macro-based document preparation system designed by Leslie Lamport.
LaTeX assumes the content author and style author are different people. This allows authors (researchers, students, etc.) to concentrate on content and forget about design while allowing publishers (journals, graduate departments, etc.) to enforce institutional standards. Separation of content and design comes with the costs of package management, a less consistent syntax, and added complexity (compared to ConTeXt) if an author wishes to deviate from the layout designer's specification (documentclass). LaTeX excels at producing high-quality academic documents that conform to publication requirements, such as journal articles and theses. |
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. |
Texinfo | A TeX macro-based document preparation system designed by Richard Stallman that specializes in producing technical documentation (software manuals). |
Engines | Descriptions |
---|---|
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, 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. |
TeX Distributions | Descriptions |
---|---|
MacTeX | A TeX Live based distribution targetting Mac OS X. |
MiKTeX | A TeX distribution for Windows. |
TeX Live | A cross-platform TeX distribution. |
What's next?
editIn the next chapter we discuss installing LaTeX on your system. Then we will typeset our first LaTeX file.
Learning more
editOne of the most frustrating things beginners and even advanced users might encounter using LaTeX is the difficulty of changing the look of your documents. While WYSIWYG programs make it trivial to change fonts and layouts, LaTeX requires you to learn new commands and packages to do so. Subsequent chapters will cover many common use cases, but know that this book is only scratching the surface.
Coming from a community of typography enthusiasts, most LaTeX packages contain excellent documentation. This should be your first step if you have questions—if a package's manual has not been installed on your machine as part of your TeX distribution, it can be found on CTAN.
Other useful resources include:
- The TeX Stack Exchange Q&A
- the #latex IRC channel on Freenode
- #latexconnect
- The TeX FAQ
- The LaTeX.org forums
- Donald Knuth's original guide to TeX, The TeXbook
- Leslie Lamport's original guide to LaTeX, LaTeX: A document preparation system