\newif\iftth
\input docurl
\overfullrule0pt
\parindent0pt
\magnification=1200
\vsize=9.5truein
\hsize=6.5truein
\newcount\probno\probno0
\def\advprob{\advance\probno by1\null}

\newif\iftth
\long\def\tthdump#1{#1}
 \tthdump{\footline{\tt \hfill \jobname.tex}}
%%%%%%%%%%%%%\iftth{q81999.htm}\fi
%% \def\href#1#2{{\tthdump{\catcode`\~=11}\special{html:<a href="#1">}{\tt #2}\special{html:</a>}}}
 \def\hname#1#2{\special{html:<a name="#1">#2</a}}
\iftth\special{html:<title>}TeX PDF and Html Document
Production\special{html:</title>}\fi
 \special{pdf: docinfo << /Author (Jeff E. Lewis) /Title (TeX PDF and Html Document
Production) >>}
\def\hrefimg#1{\special{html:<p><center><img src="#1" alt="#1"></center></p>}}
%\newif\ifpdf
\newcount\probno\probno0
\def\prob{\advance\probno by 1 \item{\the\probno.}}%%%\the ignored by tth
%\ifx\pdfoutput\undefined
%  \pdffalse % we are not running PDFLaTeX
%\else
%  \pdfoutput=1 % we are running PDFLaTeX
%\pdftrue \fi
\def\frac#1#2{{{#1}\over{#2}}}
\def\dfrac#1#2{\displaystyle{{#1}\over{#2}}}
\def\mpar#1{\left(#1\right)}
\def\dint{\displaystyle\int}
\def\bulletitem{\item{$\bullet$}}
\def\abs#1{\left|#1\right|}
\magnification=\magstep1 \baselineskip=15pt
\parindent0pt\nopagenumbers
%%%%%%%%%%%%%%%My attempt at a Table of Contents
\def\dvipdfm{{{\tt dvipdfm }}}
\probno0

{\centerline{\bf {\TeX} PDF and Html Document Production}}

