TeX and LaTeX


TeX and LaTeX (pronounced "tech" and "lay-tech") are high quality typesetting languages which do an especially fine job of printing mathematical documents.


Watch TeX do a perfect job with one of my class handouts, DFAs.tex, and its helping file epsf.def. Place both files into the same directory and cd into that directory. The command

tex DFAs.tex

produces a device independent image file DFAs.dvi. Then use the command

xdvi DFAs.dvi

to image and admire the .dvi file. The command

dvips -t Letter DFAs.dvi

sends equivalent postscript code to the default printer, and

dvips -t Letter -f DFAs.dvi > DFAs.ps
gv DFAs.ps

creates a postscript file and then views it with Ghostview. The ps file can be printed by clicking on a button inside Ghostview. The -t Letter flag is necessary with dvips, since its default seems to be A4 paper size, as was the case with a2ps.

Notice that this TeX file has an included file epsf.def (although it was not needed in this case). This included file happens to be in the active directory alongside DFAs.tex, but such input files can go almost anywhere. Just use TeX input commands such as

\input /home/parrish/epsf.def

within the TeX document.


LaTeX is an alternative to TeX which is becoming something of a standard for preparing computer science reports and manuscripts.

Create a new directory called latex (or something), and put the file sample.tex into it. This sample file and the following sequence of instructions come from the O'Reilly book Running Linux

Now cd into the new directory and execute the command

latex sample

You should now have .aux, .dvi, and .log files in that directory

Execute the command

xdvi sample

and ignore lots of messages from metafont. Voilá! You can create a postscript file with this command:

dvips -o sample.ps sample.dvi

The new file sample.ps should apppear in your directory. Print it like this:

lpr sample.ps

or use Ghostview to preview and print the postscript file as we did in the first example.