This document contains instructions on using the LaTeX document preparation system on ITC-supported computers. This document will show you how to create a simple LaTeX file, how to process it, and how to view or print the typeset document. (While this document demonstrates some of the advanced features of LaTeX, detailed usage instructions for these features are beyond the scope of this document.)
LaTeX is a document-prepartion system created in the mid-1980's by Leslie Lamport to make the exercise of creating professionally typeset documents a little easier. LaTeX is built on top of a typesetting system called TeX created by Donald Knuth. While TeX is very good at positioning characters on a page in a manner that creates an aesthetically pleasing document, most writers do not want to deal with such a low level of detail. LaTeX is a collection of TeX commands that allow authors to concentrate more on the content of their files, rather than worry about the exact formatting characteristics required by their publisher.
To use LaTeX and the supporting programs described in this document, you must:
The following sequence describes the process of creating a professionally typeset document with LaTeX. Detailed command sequences for processing a sample file will be presented later.
The act of processing the .tex file will have generated several auxilliary files (e.g., files ending with the extension: .aux or .log) that were used during processing and one device-independent output file, ending with the extension: .dvi.
LaTeX commands and declarations are classified in one of three categories:
The case of letters in command names is important; most LaTeX command names contain only lowercase letters. A command name cannot be split across lines.
Examples: The underscore (_) is the subscript command. If you wanted an underscore in your text, you would use \_. When a sentence-ending period follows an uppercase letter, you would precede the period with the \@ command which tells LaTeX that the period really does end the sentence and to space the text properly. Other commands, like \em or \today emphasize text or return the date, respectively.
Mandatory command arguments are enclosed in braces: { } . Optional arguments are enclosed in brackets: [ ] . Do not leave any spaces, either between arguments or within an argument list.
A declaration is a command that directs LaTeX to change the way it is formatting the document. The scope of a declaration (or range of text over which it has effect) is delimited by enclosing it within braces. The environment construction
\begin{name} \end{name}
(where name is the name of the environment) can also be used to delimit the scope of a declaration.
A LaTeX document always begins with the command:
 \documentclass{style}
