Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Appendix C: Commands, errors, and viewing

Section 4: Screen preview

Once you have typeset your document without errors (or even if there are still errors, but you want to see what it’s doing with them), most processors (XƎLATEX, PDFLATEX, etc) will have created a PDF file and most editors will pop up a PDF viewer so you can see what the results are. In this case you can skip to § C.4.3.

However, standard (‘old’) LATEX will have created a DVI (DeVice-Independent) file. This was TEX’s original format from the days before PDF and Postscript, but it is still popular with some users. Again, most editors will pop up a DVI viewer so you can see what the results are, but if you are working from the command-line, you need to run it yourself.

C.4.1 Previewing DVI output

To see the typeset output from the command-line, type the name of a suitable DVI viewer followed by the name of your document (without the filetype extension). Common viewers are yap (Windows) and xdvi (UNIX and GNU/Linux systems, including Apple Macintosh OS X; on a Mac you need to install XQuartz to run xdvi). A WYSIWYG preview window will appear with your typeset display (see Figure C.3).

Figure C.3: DVI preview


Most previewers have a wide range of scaling, zooming, and measuring functions, but as this is a picture of your output, you cannot edit the image. To change it, you edit your source document and reprocess it.

With xdvi and its derivatives like dviview, you can leave the display window open, and after you’ve reprocessed your document through LATEX, moving your mouse back into the window will make the display update automatically (click your mouse if your windowing system needs a click to focus).

Figure C.3 shows xdvi displaying a page. With a standard three-button mouse you get three levels of micro-zoom to let you inspect fine details.

C.4.2 Previewing with PostScript

PostScript is a page description programming language invented by Adobe and used in laser printers and high-end typesetters. It’s been the universal standard for electronically-formatted print files for nearly two decades, and all printers and publishers have been accustomed to using it. PDF is a descendant of PostScript, and as largely taken over, but PostScript itself is still quite common, partly because it is very robust, and is usually an ASCII file, which makes it very portable and easy to generate. The drawback is the large size of PostScript files, especially if they contain bitmapped graphics.

The dvips program which comes with all TEX distributions is used to generate PostScript files directly from your DVI output. These .ps files can be viewed, printed, sent to a platemaker or filmsetter, put online for downloading, or converted to PDF.

DVI viewers cannot render some PostScript graphical manipulations like rotating and deforming, so an alternative to viewing the DVI file direct is to generate a PostScript file and use a PostScript viewer. You may have to to do this for your publisher anyway, and many editors can be configured to do this by default. Look for a dvips toolbar icon or menu entry and click on it.

It’s also very simple to do from the command-line: let’s assume your LATEX file was called quickstart.tex, so processing it has created quickstart.dvi. Just type

dvips -o quickstart

in a command window, and dvips will create which can be used both for previewing and printing, or converted into or out of PDF with the ps2pdf and pdf2ps utility programs which should have been installed automatically along with your TEX system..

To view a PostScript file, you need a PostScript previewer like GSview, which works with the PostScript interpreter Ghostscript, which should also have been installed automatically along with your TEX system (if not, install both now: GSview is separately licensed and cannot legally be included in some older TEX distributions, so you may have to download it yourself).

Like xdvi, GSview can be set to watch the PostScript file and automatically update the display any time the file is changed, without you having to click on the window.

C.4.3 Previewing with PDF

The PDF is a derivative of PostScript. Whereas PostScript is a real programming language in itself, PDF is in effect the result of processing a document through PostScript: it’s a binary file format, extremely compact, and well-supported on all platforms.

If your system is configured to generate PDF files direct instead of DVI files, just open the .pdf file using any PDF viewer by typing the name of the viewer followed by the name of your document (without the filetype extension).

Adobe’s Acrobat Reader cannot automatically update its display in the way that xdvi and GSview can, when you reprocess your document. You have to close the display with Ctrl--W and reload the file with Alt--F1. If you are using it direct from within your editor instead, this closing and opening should be done for you.

Bitmap preview fonts in Acrobat Reader

Acrobat Reader is poor at rendering Type 3 bitmap fonts. If you are using these you will see a very fuzzy display at low magnifications. It will print perfectly, but Acrobat Reader’s display is disappointing. The solution is to use a better previewer or to upgrade to the Type 1 versions of the fonts if possible, or both. If you need to use Type 3 fonts in PDFs, you probably need to warn your readers to expect a fuzzy display from Acrobat Reader (but good printout), and to change to a better reader if they can.