exit Q/A

### Q/A

Addresses of PNG Files
∙ How PNG ﬁles Are Created for Pictures
∙ References to PNG Files of General Pictures
∙ Placement of PNG Filess of General Pictures
∙ References to PNG Files of HTF Symbols
∙ Placement of PNG Files of HTF Symbols
Representation of formulas
∙ Make picture’s alternative text to show the original tex code
∙ Avoiding bitmaps within formulas
∙ Setting bitmaps within formulas
Other
∙ Conditional bitmap conversion for imported graphic ﬁles
∙ Conditional bitmap conversion for imported graphic ﬁles
∙ Missing Conﬁgurations

Note: Please also check the .log ﬁles of the compilations for hints provided by tex4ht.

### Addresses of PNG Files

#### How PNG ﬁles Are Created for Pictures

There are two kinds of pictures: those created for letters, and those requested directly or indirectly for ﬁgures in the source ﬁles. The tex4ht.c utility extracts the ﬁgures from the foo.dvi ﬁle into a foo.idv ﬁle, and places in foo.lg messages of how to extract the ﬁgures. The t4ht.c utility, uses the requests listed at foo.lg, to activate the G-script from tex4ht.env for the different ﬁgures. However, if a F-script is available, it is used instead for the letters.

#### References to PNG Files of General Pictures

The command

\Configure{IMG}{<img\Hnewline src="foo.dir/}{" alt="}{" }{ />}

in the conﬁguration ﬁle adds the preﬁx

foo.dir/

to the png names.

The default setting uses the conﬁguration

\Configure{IMG}{<img\Hnewline src="}{" alt="}{" }{ />}

#### Placement of PNG Filess of General Pictures

Add to the ‘G’ script in tex4ht.env a command to move the PNG’s to the desired destination (e.g., ‘Gmv %%3 foo.dir/.’).

#### References to PNG Files of HTF Symbols

Add the following commands to the conﬁguration ﬁle.

\Configure{htf}{1}{+}{<img\Hnewline
src="foo.dir/}{" alt="}{" class="}{\%s}{-\%d}{x-x-\%x}{" />}
\Configure{htf}{3}{+}{<img\Hnewline
src="foo.dir/}{" alt="}{" class="\%s-}{\%s}{-\%d}{x-x-\%x}%
{" align="middle" />}

#### Placement of PNG Files of HTF Symbols

If ‘foo.dir/’ is not the directory used in the ‘G’ script, introduce into tex4ht.env a similar ‘F’ script for the character PNG’s, e.g.,

Fdvips -T 14in,14in -Ppdf -mode ibmvga -D 110 -f %%1 -pp %%2 > zz%%4.ps
Fconvert zz%%4.ps -trim -density 110x110 -transparent ’#FFFFFF’ %%3
Fmv %%3 foo.dir/.

### Representation of formulas

#### Make picture’s alternative text to show the original tex code

Explicit requests:

\newtoks\eqtoks
\def\ImageAlt{\afterassignment\setimg\eqtoks}
\def\setimg{\Picture*[\HCode{\the\eqtoks}]{}\the\eqtoks\EndPicture}
\ImageAlt{$\alpha + \beta$}
\ImageAlt{$$
\begin{array}{cc}
a & b \\
c & d
\end{array}
$$}

Implicit requests may also be tailored along the following lines, but they should be used carefully because they are not safe.

\newtoks\eqtoks
\def\AltMath#1${\eqtoks{#1}%
\Picture*[\HCode{\the\eqtoks}]{ align="middle"}$#1$\EndPicture$}
\Configure{$}{}{}{\expandafter\AltMath}

#### Avoiding bitmaps within formulas

Q. I found that some equations have smaller fonts than the others. I wonder why the size of the equations changes along the document.

Some equations and symbols are converted to bitmaps–I guess they are the parts you are concerned about.

If you try the command ‘ mzlatex filename’, provided you have the xhlatex-like script of mzlatex conﬁgured, you’ll get the bitmaps removed in favor of unicode symbols and mathml formulas. In such a case, one will need a mathml-enabled browser to view the outcome.

If you don’t care using the MS SYMBOL font, which non-pc browsers are likely not to recognize, try the command ‘ htlatex filename "" "symbol/!" ’. It will resolve the bitmap problem for of the characters.

#### Setting bitmaps within formulas

A code similar to the following one may be used to conﬁgure instructions like ‘\int_{xxx}ˆ{yyy}’ and ‘\sum_{xxx}ˆ{yyy}’ to produce pictorial representations within non-pictorial formulas.

\def\SubSupOp#1{%
\edef\temp{\expandafter\gobble\string#1}%
\expandafter\let\csname old\temp\endcsname=#1
\edef\temp{\noexpand\SUBSUPOP{\expandafter\noexpand
\csname old\temp\endcsname}}%
\HLet#1=\temp
}
\def\gobble#1{}
\def\SUBSUPOP#1{\let\curOP=#1%
\let\next=\putOP \let\OPsub=\empty \let\OPsup=\empty
\futurelet\nextop\getOP}
\def\getOP{%
\ifx _\nextop \let\next=\getsub
\else\ifx ˆ\nextop \let\next=\getsup\fi\fi \next}
\def\getsub#1#2{\def\OPsub{#2}\let\next=\putOP
\futurelet\nextop\getOP}
\def\getsup#1#2{\def\OPsup{#2}\let\next=\putOP
\futurelet\nextop\getOP}
\def\putOP{\Picture+{ align="middle"}{\curOP_{\OPsub}ˆ{\OPsup}}\EndPicture}
\SubSupOp\sum
\SubSupOp\int

### Other

#### Conditional bitmap conversion for imported graphic ﬁles

Q. How to avoid the conversion of eps ﬁles to PNG’s, included through the \includegraphics{...} command’, each time the source ﬁle is run across tex4ht.

Compile your source with the command line ‘ htlatex filename "html,info" ’, and check the log ﬁle for the information provided there. In particular, the ‘\Configure{graphics*} {wmf} ...’ example may be adapted for dealing with eps ﬁles, where a conditional conversion is requested within the ‘\Needs{"..."}’ command (possibly indirectly through a call to a script for doing he job).

#### Conditional bitmap conversion for imported graphic ﬁles

Q. How an image can be made a thumbnail to be clicked on for bringing up the full size image.

\Configure{graphics*}
{eps}
{\openin15=\csname Gin@base\endcsname\PictExt\relax
\ifeof15
\Needs{"convert \csname Gin@base\endcsname.eps
\csname Gin@base\endcsname\PictExt"}%
\fi
\closein15
\Link[\csname Gin@base\endcsname\PictExt]{}{}
\Picture[pict]{\csname Gin@base\endcsname\PictExt
\space width="10em" height="10em" }%
\EndLink
}
\EndPreamble

#### Missing Conﬁgurations

Q. I am attempting to convert a Ph.D. thesis written in LaTeX, using a locally developed class ths.cls based on the report class, which redeﬁnes some elements of the class for local needs. The output is lacking the Table of Contents and the Lists of Figures and Tables, and the bibliography at the end is only minimally formatted.

The problems result from a lack of a conﬁguration ﬁle for the thesis class. Try introducing a conﬁguration ﬁle similar to the following one.

% file name: ths.4ht
\input report.4ht