Unix
Date: 2001-02-28 17:02:00

exit Unix

### A Setup for Unix Environments

Download the Files

1. Establish a directory ‘path/tex4ht.dir’.

2. Download, and unzip when needed, the following files into the directory tex4ht.dir.

   1. tex4ht.sty
   2. all4ht.zip (*.4ht)
   3. tex4ht.env
   4. tex4ht.c
   5. t4ht.c
   6. ht-fonts.zip (ht-fonts)
   7. htlatex
   8. httex
   9. httexi
   10. ht
   11. testa.tex, testb.tex
   The above files are also available zipped together into a single file named ufiles.zip (osu, tug).[unzip]

   Compile the Postprocessors

3. Copy tex4ht.c and t4ht.c into a temporary directory
4. Compile tex4ht.c into an executable tex4ht file with a command similar to the following one, where ‘path’ stands for the absolute path to directory tex4ht.dir.

   cc -o tex4ht tex4ht.c -DENVFILE='"path/tex4ht.dir/tex4ht.env"' -DHAVE_DIRENT_H

   The switch ‘-DENVFILE='"path/tex4ht.dir/tex4ht.env"'’ may be omitted, if the program can reach the environment file in an alternative manner.

5. Compile t4ht.c with a command similar to following one, where ‘path’ stands for the absolute path to directory tex4ht.dir.

   cc -o t4ht t4ht.c -DENVFILE='"path/tex4ht.dir/tex4ht.env"'

   Again, the switch ‘-DENVFILE='"path/tex4ht.dir/tex4ht.env"'’ may be omitted, if the program can reach the environment file in an alternative manner.

6. Move the executable files tex4ht and t4ht to directory tex4ht.dir.

   Update the Pointers in the Environment File

7. Replace in tex4ht.env the line(s) 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 column 1 and, if their subdirectories are also to be searched, the names should be appended with the character ‘!’.

   Under some settings, the ‘t’ records may use relative addresses or be omitted.

8. Replace in tex4ht.env the line(s) starting with the character ‘i’, with alternative lines which state what directories should be searched for the htf files of TeX4ht. The directory names must be preceded with the character ‘i’ at column 1. If the subdirectories are also to be searched, the names should be appended with the character ‘!’.

   Under some settings, the ‘i’ records may use relative addresses or be omitted.

9. The entry ‘lpath/tex4ht.dir/filename’ in tex4ht.env points to the address where the bookkeeping file should reside. The entry should include the full path to the address of the bookkeeping file. Modify that entry to fit your platform. The character ‘l’ should precede the address, and be placed at the first column. Make sure the access mode of the directory permits writing into files.

   Update the Bitmap Generating Scripts in the Environment File

10. The file tex4ht.env contains the following default script, of calls to system utilities for translating dvi pictures into gif.

        Gdvips -Pcmz -Pamz -mode ibmvga -D 110 -f %%1 -pp %%2  > zz%%4.ps
        Ggs -sDEVICE=ppm -sOutputFile=zz%%4.ppm -q -dbatch -dNOPAUSE zz%%4.ps -c quit
        Gconvert -crop 0x0 -density 110x110 -transparency '#FFFFFF' zz%%4.ppm %%3
        Grm zz%%4.ps
        Grm zz%%4.ppm

    The entry %%1 is a parameter refering 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 command line options ‘-Pcmz -Pamz’ of dvips requests type 1 postscript format for the standard Computer Modern fonts of TeX. Such a format improves the bitmap quality of the glyphs.

    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 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.

11. 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

12. If needed, replace the scripts ‘Mmv %%1 %%2%%3’ and ‘Ccp %%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).

13. If needed, replace the script ‘Achmod %%1 %%2%%3’ in tex4ht.env with an alternative script for changing 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 file(s).

14. 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

15. Replace the 3 occurences of path in htlatex, httex, and httexi with the absolute path name to where tex4ht.dir resides.
16. If you use a command different than latex for compiling LaTeX source files, replace the 3 occurences of latex in htlatex with the appropriate command name. Similarly, if you use a command different than tex for compiling TeX source files, replace the 3 occurences of tex in httex and in httexi with the appropriate command name.
17. Change the access modes of htlatex, httex, httexi, and ht to executable (e.g., ‘chmod 700 htlatex’).
18. Consider creating a web directory where the output files would be stored for viewing by the browsers. The directory can be made world wide accessible by changing its access mode to 711. If you create such a directory, add the switches -ddir -m644 to the command line t4ht within the scripts htlatex, httex , httexi, and ht, where dir is the address of the web directory.
19. Add htlatex-like of your liking to to your environment.

    Make the System Globally Known

20. Inform the operating system where the scripts reside, say, by adding the directory ‘path/tex4ht.dir’ into the path variable within the .login file. For instance,

    set path=($path ~/tex4ht.dir)

    Alternatively, make soft links from your work directory to the script files htlatex, ht, and so forth.

21. Let LaTeX and TeX know where the new style files reside, by adding the directory ‘path/tex4ht.dir’ to the environment variable TEXINPUT. For instance,

    setenv TEXINPUTS .:~/tex4ht.dir//:/usr/local/share/texmf/tex//

    Alternatively, make soft links from your work directory to the files *.4ht and tex4ht.sty.

22. If your TeX system uses a database to locate files, make sure to refresh it (e.g., run texhash for kpathsea).

    Test the Installation

23. Move testa.tex and testb.tex to your work directory
24. Compile ‘testa.tex’ with the command ‘ht latex testa’
25. Compile ‘testb.tex’ with the command ‘htlatex testb’
26. If you care about MathML output, download the files testmath.tex and testmath.cfg, issue the command ‘mzlatex testmath "testmath"’, and compare the outcome with testmath.xml.