What is LaTeX

TeX and LaTeX

TeX is a typesetting language created by Donald Knuth. He created the system while working on his The Art of Computer Programming books because he was appalled at the quality of the typesetting systems in use. The language is useful for general purpose typesetting, but was specifically designed for mathematical and technical works. TeX is a very low level language, but it supports macro creation. Macros allow the user to type a simple command in place of a long, complex set of commands. LaTeX is a set of macros written for TeX to make it even easier to produce beautiful documents. While many people use TeX directly, we will focus on using LaTeX.

Structured Layout v. WYSIWYG

When using LaTeX, you write your document and let LaTeX do the work of making it look good. This happens because in a LaTeX document you use simple macros to show documents structure such as sections, figures, and indexes. LaTeX then uses macros from professional designers to format your document and make it look good. On the other hand, when you use a word processor, you spend a large portion of your time fixing margins, fonts and general page layout. Some word processors now allow the user to define styles, but the defaults usually don't look that great and a lot of time must be invested to make a professional looking document.


TeX is really tau epsilon chi and is pronounced like “tek,” not “tex.” LaTeX is usually pronounced as “la-tek” or “lay-tek.” Writing a Simple Report with LaTeX

Parts of a Document

Your LaTeX document should be saved as a text file with a .tex extension. You can use any editor to create this file, but it must be plain text.

Document Preamble

Every LaTeX document begins with the document preamble. This is where you can tell LaTeX what type of document you are creating along with any special packages you would like to use. You can also enter the author and title of the document in this section.

  \title{Cost-Benefit Analysis of Fried Chicken and World of Warcraft}
  \author{Leroy Jenkins}

The general form for a LaTeX command is \command[options]{arguments}. In the example above, the first line tells LaTeX that we want to write a document that looks like an article on letter sized paper. LaTeX does not include all the functionality that every user will need, so many people have written extensions called packages. A package is just another set of macros to make LaTeX more useful. The next line in our example, \usepackage{geometry} loads the geometry package that we will use to set the margins for our document. The next two lines set the title of the document and the name of the author.

Document Body

In lieu of explaining before and after the example, here is a basic example of the document body. I will explain how it works afterward.

  \section{The First Section}

This is the first section of my document. I'm going to make this even a little longer so that we can see the difference between paragraphs. The paragraph really makes no sense.

Here is another paragraph in the first section of my document. We'll make this long also, just so that we have more than one line. Really, we want more than one line.

  \section{The Second Section}

How about another section.

  \subsection{A Subsection}

And even a little subsection. Adding new sections can be arbitrarily stacked, with expressions like \subsubsection, \subsubsubsection, etc.

  \section*{The Third Section}

Please notice that this section does not have a number on it.


A few things to note are that the \maketitle command makes a header for your document with the Title, Author, and Date created. \section is the command to begin a new section and \subsection is the command to begin a subsection (section of a section). Both the \section and \subsection commands can be used with an asterisk which means they should not be numbered. One last thing to note is that you should not use “ ” as your quote markers in LaTeX; you should use \`\` ''.

That is all you need to get started writing a LaTeX document. You don't need to worry about fonts, alignment, or even hyphenation, LaTeX does it all for you.

Viewing your Work

So far, all we've seen from LaTeX is how to write the LaTeX file. That doesn't do us much good, so now we'll talk about viewing and printing your documents.

The first step to processing your LaTeX document is to run latex. To process the file simple.tex you would run latex simple. This will generate a file called simple.dvi along with housekeeping files that LaTeX uses. The file generated, simple.dvi, is a device independent file, you can view it using xdvi or convert it to PostScript using a command like dvips simple.dvi -o It has also become common to submit documents as pdf files. The best way to generate pdf files with LaTeX is to use the command pdflatex instead of latex. It will generate a pdf file instead of a dvi file. More Advanced Features

Table of Contents

Including a Table of Contents in your document is very simple. All you have to do is add the \tableofcontents command to the document body and run latex twice to generate the document. You have to run latex twice because it gathers the page information for the sections on the first run and puts the information in the table of contents on the second run.


You can add a simple footnote with the command \footnote{text}. Here is a small example:

  \section{An Important Section}
  This is my important information, I got it from a webpage\footnote{}.

Including Graphics

It is often useful to include a figure in your document. To include images you will need to add \usepackage{graphicx} to the document preamble. Then you can add something like this in the document body:

  \label{My Figure}
  % Note that no extension is needed
  \includegraphics[attr1=val1, attr2=val2, ..., attrn=valn]{/path/to/image} 
  \caption{An Image}

The \begin{figure}[hbp] tells LaTeX that we are going to include a figure in our document and it can be placed here, at the bottom of the page, or on a page reserved for figures. The \includegraphics[attr1=val1, attr2=val2, …]{/path/to/image} line tells where your image file is and how big you want it to be in the final document.

latex.txt · Last modified: 2017/02/09 11:17 by cwpitts