Documentation
LaTeX
Documentation table of contents.
Introduction
LaTeX is a document preparation system based on the TeX typesetting language. It translates a text document with embedded LaTeX commands into a typeset format that can be previewed in X-Windows and OpenWindows, or sent to certain Public IT Printers on campus. LaTeX follows TeX conventions in file format and execution. It also provides a simplified method of generating indexes, tables of content, figures, mathematical symbols, and equations. LaTeX is available on UBUnix.
Setup
Make sure your search path includes the default system search path, and that your MANPATH environment variable includes the default system value for it.
Creating a LaTeX File
LaTeX input is a file containing both the document's
text and commands that describe the format of that text. You can create
a text file with LaTeX commands using a UBUnix editor
such as vi, pico, or Emacs. The file should have the file extension .tex.
For example, the following command will open a text file named report.tex with the Emacs editor:
emacs report.tex
You can override the default extension by typing any file extension in place of .tex.
LaTeX Control Sequences
Commands, also called control sequences, are preceded by the backslash character (\), while comments are preceded by the percent sign (%). Any information entered after the % character will be ignored.
LaTeX also requires a preamble at the beginning of
each file. The preamble defines the style of the document. The style is
specified by the command \documentclass{style},
where style is the type of style
you wish to use in this file. For example, to use the report style, type
the following in your text file:
\documentclass{report}
The control sequence \begin{document} follows \documentclass and begins the body of text. At the end of the document, the control sequence \end{document} is required to end the file.
Certain document styles, such as letter, can begin with an additional begin
control sequence, such as \begin{letter}.
For example, the two control sequences would appear as:
\begin{document}
\begin{letter}
Processing a LaTeX File
To process a text file, use the latex
command from your UNIX prompt. For example, the following command will process
the text file report.tex:
latex report
Note that you do not need to specify the file extension if it is .tex, as LaTeX automatically appends this extension.
The latex command creates two files: a log file and a device independent file. These files have the same root filename as the text file, but have the file extensions .log and .dvi instead of .txt (the files generated in the previous example would be named report.log and report.dvi, respectively).
The .log file contains all messages including error and page count. The .dvi file contains typesetting instructions.
Printing a LaTeX File
Before you can print the output contained in a .dvi file, you must first convert it to PostScript code. You may then print the PostScript (.ps) file at any computing area printer.
To convert a .dvi file to a .ps
file, type the following at your UBUnix prompt:
dvips filename.dvi -o filename.ps
filename.dvi is the name of the
.dvi file you wish to convert. For
example, to convert the file report.dvi
to PostScript, you would type:
dvips report.dvi -o report.ps
To print the converted .ps file,
you would then type:
lpr -Pprinter filename.ps
printer is the name of the Public IT printer, and filename.ps
is the name of the file you wish to print. For example, to print the file
report.ps to the laser printer in
Bell 101, you would type the following from your UBUnix prompt:
lpr -Pbell report.ps
A Sample LaTeX File
The following is an example of a LaTeX file named
example.tex:
\documentclass [11pt] {letter}
\begin{document}
\begin{letter} {Mr. G. Electric
\\Wheatstone Inc.\\33 Circuit Dr.\\
Corporation, California 02019}
\address{Mr. J. Powers\\Buffalo Lighting Co.
\\33 Washington St.\\Bison, New York 14230}
\signature{James Powers\\
President, Buffalo Lighting Co.}
\opening{Dear Mr. Electric:}
The power grid at 33 Washington St. has
failed due to an explosion of your
supermagneto transformer. We would
like you to repair it as per
your warranty stipulation.
\closing{Best regards,}
\cc{VP JES}
\end{letter}
\end{document}
You can then run LaTeX by typing the following at
your UNIX prompt:
latex example
LaTeX will output information
to your screen, including such items as the number of pages processed and
the number of errors incurred. The information will appear similar to:
This is TEX, Version 3.1415 (C Version 6.1)
(example.tex
LATEX2e <1994/12/01> patch level 1
(/util/TEX3.14/lib/texmf/tex/latex2e/base/lette.cls
Document Class: letter 1994/12/11 v1.2p
Standard LATEX document class
(/util/TEX3.14/lib/texmf/tex/latex2e/base/
size11.clo))(example.aux) [1]
(example.aux) )
Output written on example.dvi (1 page, 920 bytes).
Transcript written on example.log.
To print the example.dvi file, follow the instructions in the section Printing a LaTeX File.
Style Files
The following is a list of some documentation styles. Style files contain specific macros for use with particular styles of documentation. These .sty files are found in the directory /util/TeX3.14159/lib/texmf/tex/latex209/base.
| Style | Description |
|---|---|
| article.sty | Basic article style |
| bezier.sty | Bezier curves |
| book.sty | Basic book style |
| fleqn.sty | Fixed left margin equation numbers |
| ifthen.sty | If-then conditionals |
| leqno.sty | Normal left margin equation numbers |
| letter.sty | Business letter style |
| ltugbot.sty | TEX Users Group (TUGboat) LATEX macros |
| makeidx.sty | Creates indices |
| openbib.sty | Open bibliography style |
| report.sty | Basic report style |
| showidx.sty | Displays indices |
| titlepag.sty | Creates a title page |
| twocolumn.sty | Text in two columns |
| resume.sty | Layout for a resume |
Additional Information
To access online help for the latex
command, type the following at your UBUnix prompt:
man latex
For an explanation of control sequences, document styles, and creating your own document styles, refer to the book LaTeX: A Document Preparation System, by Leslie Lamport, published by Addison-Wesley.
For more information on the lpr command, see the CIT document UNIX Printing.

