A little investigation reveals that htlatex
is indeed a sh
script file, at least in my system:
$ which htlatex
/usr/texbin/htlatex
$ file /usr/texbin/htlatex
/usr/texbin/htlatex: symbolic link to `../../texmf-dist/scripts/tex4ht/htlatex.sh'
And the contents of that script are:
$ cat /usr/texbin/htlatex
#!/bin/sh
latex $5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input ' $1
latex $5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input ' $1
latex $5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input ' $1
tex4ht -f/$1 -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3
t4ht -f/$1 $4 ## -d~/WWW/temp/ -m644
So it consists of a sequence of calls to latex
, tex4ht
and finally t4ht
. Apparently the script expects 5 parameters ($1
to $5
) and from their use we can deduce, more or less, their function:
$1
is the name of the file containing the latex
source. It is passed to all the tools in the chain.
$2
is part of a parameter passed to a mysterious command \HCode
defined in place for the latex
command, and whose mission I didn't try to understand. I will ignore this parameter until someone better equiped than me can discover its function
$3
is passed to tex4ht
as part of the -i
option, and thus serve to specify a folder for fonts.
$4
is passed to t4ht
so looks like a place where we can specify additional switches for t4ht
.
$5
is passed to latex, so it looks like a place where we can specify additional switches for latex
.
Using t4ht --help
we discover that the -d
option can be used here to specify the destination directory, so I tried:
$ htlatex Example.tex "" "" -d/tmp/
And it worked. The result goes to /tmp/
, but note that this affects only to the final step. The first steps still use the current directory, so all intermediate and auxiliary files are still there. I guess you cannot get ride of them with a switch.