exit Q/A

Q/A

Addresses of Bitmap Files
 How Bitmap Files Are Created for Pictures
 References to Bitmap Files of General Pictures
 Placement of Bitmap Filess of General Pictures
 References to Bitmap Files of HTF Symbols
 Placement of Bitmap 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
\includegraphics
 Conditional bitmap conversion for imported graphic files
 Clickable Thumbnail Images
Other
 Missing Configurations

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

Addresses of Bitmap Files

How Bitmap Files Are Created for Pictures

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

References to Bitmap Files of General Pictures

The command

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

in the configuration file adds the prefix

foo.dir/

to the file names.

The default setting uses the configuration

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

Placement of Bitmap Filess of General Pictures

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

References to Bitmap Files of HTF Symbols

Add the following commands to the configuration file.

\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 Bitmap 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 bitmaps of character, 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 configured, 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 configure 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 
 

\includegraphics

Conditional bitmap conversion for imported graphic files

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

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

Clickable Thumbnail Images

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

     \Configure{graphics*} 
        {png} 
        {\Link[\csname Gin@base\endcsname .png]{}{}% 
           \Picture[pict]{\csname Gin@base\endcsname .png 
              \space width="40px" height="40px" }% 
         \EndLink 
         } 
     \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="40px" height="40px" }% 
         \EndLink 
        } 

Other

Missing Configurations

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 redefines 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 configuration file for the thesis class. Try introducing a configuration file similar to the following one.

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

Generated August 24, 2020 - tex4ht home page