Publishing latex documents on the web

Publishing latex documents on the web

There are three steps you need to perform in order to publish your latex documents on the web.

First, you have to convert your latex source into a "device-independent" format:

    latex filename.tex
The result is left in filename.dvi

Next, you convert it to PostScript, suitable for printing on most PostScript printers:

    dvips -o filename.ps filename.dvi
Note: You do have to specify the output filename for dvips. Its default action is to send it directly to your default printer.

While PostScript output is useful for viewing (with ghostview) or printing locally, the most portable format for viewing and printing on the web today is PDF (Portable Document Format). Not only is a free PDF viewer/printer available, but PDF files are much smaller than the PostScript files from which they were generated. The program to generate PDF files from PostScript is distill:

    distill filename.ps
The result is filename.pdf, which can be put on the web.

Finally, you should probably clean up your intermediate files:

    rm filename.dvi filename.ps

If you're doing the above process frequently, you might find the following csh alias useful:
    alias latex2pdf 'set TEMP = `echo \!* | sed '"'"'s;\.tex''$'';;'"'"'` ; \
                     latex $TEMP.tex ; \
                     dvips -f < $TEMP.dvi | distill > $TEMP.pdf ; \
                     /bin/rm $TEMP.dvi ; \
                     unset TEMP'
In the alias as defined, a PostScript file is not produced. The PostScript output of dvips is piped directly to distill.

To use the alias, just type

    latex2pdf filename.tex

This page last updated November 19, 2010.