Operating System Information --> Unix (WAM and Glue) --> Unix Utilities --> UNIX: How To Convert And Print TeX/LaTeX Documents -->

UNIX: How To Convert And Print TeX/LaTeX Documents

These are the steps necessary to convert a TeX or LaTeX document from the original source to a readable/printable form on the OIT Unix systems. Some of the steps detailed below will be slightly different on different Unix platforms. Differences will be noted wherever possible.

To determine if the document is a TeX or LaTeX document, you need to examine the first few lines. (Note: There are two versions of LaTeX; the original, and since July 1995 the newer LaTeX2e.) All Unix TeX and LaTeX documents should follow the naming convention of:

    filename.tex

where filename is any descriptive name you wish to give the file. The "tex" extension is the same for both TeX and LaTeX.

If the first line is one of:

    Older version of LaTeX - LaTeX v.209:

    /documentstyle{xxxx}
    /documentstyle[yyyy]{xxxx}
         or

    Current version of LaTeX - LaTeX2e:

    /documentclass{xxxx}
    /documentclass[yyyy]{xxxx}

where xxxx will be some format of document (like "article", "report" "book" etc.), and yyyy will be typesetting or page-format information (like "12pt" or "twocolumn"), then you're dealing with a LaTeX document. (Note: There is a difference in the first lines above; documents that begin with "documentstyle" are in the older LaTeX format, those which begin with "documentclass" are in the newer LaTeX2e format. LaTeX2e formatters should be backwards-compatible for the older LaTeX commands.)

If the first line does NOT contain a line similar to one of the lines above, it is a TeX document.

To use either TeX or LaTeX on the WAM or Glue systems, you must first tap them. This sets up environment variables and adds the path to the software for the user, simplifying the steps necessery to run many packages. To do this, type:

    tap  tetex

You'll get a brief blurb on recent TeX/LaTeX announcements, like user group info, mailing lists, package version info, etc.

To format either a TeX or LaTeX document, the general process is the same. You first run it through the appropriate formatter which creates a DVI (DeVice Independent) output file. This file is then converted into the printing/viewing format which best suits your local environment; the local favorite seems to be PostScript.

To format a TeX document, you type:

    tex  filename.tex

where filename is the name of your command file (with the ".tex" extension). This will create two new files, one named filename.log and the other named filename.dvi. The log file is just a record of the formatting process, including any error messages needed for debugging. The dvi file is the file containing the eventual product.

To format a LaTeX document, you type:

    latex  filename.tex

where filename is the name of your command file (with the ".tex" exten- sion). This will create several new files, including filename.log, filename.dvi, filename.aux and possibly others like filename.toc, etc. The log and dvi files serve the same purpose as above, the aux file is an auxiliary log file, and other files like the toc file will have additional information necessary for the final formatting.

At this point, how you deal with the files depends upon what platform you are using. Some, like Xwindows, have a DVI previewer; if so, you can load the DVI file into this for viewing/printing. To do so you can usually find the icon for the DVI file using your file viewer and double-click on it, or in the case of WAM and Glue, you can type:

    xdvi filename.dvi

For those working in text-only windows, the next step would be to convert the file into a format that can be dealt with. At UMCP this generally means to convert it to PostScript format for printing. To do this, you can use a conversion command; they're usually named "dvips" or "dvi2ps". To check to see which is available, use the 'which' command:

    which dvips

If the program exists, the full pathname will be given. It currenty lives in the directory tree where the tex and latex commands live, and will only be available if you run the tap tetex command shown above.

To use the 'dvips' command, you type:

    dvips  filename.dvi  -o 

or:

    dvips  filename.dvi  -o  filename.ps

or:

    dvips  filename.dvi | qpr -q queue

If you use the first form, the "-o" says to put the output PostScript into a file with the same (filename) as the DVI file. For example, if the input DVI file were named "testfile.dvi", the resulting PostScript file would be "testfile.ps". If you use the second form, you can rename the PostScript file to be anything you wish. (I would suggest using the ".ps" extension to remind you it's a PostScript file.) If you use the third form, it will send the PostScript output directly to the printer denoted by queue. This assumes that queue is a valid print queue on your system. (I would suggest only doing this for a last draft, once most/all of the errors are eliminated.)

If you use either of the first two methods above, you'll have the PostScript version of the file in "filename.ps", but you'll still need to print it to see what it says and how it looks. To print a PostScript file you can use the 'qpr' command shown above:

    qpr  -q  queue  filename.ps

where queue is a valid PostScript print queue for your system.

Click here for information on WAM print queues.

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology Help Desk Web Site University of Maryland Web Site Office of Information Technology Web Site