[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
Tue Feb 12 02:58:37 CET 2013


On Mon, Feb 11, 2013 at 11:46 PM, Nasser M. Abbasi <nma at 12000.org> wrote:

> On 2/11/2013 7:21 AM, Radhakrishnan CV wrote:
>
>> On Mon, Feb 11, 2013 at 5:23 PM, Nasser M. Abbasi <nma at 12000.org> wrote:
>>
>>  On 2/11/2013 5:46 AM, Radhakrishnan CV wrote:
>>>
>>>   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.
>>>>
>>>>
>>>>  Thanks, that is useful. But is it possible to put this \Needs
>>> command in my .cfg file somehow? The reason is, I have one common
>>> .cfg file, and if this can be used in .cfg file, then I do not
>>> have to edit all my .tex file and add this command to each. I
>>> have 1,000's of small .tex files, and they all use the same .cfg file.
>>>
>>>
>> That is quite possible. You might add the following line in your *.cfg:
>>
>>   \AtEndDocument{\Needs{...}}
>>
>> Let that be the last directive in \jobname.lg file which is read by t4ht
>> binary.
>>
>
I should not have added the above sentence. I just meant that this
particular \Needs{...} directive shall be the last one in the *.lg file,
that was the reason for the \AtEndDocument command. As you are aware, all
\Needs{...} directive will end up in *.lg file.


> I am sorry, but I am not following you. Your description is short
> and assumes knowledge of the user. It will really help if you
> could give a tiny/minimal but complete example of how all this
> is supposed to work.
>
> You mention that I need to put something at end of \jobname.lg,
> which I do not understand. Do I need to put the command
>
>   \AtEndDocument{\Needs{...}}
>
> in the .cfg file or in this .lg file?
>

*.cfg, of course. *.lg is dynamically created and the only way to get
something inserted in it is through \Needs{...} or \Css{...} directives.


> I only know about myconfig.cfg. Also, the command itself
>
> \Needs{"find ./ -maxdepth 1 -mindepth 1 -type f -not
> -name \jobname.tex -exec mv '{}' A \string\; "}
>
> seems to have hardcoded values in it. What is 'A' above? This
> folder will be different from one .tex file to another, I can't
> have it hardcoded, as I have large tree and different names for
> latex files all over. I send output of each latex file to a
> sub-folder by the same name as the latex file.
>

You might define a \mydir macro for the purpose.

  \def\mydir#1{\gdef\@mydir{#1}}
  \def\@mydir{/.} % inialize to current directrory

Modified \Needs{...} will be:

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

You might provide the directory name in your document at the top in each
*.tex file:

  \mydir{<your scratch directory name>}

[...]

In addition, this command removed all other .tex files in
> the same folder to the folder `A` ! which is not what I want.
>

That is natural, because the command you have provided was expected to do
it. You might modify the find command accordingly or write individual
\Needs{...} directive for each scratch file like, \jobname.log,
\jobname.aux, so on and so forth.


> The folder `A` should really be the same as the latex file.
> So in this example, it should be `t15/`
>
> I really think the best solution should be to make
>
>              -dFolder
>
> which currently works, finish the job right, and move
> all these scratch and temp files to the `Folder` above
> as well. That would be the best solution to this problem.
>

At the moment, it can move only the output files.  You might modify the
t4ht binary, the sources are available at the TeX4ht project site. Your
help will be much appreciated.

Best regards
-- 
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/20130212/0d0dc2b2/attachment.html>


More information about the tex4ht mailing list