# LaTeX

### What is LaTeX?

LaTeX is a free software package for typesetting documents for printing and for on-screen viewing. It is particularly strong for documents that involve a lot of mathematical expressions, but it also pays serious attention to refined aspects of typesetting. Documents typeset with LaTeX are considerably more beautiful than documents created in any word processing application. Mathematicians, physicists, chemists, economists, and many other scholars use LaTeX to typeset their works due to its superiority and free availability.

LaTeX is a software package based on the computer application TeX, created in 1978 by Donald E. Knuth. The original author of LaTeX is Leslie Lamport, but now LaTeX is maintained by others. Please visit http://www.latex-project.org/ for the history of LaTeX and other related information. Knuth chose the name TeX because of the ancient Greek word τέχνη, which means art. People who know this pronounce TeX as “tech”, not “tex”. Knuth made TeX freely available and it became one of the earliest and most successful open source software programs, around which there also sprang an amazingly large collection of extensions and packages, of which LaTeX is a particularly successful example that lets you pay attention to creating content, while leaving the details of typesetting to professionally created templates.

A very good introduction to LaTeX is the Not-So-Short Introduction to LaTeX 2e.

NEW (2010-12-03): I just discovered this very nice introduction, still being written, by M.R.C. van Dongen, LaTeX and Friends. UPDATE: (2013-09-08) This books is now published and the link I previously had here no longer leads to the PDF of the book. Here is the author’s page about it.

NEW (2013-09-08): I discovered a great guide for handling tricky math in LaTeX, by “RSI 2011 staff” at MIT.

I have been using LaTeX over many years to typeset papers, presentations, lecture notes, and a book.

The version of LaTeX you will need in order to create and typeset documents depends on the operating system you run on your computer. Here are some good choices, arranged by operating system.
TeX Live – runs on every widely used operating system (Linux, other versions of UNIX, Mac OS X, Windows).
For the Max OS X, the best setup is MacTeX, which adds some very good tools to the TeXLive 2009 distribution. It includes the excellent LaTeX development environment TeXShop (LaTeX editor with a well-integrated previewer).
For editors I recommend Emacs (see below if you are using a Mac), Kile or Emacs on Linux, and LEd or Texniccenter on Windows. Winedt is an old favorite for Windows, but is is not free (shareware) and it is showing its age. TeXLive these days comes with TeXworks, which attempts to provide a development environment like TeXShop for all operating systems. It still has some rough edges. A special ability of Emacs, when the AucTeX emacs package is installed, is the ability to show equations and images within the text document as you prepare it, sparing you the need to keep compiling your document very frequently to see the output of your work.
For the hardy souls who are familiar with Emacs, the Aquamacs version for Mac OS X is by far the best Emacs implementation I have seen, and I have tried Emacs on Linux, Windows, and the Mac. In fact, it is so well configured that you don’t really need to be a hardy soul to use it.

ADDITION: After the 3/3/2010 presentation at Temple University, Sandeep Bhaskar suggested that I should add a mention of the TeXmaker program for composing, compiling, and previewing LaTeX documents. It has graphical ways of entering commands that you may find hard to remember and runs on every widely-used operating system.

### Tutorials and Examples

You create documents in LaTeX by editing a text file with extension .tex. It is a good idea to avoid spaces in the name of the file. It is also a good idea to avoid word processors and instead use a text editor for this; I offered suggestions of editors earlier. A particularly problematic aspect of using a word processor for a .tex document is that most of them are configured to use curly apostrophes and other special marks that are most likely going to be misinterpreted by LaTeX. Do not worry, LaTeX will convert apostrophes to curly ones and will make many other beautifying changes to your text automatically, according to its professionally designed templates. Another advantage of text editors specially made for LaTeX work is that they highlight commands in color and can automatically match braces, thereby reducing substantially the number of LaTeX-syntactical errors that you make. The editors also have boilerplate embedded in special macros (these differ by editor) to save you typing; for instance, if I want to insert a bulleted list in my document and I am using Emacs, I type Ctrl+E and then “itemize” (without the quotes), causing Emacs to insert

