exit MS Windows

### A Setup for MS Windows

1. Establish a directory, say, ‘c:\tex4ht’.

2. Download the ﬁle tex4ht.zip into the directory tex4ht.dir and unzip it.

   Update the Pointers in the Environment File

3. Replace in c:\tex4ht\texmf\tex4ht\base\win32\tex4ht.env the lines starting with the character ‘t’, with alternative lines which state what directories should be searched for the tfm ﬁles of TeX and LaTeX. The directory names must be preceded with the character ‘t’ at the ﬁrst column. If their subdirectories are also to be searched, the names should be appended with the character ‘!’.

   Note that long ﬁle names on MS Windows, and ﬁle names with spaces, might have short space-free aliases. For instance, a directory name ‘c:\progra~1\texmf’ instead of ‘c:\program files\texmf’. The alternative names can be checked by issuing the ‘dir’ command in a DOS session.

4. If needed, adjust the paths in the ‘i’ records of tex4ht.env. These records are used for searching htf fonts, and they are similar to the ‘t’ records.

   Update the Bitmap Generating Scripts

5. The ﬁle tex4ht.env contains the following default script, of calls to system utilities for translating dvi pictures into png.
   Gif exist zz%%4.ps DEL zz%%4.ps >nul
   Gif exist %%3 DEL %%3 >nul
   Gdvips -E -Ppdf -mode ibmvga -D 110 -f %%1 -pp %%2 > zz%%4.ps
   Gconvert zz%%4.ps -trim +repage -density 110x110 -transparent "#FFFFFF" %%3
   Gif exist zz%%4.ps DEL zz%%4.ps >nul

   You may replace this script with an alternative sequence of system calls. In such a case, place one command per line, and mark each of these lines with the character ‘G’ at the ﬁrst column. The literate version tex4ht-env.tex of tex4ht.env offers a few suggestions.

   The entry %%1 is a parameter referring to a dvi ﬁle, the %%2 is a parameter indicating a page number, the %%3 is a parameter standing for an output ﬁle name, and %%4 is a parameter providing the jobname.

   The dvips utility translates dvi ﬁles into postscript. The convert utility, provided within the distribution of ImageMagick, translates postscript ﬁles into png.

   The script employs the Metafont mode ‘ibmvga’ of resolution ‘110’; the available modes are listed in ﬁle modes.mf of Metafont.

   Use the option ‘-crop 0x0 +page’ or ‘-crop 0x0 +repage’ instead of ‘-trim’ for old convert utilities that do not recognize the latter argument.

6. Instead of employing the G scripts, glyphs can rely on specialized F scripts of similar nature for creating pngs.

   Update the Other Scripts in the Environment File

7. If needed, replace the scripts ‘Mmove %%1 %%2%%3’, and ‘Ccopy %%1 %%2%%3’ in tex4ht.env with alternative scripts for moving and copying ﬁles. The parameter %%1 stands for the source ﬁle(s), the parameter %%2 provides the target directory name, and the parameter %%3 refers to the target ﬁle name(s).

8. If applicable, replace the scripts ‘Achmod %%1 %%2%%3’ in tex4ht.env with an alternative script for changing the access mode of ﬁles. The parameter %%1 stands for access mode, the parameter %%2 refers to a directory name, and the parameter %%3 refers to the ﬁle(s).

9. Postprocessing of ﬁles can be requested with ‘.’ scripts. The ﬁles are selected by their extension names, as listed following the period symbols. The parameter ‘%%1’ provides the ﬁle names, and the parameter ‘%%0’ provides the jobnames.

   The environment ﬁle tex4ht.env offers the following draft of a dot script for validating output of compilations.

   <validate>
   .xml java -cp texmf/tex4ht/bin/xv4ht.jar xv4ht %%1.xml texmf/tex4ht/base/win32/xv4ht.cat
   .html java -cp texmf/tex4ht/bin/xv4ht.jar xv4ht %%1.html texmf/tex4ht/base/win32/xv4ht.cat
   .css mycssparser %%1.css
   </validate>

   The dot script may be activated in the following manner.

   1. Fix the paths in the ﬁrst two records as well as witin the xv4ht.cat ﬁle.

   2. Bind a CSS validator to the .css record. (http://jigsaw.w3.org/css-validator/DOWNLOAD.html)

   3. Remove the leading space characters from the above record.

10. Postprocessing of ﬁles can also be requested with ‘X’ scripts. The ﬁle names are accessed through the parameter ‘%%1’, and their extensions through the parameter ‘%%2’.

    Set the Script Files

11. If you use a command different than ‘latex’ for compiling LaTeX source ﬁles, replace the references to latex in c:\tex4ht\bin\win32\*.bat with the appropriate command name. The tex and texi commands require similar attention.

    Make the System Globally Known

12. Add ‘c:\tex4ht\bin\win32’ to your path variable in ‘c:\AUTOEXEC.BAT’.

13. Place the ﬁles ‘tex4ht.sty’ and ‘*.4ht’ of c:\texmf\tex\generic\tex4ht\ within the LaTeX/TeX tree (either by moving the ﬁles to a directory which already has sty ﬁles, or by modifying the environment variable TEXINPUTS to point also to ‘c:\texmf\tex\generic\tex4ht\’).

14. If your TeX system uses a database to locate ﬁles, make sure to refresh it (e.g., select Start -> Programs -> MiKTeX -> Refresh, or run ‘initexmf -u’ from a DOS session, to update MiKTeX).

    Didn’t Use ’c:\tex4ht’?

15. If TeX4ht is installed in a directory other than c:\tex4ht, make sure to adjust the related paths in tex4ht.env the .bat ﬁles.

    Test the Installation

16. Move testa.tex and testb.tex from c:\tex4ht.dir\temp\ to your work directory
17. Compile ‘testa.tex’ with the command ‘ht latex testa’
18. Compile ‘testb.tex’ with the command ‘htlatex testb’

[MS Commands]