exit trouble shooting

### Trouble Shooting

∙ Bitmaps ∙ LaTeX ∙ Fonts ∙ C programs ∙ Scripts ∙ Environment File ∙ tex4ht.sty / *.4ht ∙ DVI Code ∙ JavaScript ∙ Subscripts and Superscripts

Bitmaps

Bad Quality of Pictures

  Increase the density (number of dots per inch) when converting the pictures, and then sub-sample the picture. Speciﬁcally, replace in ‘tex4ht.env’ the switch

  -density 110x100

  with the switch

  -density 220x220 -geometry 50%

  or with another switch of the form

  -density ...x... -geometry ...%

  The -density switch increases the number of pixels per inch, and the -geometry option reduces that number. The process smoothes (anti-aliases) the edges. Typically screens display about 72 to 100 dots per inch.

  The type of fonts in use may also affect the quality of the output. In particular, Type 1 (scalable outlines) fonts offer better outcome than Type 3 (bitmapped) fonts.

Direct Translations of EPS Figures

  The quality of the bitmaps of EPS ﬁgures may be improved by converting the ﬁgures directly, without transmitting them through the dvi code. For instance, the \includegraphics command in the presence of the following conﬁguration provides such a route.

  \Configure{graphics*}
  {eps}
  {\Needs{"convert \csname Gin@base\endcsname.eps
  \csname Gin@base\endcsname.png"}%
  \Picture[pict]{\csname Gin@base\endcsname.png}%
  }

  The following script provides a more efficient and general approach.

  \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
  \Picture[pict]{\csname Gin@base\endcsname.\PictExt}%
  }
Truncated and empty png ﬁles

  Such a behavior might result from pictures which end up off the dvi page limits. A larger paper size may be requested from dvips through the switch ‘-T offset’ (e.g., -T 14in,14in). The dvips command is activated from tex4ht.env.

Truncated and empty png ﬁles for Xﬁg pictures

  Some Xﬁg ﬁles are made up of overlapping picture environments, with TeX4ht viewing the components as deﬁning independent ﬁgures. The problem can be solved by importing the Xﬁg ﬁles into pictorial environments of TeX4ht.

  \newenvironment{mypic}{\Picture*{}}{\EndPicture}
  \begin{mypic} \input{xfig-file} \end{mypic}

  Alternatively, PDF-based translations into bitmaps might also offer a solution.

LaTeX

Unable to ﬁnd a newly installed ﬁle

  The TeX engine might require an update of a search directory: the ls-R database for installations employing kpathsea (run texhash), the data base directory in the case of MiKTeX (select tart -> Programs -> MiKTeX -> Refresh’, or run \‘’initexmf -u’ from a DO session, to update it).

Fonts

Can’t ﬁnd/open ﬁle foo.tfm

  - Locate the directory where LaTeX/TeX ﬁnds font foo.tfm, and add to tex4ht.env a ‘t’ record pointing to that directory (e.g., ‘tc:\localtexmf\fonts\tfm!’).
  - Insert the record at the start of the line. TeX4ht considers the ﬁrst character in each line to be a code describing the type of the record in hand. Lines which start with unrecognized character codes, spaces included, are ignored.
  - Note also that LaTeX/TeX may create fonts on the ﬂy and put them in a temporary directory (e.g., ‘/var/tmp/texfonts/tfm/’).
Linux, Netscape, and the SYMBOL font

  To display the SYMBOL fonts in Netscape on Linux add

  Netscape*documentFonts.charset*adobe-fontspecific: iso-8859-1

  to the ~/.Xdefaults ﬁle

C programs

tex4ht.c doesn’t compile ... ERROR:3396: ‘DIR’ undeclared (ﬁrst use this function)...

  Consider adding the switch ‘-DHAVE_DIRENT_H’ to the command line. For instance,

  gcc -o tex4ht tex4ht.c -DENVFILE=’"path/tex4ht.dir/texmf/tex4ht/base/unix/tex4ht.env"’ -DHAVE_DIRENT_H

Scripts

Bad end-of-line characters in htlatex.bat/httex.bat/htexi.bat/ht.bat

  Remove undesirable trailing characters in the lines of the scripts, introduced by the utilities which download the ﬁles.

  DOS/WINDOW platforms use an endline pair of characters: a carriage return and a line feed (0Dx,0Ax hexadecimal; 13,10 decimal). MAC platforms use only a single carriage feed character (0Dx; 13dec). UNIX platforms use only a single line feed character (0Ax; 10 dec).

Can’t ﬁnd/open ﬁle ‘xxx.dvi’ or ‘xxx.lg’

  In some platforms, the operating systems pass on the quotes of the parameters of htlatex, httex, and httexi to the utilities tex4ht and t4ht. In such cases, the utilities issue complaints of the above nature for ﬁle names ‘xxx’ other than those being compiled. The problem can be resolved by installing a ﬁlter named ‘htcmd’, and submitting the tex4ht and t4ht commands to the ﬁlter. Backslash characters ‘\’ might need replacements with double backslash characters ‘\\’ or forward slash characters ‘/’.

  For instance, if htlatex.bat contains a command line of the form ‘C:\tex4ht\t4ht %1 %4’, then after introducing the ﬁlter the modiﬁed command line will take the form ‘C:\\tex4ht\\htcmd C:\\tex4ht\\t4ht %1 %4’.

Environment File

