[tex4ht] make output of tex4ht go to sub-folder without leaving temporary and intermediate files in the current folder?

Radhakrishnan CV cvr at river-valley.org
Mon Feb 11 12:46:39 CET 2013


On Mon, Feb 4, 2013 at 1:19 AM, Nasser M. Abbasi <nma at 12000.org> wrote:

>
> Is there a way to tell tex4ht to generate all its output
> into a sub-folder from where the latex file is ?
>
> Suppose I have this tree
>
> ----------------
>   foo.tex
>   a.png
> -----------------
>
> Where inside foo.tex there is includegraphics to a.png
>
> --- foo.tex ----------
> \documentclass{article}%
> \usepackage{graphics}
> \begin{document}
> \includegraphics{a.png}
> \end{document}
> -------------------------
>
> Now I want to build HTML file from foo.tex but want all
> the intermediate and any auxiliary files tex4ht generated
> (including any html files) to go to a sub-folder, say A/, so
> I'd _LIKE_ to end up with
>
> -----------------------------
>   foo.tex
>   a.png
>     +
>     |
>     A/---- foo.htm
>            foo.xref
>            foo.tmp
>            etc.....
>            a.png
>            ------------------------------**--
>
> I use the option
>
>    htlatex foo.tex "" "" -dA/
>
> But it still leaves many many files in the same folder, and
> it only copies foo.htm and a.png to the sub-folder.
>

True, aux and other scratch files still remain in your working directory.
In order to move all files to your target directory, you need to provide
\Needs{} directive in your source document. For example, I will modify your
example document to the following manner:

--- foo-changed.tex ----------
\documentclass{article}%
\usepackage{graphics}

\begin{document}

\includegraphics{a.png}

\Needs{"find ./ -maxdepth 1 -mindepth 1 -type f -not -name \jobname.tex
-exec mv '{}' A \string\; "}

\end{document}
-------------------------

\Needs{...} directive is operating system dependent. The one I have given
above is for bash in linux or unix like operating systems.  You might
provide the one fit for your OS.

-- 
Radhakrishnan
River Valley<https://maps.google.com/maps?q=River%20Valley,%20Thiruvananthapuram%20Neyyardam%20Road,%20Kerala,%20India&vector=1>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/tex4ht/attachments/20130211/00e345a9/attachment.html>


More information about the tex4ht mailing list