Using LATEX on UNIX Systems
There are three steps to using TEX or LATEX on Linux, Cygwin, and other UNIX environments:
- 1.
- Prepare your TEX or LATEX file using a UNIX editor, such as
emacs, vi or gedit.
- 2.
- Process the file by running TEX, LATEX, or pdfLATEX.
- 3.
- Preview and/or print the result.
Prepare your source file using your favorite UNIX editor,
giving it a name that ends with the extension .tex
(for example, myfile.tex). The file will contain both your
text and the TEX or LATEX commands to format the text.
If you are unfamiliar with
TEX and LATEX, we recommend learning LATEX. To get started,
see the LATEX training web page, http://www.rpi.edu/dept/arc/training/latex/,
and pick up Memo RPI109, Text Formatting with LATEX, at the VCC Help
Desk or from the web.
If you are planning to write a thesis, be sure to view the LATEX thesis
web page at
http://helpdesk.rpi.edu/update.do?artcenterkey=325
and read the recommended documentation, especially
ARC Memo 110, Preparing a Thesis with LATEX, and
Creating a PDF File from a LaTeX Thesis.
The commands below illustrate how to process an example file called myfile.tex,
preview the result on your
screen, and prepare a PostScript or PDF file for printing.
The following commands assume that the
file myfile.tex contains your LATEX (or TEX) code. Note
that the filename extensions .tex and .dvi are optional
when running TEX-related programs.
latex myfile Note that you may omit the .tex extension.
or
tex myfile Output from TEX or LATEX will be placed in the file myfile.dvi.
or
pdflatex myfile Out from pdfLATEX will be placed in myfile.pdf.
xdvi myfile & Displays output on the screen.
Note that you may omit the .dvi extension.
dvips myfile Processes myfile.dvi, putting PostScript output in myfile.ps.
dvips myfile -o If the above command sends the output to the default printer,
append -o to put output in the file myfile.ps.
You can use the -pp option on the
dvips command to process selected pages from the .dvi file:
dvips -pp6-9 myfile [-o] Puts pages 6 through 9 in the file myfile.ps.
When the TEX or LATEX encounters a syntax error, it will emit an
error message
ending with a ``?'' prompt. The most common way to respond is either to press
Return to continue and hope for the best, or to type
x to exit the program, fix the error, and try again.
If the program stops with a * prompt, it is awaiting input
from you. It usually means you have forgotten to end the document.
For LATEX enter \end{document}; for TEX enter \end.
If the program does not recognize the name of the input file you specified,
It will stop and ask you for another filename. If you don't want to
enter a new filename at this point, you can quit the program by pressing
Ctrl-d (that is, hold down the Ctrl key, press "d", and
then release both
keys). This sequence can be used any time to
stop LATEX or TEX in the middle of its execution.
If you sometimes have formatting requirements which are not handled easily
by the core LATEX program, you may be able to solve your problem by
using a LATEX package. Many enhancements to LATEX
are provided by packages. Some packages, for example the graphicx package for including graphics files, are part of every LATEX distribution; many others are almost always included;
and some less frequently-used packages can be downloaded if needed.
A package consists of one or more files that contain extra definitions and macros. The file names usually have the extension .sty.
To use a package, you must first load it in your preamble with a command of the form:
\usepackage{package}
To find out about the packages available, see The TEX Catalogue Online at
http://texcatalogue.sarovar.org/.
The LATEX training web page, http://www.rpi.edu/dept/arc/training/latex/, has many links to useful documents including an FAQ, a longer tutorial more complete than Memo RPI.109, further information on math, lists of symbols, and the graphics examples listed below.
For a short explanation and examples on including graphics, see:
http://www.rpi.edu/dept/arc/training/latex/Examples/graphics.pdf
and be sure to view the following .tex file to see the commands used to create it:
http://www.rpi.edu/dept/arc/training/latex/Examples/graphics.tex
The example file exrotating.pdf and it's corresponding LATEX file exrotating.tex show how to include landscape figures and tables:
http://www.rpi.edu/dept/arc/training/latex/Examples/exrotating.pdf
http://www.rpi.edu/dept/arc/training/latex/Examples/exrotating.tex
Official documentation for the LATEX's graphics bundle is in grfguide.pdf;
look for it on your system.
The information on the graphicx package is in Section 4.4.
For an exhaustive treatment of including graphics,
see Using Imported Graphics in LATEX2e. You can
find it at http://www.ctan.org/tex-archive/info/epslatex.pdf.
Published by Academic and Research Computing, RPI, Troy, NY 12180
Send comments to consult@rpi.edu.