exit Unix

### A Setup for Unix Environments

1. Establish a directory , say,‘~/tex4ht.dir’.

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

   Compile the Postprocessors

3. Compile ~/tex4ht.dir/temp/tex4ht.c into an executable tex4ht ﬁle with a command similar to the following one.

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

   The switch ‘-DENVFILE=’"~/tex4ht.dir/texmf/tex4ht/base/unix/tex4ht.env"’’ may be omitted, if the program can reach the environment ﬁle in an alternative manner.

4. Compile ~/tex4ht.dir/temp/t4ht.c with a command similar to following one.

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

   Again, the switch ‘-DENVFILE=’"~/tex4ht.dir/texmf/tex4ht/base/unix/tex4ht.env"’’ may be omitted, if the program can reach the environment ﬁle in an alternative manner.

5. Move the executable ﬁles tex4ht and t4ht to directory ~/tex4ht.dir/bin/unix/.

   Update the Pointers in the Environment File

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

7. 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’ (insight).

8. The entry ‘l~/tex4ht.dir/filename’ in tex4ht.env points to the address where the bookkeeping ﬁle should reside. Modify the path to ﬁt your platform. The character ‘l’ should precede the address, and be placed at the ﬁrst column. Make sure the access mode of the directory permits writing into ﬁles.

   Update the Bitmap Generating Scripts in the Environment File

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

   The entry %%1 is a parameter refering 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.

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

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

    Update the Other Scripts in the Environment File

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

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

13. 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 inactive dot script for validating output of compilations.

    <validatehtml>
    .html xmllint --noout --valid --html %%1.html
    </validatehtml>
    <validate>
    .xml xmllint --noout --valid %%1.xml
    .html xmllint --noout --valid %%1.html
    .css mycssparser %%1.css
    </validate>

    The dot script may be activated in the following manner.

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

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

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

15. Ensure proper paths within the htlatex-like scripts in ‘~/tex4ht.dir/bin/unix/’. If you use a command different than latex for compiling LaTeX source ﬁles, ﬁx also the references to latex in the scripts. Check also the appropriateness of the commands for compiling TeX and TeXi ﬁles.

    Make the System Globally Known

16. Inform the operating system where the scripts reside, say, by adding the directory ‘~/tex4ht.dir/bin/unix/’ into the path variable within the .login ﬁle. For instance,

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

17. Let LaTeX and TeX know where the new style ﬁles reside, say, by adding the directory ‘~/tex4ht.dir/texmf/tex/generic/tex4ht/’ to the environment variable TEXINPUTS. For instance,

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

18. If your TeX system uses a registry database to locate ﬁles, make sure to refresh it (e.g., run texhash for kpathsea, or mktexlsr for some Linux systems).

    Test the Installation

19. Move testa.tex and testb.tex from ~/tex4ht.dir/temp/ to your work directory
20. Compile ‘testa.tex’ with the command ‘ht latex testa’
21. Compile ‘testb.tex’ with the command ‘htlatex testb’