exit Unix

A Setup for Unix Environments

  1. Establish a directory `~/tex4ht.dir'.

  2. Create a file named `ht' in tex4ht.dir with the following script, and change its access mode to executable (e.g., `chmod 700 ht').
            $1 $2 
            $1 $2 
            $1 $2 
            tex4ht $2 
            t4ht $2  $3 
    

  3. Download, and unzip when needed, the following files into 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. htfcss.env
    8. test.tex
    The above files are also available in a single zipped file.

  4. Replace in tex4ht.env the line(s) starting with the character `t', with alternative lines which state what directories should be searched for 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 `!'.

  5. Replace in tex4ht.env the line(s) starting with the character `i', with alternative lines which state what directories should be searched for 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 `!'.

  6. The entry `Hcandy/tex4ht.dir/' in tex4ht.env indicates the absolute address of the directory where the file htfcss.env resides. Modify that entry to fit your platform. The character `H' should preced the address, and be placed at the first column.

  7. The entry `dcandy/tex4ht.dir/' in tex4ht.env indicates the directory where the file tex4ht.fls should reside. Modify that entry to fit your platform. The character `d' should precede the address, and be placed at the first column. If this entry is omitted, the work directory is assumed.

  8. The file tex4ht.env contains the following default script, of calls to system utilities for translating dvi pictures into gif.
    Gdvips -mode ibmvga -D 110 -f %%1 -pp %%2  > tex4ht.ps 
    Gconvert -crop 0x0 -density 110x110 -transparency '#FFFFFF' tex4ht.ps %%3 
    

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

    You may need to 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.

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

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

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

  12. Copy the C program tex4ht.c into a temporary directory, compile it into an executable tex4ht file with a command similar to the following one, and then move the outcome file tex4ht to directory tex4ht.dir. XXX stands for the absolute path to the home directory.

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

  13. Copy the C program t4ht.c into a temporary directory, compile it with a command similar to following one, and move the outcome to directory t4x4ht.dir.

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

  14. Create a work directory, and set there soft links to the files of directory tex4ht.dir (for instance, issue the system command `ln -s XXX/* .' in your work directory, where XXX stands for the path to directory text4ht.dir).

    A more general approach would be to make the files of tex4ht.dir globally known, for instance, by including lines similar to the following ones in the `.login' file.

    set path=(~/bin.$HOSTTYPE ~/tex4ht.dir//) 
    setenv TEXINPUTS .:~/tex4ht.dir//:candy/tex/texmf/tex// 
    

  15. Consider creating a web directory where the output files would be stored for viewing by browsers. The directory can be made globally accessible by changing its access mode to 711.

  16. Move test.tex to your work directory, and compile the file with the command `ht tex test '-dXXX -m644'' or `ht latex test '-dXXX -m644''.

    If you use commands different than tex or latex for compiling source files, uncomment the first line `% \def\CALL{{tex}{latex}}' within test.tex, and place there the correct command names.

    The XXX stands for the path to the web directory. If the web directory is the same as the work directory, the component -dXXX can be omitted. Otherwise, the definition \def\WWW{XXX} must be inserted at the start of test.tex. The component -m644 requests a change of access mode for public view.

    You might want to compare your output with the sample output provided in this document for TeX and LaTeX.