Intro to LATEX


Back to cs180

LATEX is a typesetting system for generating professional looking (the content part is up to you) documents. The idea behind it all is that you don't want to bog yourself down into having to do layout design of your documents when your "expert domain" is the content of the document, not the look of it. Likewise, those who read your document should be amazed by your stunning intellectual ideas rather than your possibly poor design taste and formatting inconsistencies. The basic idea is that you provide the structure and the content, and LATEX does the typesetting for you. It's like having your own personal publisher!

The structure of a LATEX file can be divided into two basic parts: the preamble, and the body.

The Preamble:

Here is where you tell LATEX what type of document you are writing along with any special packages that you might be using.

Document Classes:

Every document that is processed must belong to a "document class". A handfull of these classes are: article, report, book, slides. (For this class articles should be sufficient) This choice is communicated to LATEX with the following command.

\documentclass[options]{classtype}

So if you wanted to create an article in 12pt font you would write:

\documentclass[12pt]{article}

in the preample.

Other Stuff:

Some other things that the preamble might contain are the title of the document and who wrote it; which might be specified as follows:

\title{The Perilous Occupation of Crime Fighting in Cartoons}
\author{Bullwinkle Moose \and Dudley DoRight \and Rocky the Flying Squirrel}

Notice the keyword "\and" used to separate the different authors.

The Body:

This is pretty much what is suggested by the title. The body contains all of the contents of your document as well as instructions to LATEX concerning how you want the content structured. The body is contained between the two directives:

\begin{document}
\end{document}

Within this block you issue commands to LATEX to tell it what is a section, subsection, list of items, etc; as well as other small formatting details such as if you wish to insert a newline, quote, equation, etc.

Some directives that you will probably find very useful are:

And that's enough rambling by me! If you want to learn more (and I suggest you do), check out The (Not So) Short Introduction to LaTeX2e, particularly chapters 1 and 2.

Here are some instructions on how to take a LATEX file and turn it into a pdf document.

Creating a pdf Document From a .tex File

1. Create a directory to do all this in; say "sampletex".
2. Dowload this file (sample.tex) into your new directory.
3. From within your new directory type:

   > pdflatex sample.tex
4. You're done.
5. Look at the sample file and the pdf document to get an idea of how the structure of the document was communicated to LATEX and try writing a sample document of your own. The (Not So) Short Introduction to LaTeX2e should be an excellent resource for any questions that you have.

Tim Mauch
Last modified: Sun Sep 28 14:59:57 PDT 2003