\begin{itemize}
\item
\end{itemize}

and to put the insertion point right after the item command for me to type the text of the first bulleted item.

I offer now some hints for creating various kinds of documents. My examples come in two parts: the .tex file and the resulting .pdf output file.

##### Workflow

The typical workflow in composing $LaTeX$ documents is as follows.

3. Compile it with PDFLaTeX (each editor listed above provides a simple, one-click way of doing so).
4. If you have added citations using BibTeX, run BibTeX (your editor should provide a simple, one-click way of doing so).
5. If you ran BibTeX, run PDFLaTeX twice now, to resolve cross-references. (LaTeX deals with cross-reference information by writing it into a file first, which it then needs to read to incorporate that information back into the document.)
6. If you get error messages, do not panic. You probably mismatched braces or mistyped commands. Your document is still there, no matter how many errors you got. Google is your friend as you try to figure out errors, and the not-so-short introduction to LaTeX mentioned above has some advise on dealing with errors, too.
7. Preview the ensuing PDF. I recommend strongly against using Adobe Reader. It is slow, unsafe, and locks the files it has open, making it hard for you to repeat this process. Foxit Reader is a good alternative on Windows, and another good one and open-source to boot, is Sumatra. The Mac OS X system provides Preview, its own PDF reader that works very well (or you can download the free Skim which is also an excellent PDF reader); of course, you can just use the integrated PDF reader in TeXShop. On Linux good alternatives are Evince, xpdf, or Okular, which is the native previewer of Kile.
8. Repeat as needed.

Do not get worried that the compilation process will be slow. Modern computers are amazingly fast doing this. On my computers, I can typeset a 300-page book in about 5 seconds.

#### Composing papers

There are many choices for papers, some based on the default LaTeX article document class, others on different LaTeX document classes. Here is an example (and the PDF output generated by compiling it with PDFLaTeX, the default variant of the LaTeX compiler) based on some lecture notes of mine, with portions removed to make the file shorter. Even after the removals, the file shows you the use of many interesting packages, such as setspace for declarations such as onehalfspacing or doublespacing, fourier for a nice collection of fonts (try commenting out the line usepackage{fourier} by typing % in front of it and recompile to see the default LaTeX font set) and the wonderful graphics package tikz (written, like Beamer, by Till Tantau, who also wrote a fantastic manual for tikz).

#### Bibliographies

The creation and maintenance of bibliographies is easily automated in LaTeX via the program BibTeX. Here is an easy introduction. There are also programs that help with the creation and maintenance of the .bib file that you will need to have to use BibTeX. A good one that runs on Java, and so can be used on many operating systems, is Jabref. It is a good idea to start work on your bibliography as you start composing the paper itself. You can then take advantage of the automation of bibliography management that LaTeX offers when used in conjunction with BibTeX.

#### Making presentations

There are several presentation packages for LaTeX. My favorite, and the one most LaTeX-savvy economists use for their presentations, is called Beamer. A tutorial for Beamer can be found at here (PDF). I also strongly recommend the Beamer manual, written by Till Tantau, the creator of Beamer, which should be in your TeX installation (and is easily found via a Google search if it is not). It is one of the best software manuals I have encountered; do not be put off by its length, it is lengthy in order to be clear and to cover all the myriad features of Beamer.

Here is an example Beamer presentation with the source file (.tex file) and the file’s PDF output.

#### Lecture Notes on the Fly

I have not used LaTeX in this way, but someone else has. The linked article has a treasure trove of good advice on how to make your creation of LaTeX documents more efficient and accurate.

#### List of Symbols Available in LaTeX

There is a comprehensive list.

#### CTAN

This acronym stands for the Comprehensive TeX Archive Network. There you can find an unbelievably extensive collection of informative documents, packages, fonts, and software related to all things TeX / LaTeX.

#### Recently discovered

There is an excellent visual reference guide to LaTeX here. [2012-12-30]

## 2 thoughts on “LaTeX”

1. Pingback: tex editor

This site uses Akismet to reduce spam. Learn how your comment data is processed.