What's LaTeX all about?

Rein Smedinga


LaTeX is a text formatting program, i.e., after you have written a text into a file by means of an editor, the LaTeX-program converts this text into printable matter. With LaTeX you cannot do what-you-see-is-what-you-get work: you need two steps: one editing step in which you type in the text together with typesetting commands into a file; and one formatting step, in which the program converts the text, according to the given commands, in printable code.

The following steps have to be done:

  1. Creation of a text file with text and LaTeX commands. Creation is done using a text editor (any editor will do). For example, you can use the editor emacs:
        emacs example.tex
    The UNIX command above starts the editor and creates the file example.tex. You should always give the file a name with extension .tex (otherwize LaTeX will not recognize the file as a text file).
  2. Converting this file to printable code. Here the LaTeX-program does the job:
        latex example
    It is not necessary to give the filename extension here. LaTeX now creates some additional files. One of these is the file example.dvi,that can be printed and previewed. Also example.aux is created (needed for cross referencing) and example.log in which LaTeX writes down a log of everything it has done.

    Because each language has its own hyphenation-rules, you can use other rules than English hyphenation by giving special commands in the file. We will return to this subject later on.

  3. Previewing the document. By typing:
        xdvi example
    the file example.dvi will be previewed on your screen.
  4. Printing the document. By typing:
    lp -d printername example.dvi
    your document will be printed. For printername fill in: x for the Xerox printer on the ground floor, or lj4 for the HP laserjet printer on the first floor.

A document in LaTeX

As stated before, the original text file example.tex should not only contain text, but also LaTeX-commands. First of all, you need to explain what kind of document you want to make, and you should indicate the beginning and the end of the included text. This is done by typing on the first lines of your text-file the following:

The first line explains to LaTeX that you want to make an article. Changing article into report creates a report. Also book and letter are possible. The last one creates a letter that can be mailed.

The second line tells LaTeX that after this line your real document starts. At the end of that document, you should add the following line:

which tells LaTeX that your document ends here. Everything after this line will be ignored by LaTeX.

A very simple article could be:gif

Between \documentclass and {article} you can put all kind of options to change the documentclass a little bit. For example, by:

you create a document in a4 paper format.

Another possibility is to add extra tools. This is done by adding (after the documentclass-line) lines like:

The first line adds the epsf-tool with which eps-files can be included. The second line adds the babel-tool, with which multilanguage documents can be made. In this case the babel-tool has an additional option dutch, telling LaTeX that Dutch hyphenation should be used instead of English. Also, language-dependent words, like chapter, contents, etc. will automatically be renamed to the Dutch words hoofdstuk, inhoud, etc.

Another possibility to use here is the option to enlarge the used font a little bit. Instead of standard 10 pt. fonts you can use 11 pt. fonts by starting with:

In the same way, you can use 12 pt. fonts. If you include more options, each option should be separated by a comma:

Commands in LaTeX

In order to create a textfile, it will now be clear that the actual text has to be put between \begin{document} and \end{document}. However, in typing your text, you should be aware, that some characters have special meaning. We mention

{ } \ # $ % &
The backslash \ is used to denote a command rather than normal text. So text is some text while \text denotes a command. If you want to use any of the above symbols, you should use
\{ \} \backslash \$ \% \&

Commonly used commands are those to denote the beginning of a new chapter, new section, etc. We mention a few:

Of course, many more commands are possible. See the literature.


Some commonly used accents are:

to get beëindigen.
be\"\i nvloed
to get: beïnvloed (the \i creates a dotless i).
to get: één.

Other fonts

The used font can be changed to for example boldface or italics by typing:

\textbf{this will be printed boldface} and this in normal font
\emph{and this emphasized} and normal again and \textsl{slanted} and
\textit{italics} and so on.
The used font can be resized to smaller or


sizes by typing:
{\tiny very small text}
{\footnotetext Quite small text}
{\small Small text} 
{\normalsize is normally not used}
{\large Larger text}
{\LARGE Even larger text}
{\Huge Very huge text}
In fact, we have available:
\tiny \scriptsize \footnotesize \small \normalsize 
\large \Large \LARGE \huge \Huge


LaTeX provides easy to use commands to create tables. For example:

The argument after \begin{tabular} defines the structure of the table. Each letter represents a column. A l means a left alined column, a c means a centered column, and a r means a right alined column. Also possible is to put a | there, to define a vertical line between columns. The contents of each part of the table is separated by & and each line is ended by \\ . Much more complex tables are possible. The reader is adviced to look in the LaTeX-manual, [Lam94], for more examples.

Floating text

Floating text is text that can be put somewhere in the text, but has no specific place within the text. For example figures and tables can be floats. They should be put near the place the figure or table is discussed. Such floats can be created in LaTeX by typing:

Figure text...
\caption{Figure title}
The caption will create the title of the floating part. Also possible is:
Table text...
\caption{Figure title}
The difference between figure and table is the name in the caption: Figure and Table, respectivily. Also here, numbering is done automatically.


A mathematical formula is put between $. For example:

Subscripts are defined using _ and superscripts using ^. If more characters are to be sub/superscripted, these should be put between accolades, e.g. compare:

For displayed formulaes, we use:

Displayed formulaes are put on a separate line and centered. \sum is the summation symbol. In [Lam94] long lists of symbols can be found.

And many more...

The reader is adviced to read the LaTeX-manual [Lam94] to explore LaTeX. Sample text files exists, to get a first impression on LaTeX, for example try:

    cp /usr/local/teTeX/texmf/tex/latex/base/sample2e.tex .
    latex sample2e
    xdvi sample2e
and compare the contents of the file sample2e.tex with the previewed result.

Errors in your LaTeX document

If some error occurs in your document, you get an error message on the screen. Something like:

! Undefined control sequence.
l.22 ...eation of a text file with text and \LateX
                                                  \ commands. Creation is
The first line tells in which line of your text file the error occurs. The last part of that same line gives the part that causes the error. The question mark is a prompt. You can type h here to get additional information about the error. Other possibilities are x to quit the whole LaTeX-session, or giving a return only, to let LaTeX try to fix the error by himself (possibly more errors occur because of this error, so most likely, a couple of returns are necessary to recover from this error; also, the error is not corrected in your original text file!). The last option (giving a return) makes it possible to check the remainder of the document. After a LaTeX-run you should correct the error(s) yourself in your text file using an editor and, next, try to run LaTeX again.


M. Goossens, F. Mittelbach, and A. Samarin. The LaTeX companion. Addison Wesley, 1994.

Donald E. Knuth. The TeXbook. Addison Wesley, 1984.

D.E. Knuth. The errors of TeX. Software - practice and experience, 19(7):607--685, July 1989.

Leslie Lamport. LaTeX, A document preparation system. Addison Wesley, 1994. second edition, updated for LaTeX2e.

On the left is printed how the input looks like, on the right you will find the result.

Rein Smedinga
Wed Apr 17 09:42:36 METDST 1996