exit MS Windows

A Setup for MS Windows

Download the Files

  1. Establish a directory ‘C:\tex4ht’.
  2. Download, and unzip when needed, the following files into the tex4ht directory.
    1. tex4ht.sty
    2. all4ht.zip (*.4ht)
    3. tex4ht.exe (or tex4ht.c)
    4. t4ht.exe (or t4ht.c)
    5. tex4ht.env
    6. htlatex.tab
    7. httex.tab
    8. httexi.tab
    9. ht.tab
    10. ht-fonts.zip (ht-fonts)
    11. testa.tex, testb.tex
    The above files are also available zipped together into a single file named wfiles.zip (osu, tug)[unzip].

    Update the Pointers in the Environment File

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

    Note that long file names on MS Windows, and file 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.

    Update the Bitmap Generating Scripts in the Environment File

  4. The file tex4ht.env contains the following default script, of calls to system utilities for translating dvi pictures into gif.
    Gif exist zz%%4.ps DEL zz%%4.ps >nul 
    Gif exist zz%%4.ppm DEL zz%%4.ppm >nul 
    Gif exist %%3 DEL %%3 >nul 
    Gdvips -Pcmz -Pamz -mode ibmvga -D 110 -f %%1 -pp %%2  -o zz%%4.ps 
    Ggswin32c -dNOPAUSE -sDEVICE=ppmraw -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r110x110 -sOutputFile=zz%%4.ppm -q zz%%4.ps -c quit 
    Gconvert -crop 0x0 -density 110x110 -transparency #FFFFFF zz%%4.ppm %%3 
    Gif exist zz%%4.ps DEL zz%%4.ps >nul 
    Gif exist zz%%4.ppm DEL zz%%4.ppm >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 first column.

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

    The dvips utility translates dvi files into postscript. The convert utility, provided within the distribution of ImageMagick, translates postscript files into gif.

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

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

    Update the Other Scripts in the Environment File

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

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

  8. Postprocessing of files can be requested with ‘X’ scripts. The file names are accessed through the parameter ‘%%1’, and their extensions through the parameter ‘%%2’. Consider setting a ‘X’ script for validation and other applications.

    Set the Script Files

  9. Rename the files ‘ht.tab’, ‘httex.tab’, ‘htlatex.tab’, and ‘httexi.tab’, to assume an extension ‘.bat’ instead of ‘.tab’.

  10. If you use a command different than ‘latex’ for compiling LaTeX source files, replace the 3 occurrences of latex in htlatex.bat with the appropriate command name. Similarly, if you use a command different than ‘tex’ for compiling TeX source files, replace the 3 occurrences of tex in httex.bat and httexi.bat with the appropriate command name.

  11. Add htlatex-like of your liking to to your environment.

    Make the System Globally Known

  12. Add ‘C:\tex4ht’ to your path variable in ‘C:\AUTOEXEC.BAT’, or move ‘htlatex.bat’ and ‘ht.bat’ to a directory specified in the path variable.

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

  14. If your TeX system uses a database to locate files, 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. TeX4ht can be installed in a directory dir other than ‘C:\tex4ht’, provided that the following changes are made.

    Test the Installation

  16. Move testa.tex and testb.tex to your work directory
  17. Compile ‘testa.tex’ with the command ‘ht latex testa
  18. Compile ‘testb.tex’ with the command ‘htlatex testb
  19. If you care about MathML output, download the files testmath.tex and testmath.cfg, issue the command ‘mzlatex testmath "testmath"’, view the outcome with a math-enabled browser (e.g., Mozilla), and compare the code with testmath.xml.

[MS Commands]