Here there will be a short primer on how to write and use LaTeX, should you choose to do so for your papers.
TeX is a typesetting language, it was invented in 1983 by Donald Knuth for the express purpose of lay out for mathematical writing. It is effectively a mark up language, similar in many ways to HTML, though it predated HTML by a decade.
TeX is free, Knuth donated it to the American Mathematical Society, and can be obtained from the web for installation. It is available on the departmental machines.
URL PCTeX
or the tex-archive mirror
Install at own peril!
LaTeX is an extended version of TeX, it can be thought of as TeX with the addition of some powerful macros, it is to TeX somewhat like C++ is to C.
TeX/LaTeX is an interpreted language, and is used to mark up text for presentation. It is not a wordprocessor or an editor, nor is it a web layout language. (TeX is a general purpose language, essentially any algorithm can be implemented in it, just not very efficiently, unless you are laying out a page of mathematical text).
LaTeX is used extensively for publication of papers and preprints in the physical sciences. In astronomy, astrophysics, theoretical and modern physics, and mathematics, TeX or LaTeX are by far the dominant way of putting together papers, books and other documents.
As in HTML, TeX reserves some characters to indicate commands. The important ones are
In addition, LaTeX reserves the "@" symbol.
To use LaTeX you first create a text file using your favourite editor or word processor (see below).
So you create some file "foo.tex".
You will be using LaTeX, so you start off by marking up the file
\documentstyle[12pt,epsf]{article}
- this invokes the command "documentstyle", asking for use 12 point fonts
and the encapsulated-postscript-file macro to load figures.
- you then invoke the argument "article" to tell documentstyle what
kind of document this will be (as opposed to, say, "memo" or "book").
you then have
\begin{document}
%
%THE ENTIRE TEXT OF YOUR DOCUMENT GOES HERE - see sample
%
%lines that begin with a "%" sign are assumed to be comments and are not interpreted by TeX
%
\end{document}
A key feature of TeX is "math-mode". This is toggled on and off using
the "$" symbol.
Any text bracketed by a pair of "$" symbols is assumed to be an equation
or similar, and is laid out in a manner appropriate to mathematical notation
rather than text.
For example, $1 + 1 = 2$, sets out an equation.
You now have a file, "foo.tex", containing some text, some equations, and maybe some figures and references.
(I implicitly assume below that you are using a Unix workstation, PCs do this slightly differently in a way that should be obvious :-) )
To use TeX, you now type:
latex foo
LaTeX will probably complain about a number of errors, including
failure to close {} pairs, or $ ... $ pairs, or illegal commands.
Fix the errors and run latex again.
(I recommend running latex frequently as you create a tex file,
so as to catch such errors as they happen, and not get multiple
error message in one big pile).
latex will now likely complain that it can not match the citations
with the references.
This is a feature, not a bug.
The first time
latex is run it assembles the data base of references, the second
time it is run it matches them to the citations.
So run latex again:
latex foo
If all goes well, there should now exist three new files: "latex.log", "latex.aux"
and "latex.dvi".
Ignore the first two. latex.dvi is the "device-independent" file that
now carries the layout information you have put into your document.
.dvi files can be "previewed" using tools like "xdvi" (on Unix workstations).
So type:
xdvi foo
This should display a WYSIWYG (What You See Is What You Get) version
of your document, ready for printing.
If you don't like what you see, go back and change it.
sometimes dvi files can be printed directly with "print foo.dvi", but generally you want to convert it to a printable postscript file first. This also incorporates any postscript figures loaded into the file.
To make a postscript file, run the program "dvips" (dvi-to-postscript program).
dvips -f foo.dvi > foo.ps
This tells dvips to take the file foo.dvi and redirect the translated output to a file dvi.ps
It is best to preview the postscript file before printing it. ghostview is one of many postscript viewers:
gv foo.ps
should bring up the image of the set document on your screen for
a final check.
You can now print the foo.ps file, discover the silly mistake on
page 3 that you didn't spot during the preview, go back and fix
it and do it all over again...
Here is a sample LaTeX text file ready to be run under LaTeX. This file was successfully interpreted on muon.astro.psu.edu.
Here is a sample dvi file showing what the output is.
Here is a sample postscript file showing what it looks like printed.
If nothing I said make sense, maybe someone else can explain it better.
Here is Brian Edmonds LaTeX guide
and here is David Wilkin's ``Getting Started with LaTeX'' guide on the web.
Here is yet another guide for beginners, the parent site may also be of use.
Last updated 01/02
Back to the top of my home page.