Can’t ﬁnd/open ﬁle ‘tex4ht.env’

  The switch -hV on the calling tex4ht command shows where the ﬁle is being searched. The following are possible solutions to the problem.

  - Set an environment variable TEX4HTENV to the address of the ﬁle
  - Add the switch ‘-e...address-of-tex4ht.env...’ to the command lines of t4ht and tex4ht within the htlatex, httex, httexi, and ht (or htlatex.bat, httex.bat, httexi.bat, and ht.bat) scripts.
  - If tex4ht and t4ht are compiled for kpathsea check that the texmf.cnf contains records similar to the following ones.
    TEX4HTFONTSET=alias,iso8859
    TEX4HTINPUTS=.;$TEXMF/tex4ht/base//;$TEXMF/tex4ht/ht-fonts/{$TEX4HTFONTSET}//
    T4HTINPUTS=.;$TEXMF/tex4ht/base//

  - Make the location of the environment ﬁle known to the programs in another manner (see the pointers from the entry ‘tex4ht.env’ in the index).
No permission for system call: ...

  Make sure that the ‘S’ records in tex4ht.env don’t end with invisible spaces, and that the ﬁle ends with the record ‘% end of file’.

Problems with argument -d... of t4ht

  The speciﬁed directory must be augmented by a slash character /.

Problems with the convert utility

  - Make sure the convert program of ImageMagick is called and not another convert system in your directories. In the latter case, insert the full address of convert into the following command within tex4ht.env.

    Gconvert zz%%4.ps -trim -density 110x110 -transparent ’#FFFFFF’ %%3

    For instance, use

    Gc:\TeX\Imagick\convert

    instead of

    Gconvert

  - You might need to remove the quotes from ’#FFFFFF’
The OpenOffice script in tex4ht.env fails to work for MS Windoes

  Try replacing the given script with the following non-concurrent script.

  <oo>
  %%% openoffice %
  .4os mkdir Pictures
  .4os move %%1.4os settings.xml
  .4os move %%0.xml content.xml
  %
  .4om mkdir %%1
  .4om move %%1.4om %%1\content.xml
  .4om copy settings.xml %%1\settings.xml
  %
  .4of mkdir META-INF
  .4of move %%1.4of META-INF\manifest.xml
  %
  .4ot move %%1.4ot meta.xml
  .4oy move %%1.4oy styles.xml
  .4og move %%1 Pictures\%%1
  %
  .4ox zip -m %%0.sxw Pictures
  .4ox zip -m %%0.sxw settings.xml
  .4ox zip -m %%0.sxw content.xml
  .4ox zip -m -r %%0.sxw %%0-m*
  .4ox zip -m -r %%0.sxw META-INF
  .4ox zip -m %%0.sxw meta.xml
  .4ox zip -m %%0.sxw styles.xml
  .4ox zip -m %%0.sxw Pictures/*
  %
  %%% end openoffice %
  </oo>

tex4ht.sty / *.4ht

Foreign content in <title>...</title> elements

  Use the \Configure{@TITLE}{...} command to redeﬁne for the these elements the harmful macros that appear in headers of logical units like \title and \chapter. For instance, the deﬁnition \Configure{@TITLE}{\def\LaTeX{LaTeX}} for the source \title{with \LaTeX}.

Problematic commands in titles of logical divisions

  Commands within titles of divisions might need protection when transported by tex4ht to other locations. The command \Configure{NoSection}{..before...}{...after...} may be used for such a purpose.

DVI Code

XDVI/DVIWINDO/YAP... hang on \special command

  The dvi code produced by tex4ht is not valid for use with other utilities. Recompile the source ﬁle without the presence of tex4ht, to provide a proper code to your dvi viewer.

JavaScript

‘onovermouse’ package option

  This option currently relies on the JavaScript utility overlib.js of Erik Bosrup. The ﬁle might need to be ﬁxed at line 234, by introducing ‘return "";’ instead of ‘return;’ (an already reported problem).

Subscripts and Superscripts

Loss of structural information

  Subscripts and superscripts are among the weakest points of tex4ht. In order to recognize them for non-bitmap representations, TeX4ht changes the category codes of ‘ˆ’ and ‘_’, upon reaching the \begin{document} instruction, and ignores the operations if introduced earlier.

  The ideal solution would have been to get the superscript and subscript operations, as well as the empty bases ‘{}’, marked upon request by the native compilers in the dvi code. Currently, that is just a good night dream.

  The solutions I use are,

  1. Redeﬁne in the *.4ht ﬁles macros that appear in libraries, by replacing there the ‘_’ and ‘ˆ’ operations with \sb and \sp macros. The danger in this approach is that occasionally users provide new meanings to existing control sequences, without tex4ht taking it into account.
  2. Prepare cfg ﬁles, for sources which don’t belong to me, consisting of redeﬁnitions for the the sensitive macros. Then I reload the redeﬁnitions under the eyes of tex4ht. For instance, the conﬁguration ﬁle test.cfg
     \Preamble{}
     \renewcommand{\FQED}[2]{F_{#1#2}}
     \renewcommand{\Mlones}{Mˆ2}
     \renewcommand{\bzms}{Mˆ2_{_0}}
     \begin{document}
     \EndPreamble

     for a source test.tex, and a compilation invoked through the command ‘mzlatex test "test"’.

  3. Use \sb and \sp, instead of ‘_’ and ‘ˆ’, in preambles of ﬁles I write, or push the deﬁnitions to after the \begin{document} statement.