(This property also serves to distinguish the document from a plain TeX file, which also ends with the extension .tex. Also note that older versions of LaTeX (ie LaTeX 2.09) use \documentstyle instead of \documentclass. Documents that start with \documentstyle and are processed with latex will be processed in LaTeX 2.09 compatibility mode.)
As mentioned before, one of the purposes of LaTeX is to allow the author to focus on the content of a paper, rather than formatting details. LaTeX has several standard document styles (e.g. book, article, report). By using the command \documentclass{book}, you tell LaTeX that you want your document in a book format. Similarly, if you wanted to write an article for publication, you would use \documentclass{article}. If none of the above styles suit your needs, you can write your own document style or copy one of the freely available styles from a CTAN site (see section on Getting Additional Help.
Following the \documentclass declaration will be several other commands or declarations. Depending on the document style, you may see something like:
\title{A Very Short LaTeX Document} % Tell LaTeX the title of the document
\author{ITC User Support} % Tell LaTeX who the author is
You can also use:
\date{November 15, 1994}
to tell LaTeX what the date of the document is, if you prefer not to au- tomatically include the current date.
The "%" character tells LaTeX that anything that follows is a comment and should be ignored.
The rest of the document will consists of a sequence of LaTeX commands enclosed by:
\begin{document}
and
\end{document}
You can insert your text and any of the types of commands mentioned above between the document environment construction (you would insert the \maketitle command first to create the Title page). The next section describes some other useful things you can do with LaTeX.
LaTeX provides a mechanism for producing documents which include equations, figures, tables and more, all bundled into one package. In math-mode, LaTeX supports many mathematical constructs - matrices, vectors, dots for derivatives, etc. The following environments are among the most popular available in LaTeX.
The Math environment (or mode) offers a complete working environment for processing mathematical symbols, producing equations, formulas, etc. Arrays can be produced with the array environment in math mode.
For example, the LaTeX commands:
\begin{math}
\begin{array}{clcr}
a+b+c & uv & x-y & 27 \\
a+b & u+v & z & 134 \\
a &3u+vw & xyz &2,798
\end{array}
\end{math}
will produce:
a+b+c uv x-y 27
a+b u+v z 134
a 3u+vw xyz 2,798
Note that the "clcr" option specifies the justification of the array columns (center, left, center, right).
For example, to include the pre-produced PostScript image called "luan.ps" in your document, use the following LaTeX commands:
\documentclass{article}
\usepackage{psfig}
\begin {document}
Your text.
\begin{figure}
\centerline {
\psfig{figure=luan.ps}}
\caption{Random Chinese Calligraphy}
\end{figure}
More text.
\end{document}
will produce:
The Tabular environment allows you to align output neatly as though you were using typewriter-like TAB stops. Use this environment for tabu- lar lists or "boxed" information as shown below. A similar environ ment, Table, allows the user to print tabular information in a relative position on the page.
For example, the LaTeX commands:
\begin{tabular}{|l|r|}
\hline
\multicolumn{2}{|c|}{\ em A Few Muses } \\ \hline
\it Terpsichore & Dance \\
\it Erato & Love poetry \\
\it Calliope & Epic poetry \\
\it Thalia & Comedy \\
\it Polyhymnia & Sacred song\\ \hline
\end {tabular}
will produce:
___________________________
| A Few Muses |
|__________________________|
|Terpsichore | Dance |
|Erato | Love poetry |
|Calliope | Epic poetry |
|Thalia | Comedy |
|Polyhymnia | Sacred song |
|____________|_____________|
The List-Making environments automatically generate lists. A list is a sequence of items with indented left and right margins, each item beginning with a label. The most popular List-Making environments are Itemize and Enumerate.
For example, the LaTeX commands:
\begin{enumerate}
\item First Item
\item Second Item
\item Third Item
\begin {itemize}
\item[a.] This is item a.
\item[b.] This is item b.
\item[c.] This is item c.
\end{itemize}
\item Fourth Item
\end{enumerate}
will produce:
1. First Item
2. Second Item
3. Third Item
a. This is item a.
b. This is item b.
c. This is item c.
4. Fourth Item
To process your input file of text and formatting commands, invoke LaTeX from a Unix prompt with the command:
latex filename
where filename is any legal filename that includes the .tex suffix which LaTeX expects to find on every input filename (i.e., the file has to be saved under the name "filename.tex"). LaTeX will generate a device- independent file named filename.dvi. This file can be translated into a PostScript file by typing:
dvips filename.dvi
A PostScript file named filename.ps will be created.
Once you have created the PostScript file using the device-independent file from LaTeX, use the following command to send it to a PostScript laser printer:
lpr -Pprinter_name filename.ps
where printer_name is a valid printer accessible from your machine.
If you are in one of the ITC public labs, or if you have your PRINTER environment variable set, you can just type:
lpr filename.ps
and your file will be printed on the appropriate printer.
In December 1996 ITC installed teTeX-0.4, a TeX distribution for UNIX compatible systems, for testing. teTeX is available on ITC systems running AIX, SunOS, Solaris and IRIX. For information on the teTeX release, visit the Research Computing Group's LaTeX page at http://www.itc.virginia.edu/research/latex.html and follow the latex/tex retirement and upgrade link.
Note: On August 10, 1998 the teTeX installation of latex/tex became the ``default'' version.
The following texts are recommended for those wishing to learn more about the capabilities of LaTeX. They are available from the University Bookstore:
In addition to the above texts, the directory /help/unix/word.processing/latex.family/examples on ITC Unix systems, contains current usage instructions and several example files (including the one shown in Appendix A). There are also consultants at the ITC Help Desk and at some of the public computing labs who can help you with using an editor, using LaTeX, or printing a document. Copies of both the LaTeX manual and The TeXbook are available for reference from the ITC Help Desk.
For users who would like to get a non-standard style file, or would like to look for additional documentation, there is a Comprehensive TeX Archive Network (CTAN) that is a publicly accessible web-based archive of TeX and TeX-related materials.
On the following pages is the sample input file sample.tex from the LaTeX distribution. (This file is available on ITC machines as the file /help/unix/word.processing/latex.family/examples/latex_samp.tex.
% This is SAMPLE.TEX in text format, as of Apr 9, 1985.
% This is a sample LaTeX input file.
%
% You can use the following commands to get a printed copy:
% latex latex_samp
% dvips latex_samp | lpr -Pprinter_name
%
% A '%' character causes TeX to ignore all remaining text on the line,
% and is used for comments like this one.
\documentclass{article} % Specifies the document style.
% The preamble begins here.
\title{A Sample Document} % Declares the document's title.
\author{Leslie Lamport} % Declares the author's name.
\date{December 12, 1984} % Deleting this command produces today's date.
\begin{document} % End of preamble and beginning of text.
\maketitle % Produces the title.
This is a sample input file. Comparing it with the output it
generates can show you how to produce a simple document of
your own.
\section{Ordinary Text} % Produces section heading. Lower-level
% sections are begun with similar
% \subsection and \subsubsection commands.
The ends of words and sentences are marked
by spaces. It doesn't matter how many
spaces you type; one is as good as 100. The
end of a line counts as a space.
One or more blank lines denote the end
of a paragraph.
Since any number of consecutive spaces are treated like a single
one, the formatting of the input file makes no difference to
\TeX, % The \TeX command generates the TeX logo.
but it makes a difference to you.
When you use
\LaTeX, % The \LaTeX command generates the LaTeX logo.
making your input file as easy to read as possible
will be a great help as you write your document and when you
change it. This sample file shows how you can add comments to
your own input file.
Because printing is different from typewriting, there are a
number of things that you have to do differently when preparing
an input file than if you were just typing the document directly.
Quotation marks like
``this''
have to be handled specially, as do quotes within quotes:
``,`this' % , separates the double and single quote.
is what I just
wrote, not `that',''.
Dashes come in three sizes: an
intra-word
dash, a medium dash for number ranges like
1--2,
and a punctuation
dash---like
this.
A sentence-ending space should be larger than the space between words
within a sentence. You sometimes have to type special commands in
conjunction with punctuation characters to get this right, as in the
following sentence.
Gnats, gnus, etc. % ` ' makes an inter-word space.
all begin with G@. % @ marks end-of-sentence punctuation.
You should check the spaces after periods when reading your output to
make sure you haven't forgotten any special cases.
Generating an ellipsis
\ldots\ % `\ ' needed because TeX ignores spaces after
% command names like \ldots made from \ + letters.
%
% Note how a `%' character causes TeX to ignore the
% end of the input line, so these blank lines do not
% start a new paragraph.
with the right spacing around the periods
requires a special command.
\TeX\ interprets some common characters as commands, so you must type
special commands to generate them. These characters include the
following:
\$ \& \% \# \{ and \}.
In printing, text is emphasized by using an
{\em italic/} % The / command produces the tiny extra space that
% should be added between a slanted and a following
% unslanted letter.
type style.
will produce:
The following text ...
\begin{em}
A long segment of text can also be emphasized in this way. Text within
such a segment given additional emphasis
with\/ {\em Roman}
type. Italic type loses its ability to emphasize and become simply
distracting when used excessively.
\end{em}
It is sometimes necessary to prevent \TeX\ from breaking a line where
it might otherwise do so. This may be at a space, as between the
``Mr.'' and ``Jones'' in
``Mr.~Jones'', % ~ produces an unbreakable interword space.
or within a word---especially when the word is a symbol like
\mbox{\em itemnum\/}
that makes little sense when hyphenated across lines.
Footnotes\footnote{This is an example of a footnote.}
pose no problem.
\TeX\ is good at typesetting mathematical formulas like
\( x-3y = 7 \)
or
\( a_{1} > x^{2n} / y^{2n} > x' \).
Remember that a letter like
$x$ % $ ... $ and \( ... \) are equivalent
is a formula when it denotes a mathematical symbol, and should
be treated as one.
\section{Displayed Text}
Text is displayed by indenting it from the left margin.
Quotations are commonly displayed. There are short quotations
\begin{quote}
This is a short a quotation. It consists of a
single paragraph of text. There is no paragraph indentation.
\end{quote}
and longer ones.
\begin{quotation}
This is a longer quotation. It consists of two paragraphs
of text. The beginning of each paragraph is indicated
by an extra indentation.
This is the second paragarph of the quotation. It is just
as dull as the first paragraph.
\end{quotation}
Another frequently-displayed structure is a list.
The following is an example of an {\em itemized} list.
\begin{itemize}
\item This is the first item of an itemized list. Each item
in the list is marked with a ``tick''. The document
style determines what kind of tick mark is used.
\item This is the second item of the list. It contains another
list nested inside it. The inner list is an {\em enumerated}
list.
\begin{enumerate}
\item This is the first item of an enumerated list that
is nested within the itemized list.
\item This is the second item of the inner list. \LaTeX\
allows you to nest lists deeper than you really should.
\end{enumerate}
This is the rest of the second item of the outer list. It
is no more interesting than any other part of the item.
\item This is the third item of the list.
\end{itemize}
You can even display poetry.
\begin{verse}
There is an environment for verse \\ % The \\ command separates lines
Whose features some poets will curse. % within a stanza.
% One or more blank lines separate stanzas.
For instead of making\\
Them do {\em all\/} line breaking, \\
It allows them to put too many words on a line when they'd
rather be forced to be terse.
\end{verse}
Mathematical formulas may also be displayed. A displayed formula is
one-line long; multiline formulas require special formatting
instructions.
\[ x' + y^{2} = z_{i}^{2}\]
Don't start a paragraph with a displayed equation, nor make
one a paragraph by itself.
\end{document} % End of document.
will produce:
WE REALLY WANT TO KNOW...
Have you found this publication useful? Are there ways we
might improve or supplement it or other ITC publications?
Did you find this document in Web or in hard copy?
We really want your opinion.
Send e-mail to: newsdesk@virginia.edu