TeX PDF and Html Document Production
TEX PDF and Html Document Production


1. Introduction
2. Producing PDF from TEX
2.1 Producing PDF with dvips and Distiller or Ghostscript
2.2 Producing PDF using dvipdfm
3. Producing HTML from TEX Source Files with TtH
4. Graphics and TtH and dvipdfm
4.1 EPS Graphics
4.2 PiCTEX Graphics
4.3 Samples
Resources
1.
Introduction
For course presentation, I have a system for producing TEX (dvi), PDF, and Html versions of documents for students. Examples of exams, notes, and problem solutions are at
http://www.math.uic.edu/~lewis/mtht430/notes.htm
http://www.math.uic.edu/~lewis/hon201/notes.htm
The TEXsoftware I am using is MiKTEX (Versions 1.20e and 2.1.9) on Windows operating systems 95/98/NT/2000¼, with WinEdt as the shell and text editor.


N. B. As of March 10, 2002 at 18:54, my favorite method of producing PDF is dvipdfm .


2.
Producing PDF Files from TEX
Most lab machines and users have the Adobe Acrobat Reader installed as a browser plugin. Printed quality of PDF documents is excellent, but smaller fonts may not be legible on the screen. A PDF version of the document should be available for printing1. The PDF version this document is production.pdf. The Html version of this document is production.htm.
There are several methods for moving a dvi (with various specials) to PDF.
2.1
Producing PDF with dvips and Distiller or Ghostscript
PDF is produced using dvips with the option -Ppdf:
dvips -Ppdf foo.tex
which produces foo.ps with full font information. The option -Ppdf calls the file
/texmf/dvips/config/config.pdf,
which in turn calls for information on the PostScript BlueSky/AMS/Y&Y Type 1 fonts.
In turn, foo.pdf is produced by using Acrobat Distiller2:
¼\Distillr\ACRODIST.EXE "foo.ps"
Encapsulated PostScript graphics are easily handled using epsf.tex. In contrast, the TEX processor PDFTEX is not friendly to EPS graphics.
PiCTEX graphics are handled as easily as mathematics text.
2.2
Producing PDF using dvipdfm
The current MiKTEX distribution includes the filter program dvipdfm, developed by Mark A. Wicks. dvipdfm translates a dvi file to pdf.
Advantages:
·
Several Platforms: dvipdfm is available on several platforms. See
http://gaspra.kettering.edu/dvipdfm/
I have tried Red Hat Linux dvipdfm on Intel and Alpha processors.
·
Hyperlinks: The current version puts the hyperlinks in the PDF file: Try it:
http://gaspra.kettering.edu/dvipdfm/
The TEX code for this example is
\def\href#1#2{ \special{html:<a href="#1 » } { \tt #2 } \special{html:</a>}}
\href{http://gaspra.kettering.edu/dvipdfm/} {http://gaspra.kettering.edu/dvipdfm/}
One must be especially careful with characters which have special and different different meanings in TEX and html. Examples are the tilde ~ (a tie in TEX and the signal for a user in a url) and # (a signal for a macro argument in TEXand a reference to a name in a url).

·
Including EPS graphics: The current version of dvipdfm (0.13.2b) transparently uses Ghostscript to handle EPS graphics files. There is some support for handling JPEG and GIF images. Care must be taken for the program to find the appropriate postscript resources (fonts, ghostscript, ...); I have been unsuccessful in converting EPS graphics to PDF images with the correct bounding box.

·
PiCTEX Graphics: Since PiCTEX uses standard TEX fonts and placements in boxes of various (small) dimensions, dvipdfm converts PiCTEX seamlessly.
3.
Producing HTML from TeX Source Files with TtH
My choice for producing html files is the noncommercial program TtH available at
http://hutchinson.belmont.ma.us/tth/
The program acts as a filter directly on the TEX or LaTEX source file so that a call looks like
¼\tth.exe -u < foo.tex > foo.htm
Production is easily automated with a batch file tth.bat with a line such as
¼\tth.exe -u < %1.tex > %1.htm %2 %3 %4 %5
The option -u forces a unicode option which resolves the problem of properly using the symbol fonts to present mathematics.
The TtH Manual at
http://hutchinson.belmont.ma.us/tth/manual.cgi
suggests several macros to be used in the TEX file.


4.
Graphics and TtH and dvipdfm
4.1
EPS Graphics:
Most of us start with Encapsulated PostScript produced by various programs. Most browsers expect graphics as GIF or JPEG files. Since mathematics papers have line drawings, GIF files are relatively small and contain full information.
Programs such as Maple will also export figures as EPS or GIF - using right mouse clicks. An alternate method to produce GIF files is a capture program such as Hypersnap-DX available at http://www.hyperionics.com
Ghostscript can also produce JPG (and GIF?) files from EPS, but I am not familiar with the details.
If both foopicture.eps and foopicture.gif are available, then the -e2 option on TtH interprets \epsfbox{foopictureo.eps} to embed foopicture.gif as an image:
¼\tth.bat foo -e2
As noted in Section 2.2, dvipdfm used in conjunction with epsf.tex handles EPS graphics transparently.
4.2
PiCTEX Graphics:
TtH does not handle PiCTEX graphics. My method is to use code such as
\tthdump{ . . pictex code .. }
and then capture the image as a gif and use the TtH macro for the html for the image. An excellent preprocessor for PiCTEX is mathsPIC by R. W. D. Nickalls. Version 2.1 of mathsPIC available at
http://www.ctan.org/tex-archive/graphics/pictex/mathspic/.


4.3
Sample EPS Graphics
An example is given:
·
Let f be periodic with period 2p and
f(x) = p- |x|, -p £ x < p
Courtesy of Maple 6 , the Fourier (cosine) polynomial of degree 6 is 3
p/2 +4  cos(x)

p
+4/9  cos(3 x)

p
+ 4

25
  cos(5 x)

p
The graph of f(x) and six Fourier (cosine) polynomials are shown:

production203.gif

Sample PiCTEX graphics:

basipic1.gif

Resources
1.
http://hutchinson.belmont.ma.us/tth/manual.cgi The TtH Manual suggests several macros to be used in the TEX file.
2.
http://www.math.uic.edu/~lewis/tex/index.htm Jeff Lewis's Presenting Mathematics on the Web
3.
http://www.math.uic.edu/~lewis/tex/production.tex TEX source for this document
4.
http://www.math.uic.edu/~lewis/tex/docurl.tex TEX macros for this document using hyperref with TEX and TtH, mostly due to Ian Hutchinson
5.
http://www.math.uic.edu/~lewis/tex/basipic1.tex TEX source for the PiCTEX figure
6.
http://www.math.uic.edu/~lewis/tex/basipic1.m Source processed by MathsPiC to create basipic1.tex source for the PiCTEX figure

Footnotes:

1Some students have told me that PDF produced directly by Adobe's PdfWriter are slow to print if all fonts are not embedded.
2An alternate method is to use the script ps2pdf13.bat installed with Ghostscript 6+. Care must be taken to change the batch files with a program such as unix2dos.exe. Ghostscript 6 - e produces poor fonts for the screen.
3The LaTEX code for this example was produced by Maple.


File translated from TEX by TTH, version 3.77.
On 03 Jan 2007, 15:30.