On 04/07/2025 22:59, aga wrote:
> I use PCTex, an integrated LaTeX typesetting system for *Windows*.
> When I process my file (latex myfile.tex), PCTex creates a number of
> files after processing myfile.tex file.
Yep, all TeX implementations do this.
> These files are .ptp file(s), .aux file, .log file and .toc file.
Interesting. I've never come across a .ptp file; this looks like
something special created only by pctex.exe
> These files are all located in the directory where myfile.tex is
> located.
Yep, that's standard.
> *My question is*: is there a LaTex command to automatically create
> directories, for example named as *PTP*, *AUX*, *LOG *and *TOC*, and
> automatically send the ptp file(s), .aux file, .log file and .toc
> file to each of these directories??
Not as far as I know. This question comes up occasionally, and most
people seem to settle on writing a script to put the files into
subdirectories, which they run after every time they typeset their document.
I'm not clear what this achieves, though, as you'll have subdirectory
entries in your working directory instead of having the auxiliary files
there; and each subdirectory will only have one file in it — assuming
you use a separate working directory for each document you write, as
most people seem to; obviously if you have lots of documents in the one
directory, the subdirectories will have many files of that type in them.
It also means your ToC, LoF, LoT, index, glossary and bibliography will
stop working, because the .toc, .lof, .lot, .ind, .gls, and .bbl files
are all expected to be in the same directory as your document. The only
files you can safely hide are probably the .log, .blg, .ilg, and .glg
files (document log, bibliography log, index log, and glossary log).
> I am trying to do these in order not to end up with so
> many files in the directory containing myfile.tex.
I can see the attraction, but I thought most TeX editors nowadays hid
the ancillary files from view so that you never saw them unless you went
using the system's File Explorer (or whatever Microsoft is calling it
this week). Certainly users of the online systems like Overleaf, Crixet,
TeXpage, etc have trouble when you ask them to look at their log file or
some auxiliary file, because it's hidden by the software, and they've
never seen it (and sometimes didn't know it existed).
What editor are you using? It might be worth investigating latexmk and
makefile to manage the compilation process instead of just calling
tex.exe direct. There's a tex.s.e query about managing the files at
https://tex.stackexchange.com/questions/142221/how-to-clean-auxiliary-files-within-subdirectories-with-latexmk
but I don't know how easy or difficult this is to do in Windows. It
might be worth mailing PC-TeX support and asking if they have any
suggestions.
Please let us know how you get on, as I would like to add details about
this to the online document Formatting Information
(
https://latex.silmaril.ie/formattinginformation/)
Peter