UM Math: VIGRE LaTeX Seminar

This is a quick "how to get started" seminar on using LaTeX. The best way to learn LaTeX is by working with it to write papers that you need to do, so we don't spend too much time explaining things in detail, and instead try to provide an appropriate bank of examples that can be used to see how to do what's needed to really use LaTeX.

An Overview

We use LaTeX by creating a text document with mark-up to tell LaTeX how to format the text. This is like a source file when programming. We then run LaTeX on this to create a DVI (for DeVice Independent) file, which is like the compiled program code. To view this we use an application such as xdvi (in X-windows, at least). We can also convert the DVI file to PostScript to print it with dvips. This is shown in the figure below.

figure showing relation between latex, dvi and ps files

If we're in a Unix environment, we'll be using a series of commands such as the following.

prompt% emacs article.tex &
prompt% latex article
prompt% xdvi article &
prompt% dvips article

Here emacs is an editor used to create the LaTeX text document (we could use vi, pico (the editor in pine), nedit, etc., instead). We use this to edit our file, then latex it to create the DVI file. After viewing this, we're likely to edit it further, re-latex and view it, etc. When we want to print, we use dvips to do that. By default dvips prints the file to its default printer.

Practical Considerations

In general, you'll want to have some sample files to copy, cut-and-paste from, and use as templates. It's a good idea to keep these in a different place than the files that you're editing, so that you don't accidentally butcher them. One way of doing this is to have a latex directory, with a samples subdirectory and a work subdirectory. In a Unix environment, you can make these with the mkdir command:

prompt% mkdir latex
prompt% cd latex
prompt% mkdir samples work

If you're in the LS&A AFS cell at the University of Michigan, you can copy all of the sample files that we have for this seminar into your samples directory by using the following commands (assuming that, left over from the previous commands, you're still in the latex directory):

prompt% cd samples
prompt% cp /afs/lsa/user/g/l/glarose/Public/latex/* ./

Notice the period before the last slash in this command! If you leave it out you'll get an error like cp: cannot create file: Permission denied.

Sample Documents and Instruction

If you have been able to copy the sample files as indicated above, you can latex and xdvi the files that we discuss here to see what they say. If not, click the links for a PDF version.

First, latex and xdvi the file index.tex. (That is, use the commands

prompt% latex index
prompt% xdvi index &

if you put the & at the end of the xdvi command you'll get the shell prompt back and can continue to do things with that.) Or, get the PDF version: index.pdf.

This gives the index of sample files in this seminar, and a reasonable order in which to approach them. You can step through, latex-ing and viewing each. At some point after you've looked at simplest.tex and basicmath.tex, you might want to go over to your work directory and try writing a simple document yourself. Note that you can look at the LaTeX source for all of the sample documents. For those following along without looking at the LaTeX files, the files are:

Note: to actually LaTeX some of these files you will need the "local" style file, local.sty.
You can download this by clicking this link: local.sty file


UM Math: VIGRE LaTeX Seminar
Last Modified: Wed Apr 2 14:41:29 EST 2003
Comments to glarose@umich.edu
©2003 Gavin LaRose, UM Math Dept.