\bigbreak %%%\href{production.dvi#PDFfromTeX}{PDFfromTeX}

\def\typ#1{{\tt #1}}


\hypertarget{top}{}


\iftth \href{#intro}{1. Introduction}
 \else
 %\href
 {\href{#intro}{1. Introduction}} \fi

\iftth
\href{#prodpdf}{2. Producing PDF from \TeX}
\else
\url{\href{#prodpdf}{2. Producing PDF from \TeX}}
\fi

\iftth
\href{#gsdistill}{2.1 Producing PDF  with dvips and Distiller or Ghostscript}
\else
\url{\href{#gsdistill}{2.1 Producing PDF with dvips and Distiller or Ghostcript}}
\fi


\iftth \href{#dvipdfm}{2.2 Producing PDF using \dvipdfm} \else
\url{\href{#dvipdfm}{2.2 Producing PDF using \dvipdfm}} \fi

 \iftth \href{#tth}{3. Producing HTML from {\TeX} Source Files with
TtH}
  \else \url{\href{#tth}{3. Producing HTML from {\TeX} Source
Files with TtH}}
 \fi

\iftth \href{#tthgraphics}{4. Graphics and TtH and \dvipdfm} \else
\url{\href{#tthgraphics}{4. Graphics and TtH and \dvipdfm}} \fi


\iftth
\href{#epsgraphics}{4.1 EPS Graphics}
\else
\url{\href{#epsgraphics}{4.1 EPS Graphics}}
\fi

\iftth
\href{#pictexgraphics}{4.2 {PiC\TeX} Graphics}
\else
\url{\href{#pictexgraphics}{4.2 {PiC\TeX} Graphics}}
\fi


\iftth
\href{#samples}{4.3 Samples}
\else
\url{\href{#samples}{4.3 Samples}}
\fi

\iftth
\href{#resources}{Resources}
\else
\url{\href{#resources}{Resources}}
\fi




\probno0


\hypertarget{intro}{\item{{\bf 1.}}}
{\bf 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


%%%% \centerline{\href{http://www.math.uic.edu/math180/samples.htm}
%%%%{http://www.math.uic.edu/math180/samples.htm}}


% and

\iftth \centerline{
 \href{http://www.math.uic.edu/~lewis/mtht430/notes.htm}
 {http://www.math.uic.edu/\~{}lewis/mtht430/notes.htm}}
\else
 {\tthdump{\catcode`\~=11}
\centerline{
 \href{http://www.math.uic.edu/~lewis/mtht430/notes.htm}
 {http://www.math.uic.edu/~lewis/mtht430/notes.htm}}}
\fi




\iftth \centerline{
 \href{http://www.math.uic.edu/~lewis/hon201/notes.htm}
 {http://www.math.uic.edu/\~{}lewis/hon201/notes.htm}}
\else
 {\tthdump{\catcode`\~=11}
\centerline{
 \href{http://www.math.uic.edu/~lewis/hon201/notes.htm}
 {http://www.math.uic.edu/~lewis/hon201/notes.htm}}}
\fi



The \TeX software I am using is
\href{http://www.miktex.org}{MiK\TeX} (Versions 1.20e and 2.1.9) on
Windows operating systems  95/98/NT/2000$\ldots$, with WinEdt as the
shell and text editor.

\bigbreak


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

\bigbreak

%%\tthdump{\hname{PDFfromTeX}{\bf Producing PDF Files from \TeX}}


%%\advprob\hypertarget{\the\probno}{\item{\the\probno.}  Producing PDF Files from \TeX}

%%%%%%%%\hreftop

\hypertarget{prodpdf}{\item{2.}}
{\bf  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
printing\footnote{${}^{1}$}{Some students have told me that PDF
produced directly by Adobe's PdfWriter are slow to print if all
fonts are not embedded.}. The PDF version this document is
\href{production.pdf}{production.pdf}.
The Html version of this document is \href{./production.htm}{production.htm}.%%

There are several methods for moving a dvi (with various specials)
to PDF.


\hypertarget{gsdistill}{\item{2.1}}
{\bf  Producing PDF with dvips and Distiller or Ghostscript}

 PDF is produced using dvips with the
option {\tt -Ppdf}:

{\tt dvips -Ppdf foo.tex}

which produces {\tt foo.ps} with full font information. The option {\tt
-Ppdf} calls the file

\centerline{{\tt /texmf/dvips/config/config.pdf},}

which in
turn calls for information on the PostScript
BlueSky/AMS/Y\&Y Type 1
fonts.

In turn, {\tt foo.pdf} is produced by using Acrobat
Distiller\footnote{${}^{2}$}{An alternate method is to use the script
\typ{ps2pdf13.bat} installed with Ghostscript $6+$. Care must be taken
to change the batch files with a program such as {\tt unix2dos.exe}.
Ghostscript $6 - \epsilon$ produces poor fonts for the screen. }:

\typ{$\ldots$$\backslash$Distillr$\backslash$ACRODIST.EXE
"foo.ps"}

Encapsulated PostScript graphics are easily handled using
\typ{epsf.tex}. In contrast, the \TeX{} processor PDF\TeX{} is not
friendly to EPS graphics.

PiC\TeX {} graphics are handled as easily as mathematics text.


\hypertarget{dvipdfm}{\item{2.2}} {\bf  Producing PDF using \dvipdfm}

The current {MiK\TeX}   distribution includes the filter program {\tt
dvipdfm}, developed by Mark~A. Wicks. \dvipdfm translates a dvi file to
pdf.

Advantages:

\bulletitem{\bf Several Platforms:} {\dvipdfm}  is available on
several platforms. See

\centerline{
\href{http://gaspra.kettering.edu/dvipdfm/}{http://gaspra.kettering.edu/dvipdfm/}}

I have tried Red Hat Linux {\tt dvipdfm} on Intel and Alpha processors.

\bulletitem {\bf Hyperlinks:} The current version puts the
hyperlinks in the PDF file: Try it:

 \centerline{
\href{http://gaspra.kettering.edu/dvipdfm/}{http://gaspra.kettering.edu/dvipdfm/}}

The {\TeX} code for this example is
%%\footnote{$\dag$}{Special care
%%must be taken to change the category code of characters such as
%%\#. }

{\tt
 $\backslash$def$\backslash$href\#1\#2$\left\{\right.$
 $\backslash$special$\left\{\right.$html:<a
 href="\#1\char'034>
 $ \left.\right\}$
 $\left\{\right.$
 $\backslash$tt
 \#2
 $\left.\right\}$
 \iftth\else\hfill\par\fi
 $\backslash$special$\left\{\right.$html:</a>$\left.\right\}$$\left.\right\}$
}

{\tt
$\backslash$href$\left\{\right.$http://gaspra.kettering.edu/dvipdfm/$\left.\right\}$
\hfill\iftth\else\par\fi$\left\{\right.
$http://gaspra.kettering.edu/dvipdfm/$\left.\right\}$
 }

 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
 {\TeX}and a reference to a name in a url).

 \medbreak

 \bulletitem {\bf Including EPS graphics:}
 The current version  of {\tt 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.

 \medbreak

 \bulletitem{\bf {PiC\TeX} Graphics:}
 Since {PiC\TeX} uses standard {\TeX} fonts and placements in boxes of various
 (small) dimensions,
  {\tt dvipdfm} converts {PiC\TeX} seamlessly.


\hypertarget{tth}{\item{3.}}
{\bf  Producing HTML from TeX Source Files with TtH}

My choice for producing html files is the noncommercial program
{TtH} available at

% \iftth
 \href{http://hutchinson.belmont.ma.us/tth/}{http://hutchinson.belmont.ma.us/tth/}
% \else\typ{http://hutchinson.belmont.ma.us/tth/}\fi.

 The program acts as a filter directly on the
\TeX{} or La\TeX{} source file so that a call looks like

{\tt$\ldots\backslash$tth.exe -u $<$foo.tex $>$foo.htm}

Production is easily automated with a batch file \typ{tth.bat}
with a line such as

{\tt$\ldots\backslash$tth.exe -u $<$\%1.tex $>$\%1.htm \%2 \%3 \%4
\%5}

The option {\tt -u} forces a {\it unicode\/} option which resolves
the problem of properly using the symbol fonts to present
mathematics.


The TtH Manual at
%\iftth
$$ \hbox{\rm\href{http://hutchinson.belmont.ma.us/tth/manual.cgi}
 {http://hutchinson.belmont.ma.us/tth/manual.cgi}}$$
 %\else\typ{http://hutchinson.belmont.ma.us/tth/manual.cgi}
 %\fi
  suggests several macros to be used in the
\TeX{} file.

\bigbreak

\hypertarget{tthgraphics}{\item{4.}}
{\bf  Graphics and TtH and {\tt dvipdfm}}


\hypertarget{epsgraphics}{\item{4.1}}
{\bf 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 {\it 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 {\it Hypersnap--DX}
 available at
 %%\iftth
 \href{http://www.hyperionics.com}{http://www.hyperionics.com}
 %%\else \typ{http://www.hyperionics.com}\fi.

 Ghostscript can also produce JPG (and GIF?) files from EPS,
  but I am not familiar with the details.

 If both \typ{foopicture.eps} and \typ{foopicture.gif} are available,
 then the \typ{-e2} option on TtH interprets
 \typ{$\backslash$epsfbox$\{$foopictureo.eps$\}$} to embed \typ{foopicture.gif}
 as an image:

 {\tt$\ldots\backslash$tth.bat foo -e2}

 As noted in Section 2.2, {\tt dvipdfm} used in conjunction with {\tt
 epsf.tex} handles EPS graphics transparently.


\hypertarget{pictexgraphics}{\item{\bf 4.2}}
{\bf PiC\TeX{} Graphics:}

TtH does not handle PiC\TeX{} graphics. My method is to use code
such as

\typ{$\backslash${}tthdump$\{$ . . pictex code ..$ \}$}

\noindent and then capture the image as a gif and use the TtH
macro for the html for the image. An excellent preprocessor for
{PiC\TeX} is mathsPIC  by R.~W.~D.~Nickalls. Version 2.1 of mathsPIC
available at

\centerline{
\href{http://www.ctan.org/tex-archive/graphics/pictex/mathspic/}
{http://www.ctan.org/tex-archive/graphics/pictex/mathspic/}.}


 \bigbreak


\hypertarget{samples}{\item{\bf 4.3}}
{\bf  Sample EPS Graphics}

 An example is given:
 \bulletitem Let $f$ be  periodic with period
$2\pi$ and
 $$f(x) = \pi - \abs{x}, -\pi \leq x < \pi
 $$

 Courtesy of {\it Maple 6\/},
  the Fourier (cosine) polynomial of degree 6 is%
 \footnote{${}^3$}{The {La\TeX}
  code for this example was produced by Maple.}
  $$\pi/2 +4\,{\frac {\cos(x)}{\pi }}+4/9\,{\frac {\cos(3\,x)}{\pi }}+{
\frac {4}{25}}\,{\frac {\cos(5\,x)}{\pi }}$$



  The graph of $f(x)$ and six Fourier (cosine) polynomials
 are shown:
$$
 \tthdump{\epsfbox{production203.eps}}
 \iftth\hrefimg{production203.gif}\fi
$$

Sample {PiC\TeX} graphics:

 \iftth
 \hrefimg{basipic1.gif}
  \else
  \input basipic1.tex
  \fi


\vfill \eject

\hypertarget{resources}{}
{\bf Resources}

\probno0


\prob
 \href{http://hutchinson.belmont.ma.us/tth/manual.cgi}
 {http://hutchinson.belmont.ma.us/tth/manual.cgi}
The TtH Manual suggests several macros to be used in the {\TeX}
file.

\prob
 \href{./index.htm}{http://www.math.uic.edu/\~{}lewis/tex/index.htm}
 Jeff Lewis's Presenting Mathematics on the Web

\prob
\href{./production.tex}{http://www.math.uic.edu/\~{}lewis/tex/production.tex}
{\TeX} source for this document

\prob
\href{./docurl.tex}{http://www.math.uic.edu/\~{}lewis/tex/docurl.tex}
{\TeX} macros for this document using hyperref with {\TeX} and
{\tt TtH}, mostly due to Ian Hutchinson

\prob
\href{./basipic1.tex}{http://www.math.uic.edu/\~{}lewis/tex/basipic1.tex}
{\TeX} source for the {PiC\TeX} figure

\prob \href{./basipic1.m} {
http://www.math.uic.edu/\char`~lewis/tex/basipic1.m} Source
processed by {MathsPiC} to create {\tt basipic1.tex} source for
the {PiC\TeX} figure







\bye


\iftth
\href{./file.htm#name}{./file.htm#name}
\else
\url{\href{./file.pdf#name}{./file.pdf#name}}
\fi
