Command to create and send to directories

22 views
Skip to first unread message

aga

unread,
Jul 4, 2025, 5:59:30 PMJul 4
to LaTeX Users Group

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. These files are .ptp file(s), .aux file, .log file and .toc file. These files are all located in the directory where myfile.tex is located. 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?? I am trying to do these in order not to end up with so many files in the directory containing myfile.tex. Any help/hints will be much appreciated. Aga


Peter Flynn

unread,
Jul 5, 2025, 6:30:55 AMJul 5
to latexus...@googlegroups.com
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

aga

unread,
Jul 6, 2025, 3:43:40 PMJul 6
to LaTeX Users Group
Thanks for the detailed reply. So far I have not been able to hide the ancillary files, nor I've found a way to generate directories in PCTex. I've atached a screen capture of the settings menu in PCTex that I was trying to alter but I could not find a way to create new directories nor even write files to existing directories. I sense there is a way (my senses can be very wrong sometimes). Will let you know if I find a way. 
Screenshot 2025-07-06 152859.jpg

RGarth Silvers

unread,
Jul 6, 2025, 4:46:24 PMJul 6
to latexus...@googlegroups.com
I’m trying to figure out the five controls on ncarc in pst-node package.

The first two arcs connecting Start and Middle seem to overlap even though the arcangles are 30 and 0.

The second pair connecting Start and End also seem to overlap even though the arcangles are 90 and 30, angleA are 0 and 270, and angleB are 90 and 135.

Additionally, they seem to have the same terminus on Start as the first two do even though the first three have arcangleA=45 and angleA=0 but the last has 45 and 270

The third pair connecting Middle and End also seem to overlap even though angleA and angleB are 270 and 135, then 0 and 90.

Lastly, the Start-to-Middle terminus on Middle using arcangleB=90 and angleB=90, differs by seemingly 10-20 degrees from the terminus of the Middle-to-End using arcangleA=45 and angleA=0 or using arcangleA=45 and angleA=270.

I would think that angle sets the height of the apex from each terminus, and that angleA and arcangleA set the terminus and the angle at which the connection meets the (oval) node.

%!TEX TS-program = latexTR
\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-node}

\begin{document}

\begin{pspicture}(6,3)
\rput(1,1){\ovalnode{X}{Start}}
\rput(5,2){\ovalnode{Y}{Middle}}
\rput(8,3){\ovalnode{Z}{End}}

\ncarc[
arcangle=30,
arcangleA=45,
arcangleB=90,
angleA=0,
angleB=90,
linecolor={[rgb]{1 0 0}}
]{->}{X}{Y}

\ncarc[
arcangle=0,
arcangleA=45,
arcangleB=90,
angleA=0,
angleB=90,
linecolor={[rgb]{1 1 0}}
]{->}{X}{Y}

\ncarc[
arcangle=90,
arcangleA=45,
arcangleB=90,
angleA=0,
angleB=90,
linecolor={[rgb]{0 0 1}}
]{<-}{X}{Z}

\ncarc[
arcangle=30,
arcangleA=45,
arcangleB=90,
angleA=270,
angleB=135,
linecolor={[rgb]{0 1 0}}
]{->}{X}{Z}

\ncarc[
arcangle=75,
arcangleA=45,
arcangleB=90,
angleA=270,
angleB=135,
nodesep=1pt,
linecolor={[rgb]{1 0 1}},
linestyle=dotted
]{->}{Y}{Z}

\ncarc[
arcangle=75,
arcangleA=45,
arcangleB=90,
angleA=0,
angleB=90,
nodesep=1pt,
linecolor={[rgb]{.3 .3 .3}},
linestyle=dotted
]{<-}{Y}{Z}

\end{pspicture}
\end{document}

Peter Flynn

unread,
Jul 6, 2025, 5:00:59 PMJul 6
to latexus...@googlegroups.com
On 06/07/2025 20:43, aga wrote:
> Thanks for the detailed reply. So far I have not been able to hide the
> ancillary files, nor I've found a way to generate directories in PCTex.

Technically it is possible, if you run it with the -shell-escape option
enabled. This lets you write code in your document which calls out to
the operating system, so you could call a MKDIR command.

But you won't be able to use that method to move the files, because
while TeX is executing, those files are still open, and can't be moved.
To move the files you have to do that after TeX has finished executing.

> I've atached a screen capture of the settings menu in PCTex

I don't know the PC-TeX application. Is this an editor, or a
configuration tool, or what?

> that I was trying to alter but I could not find a way to create new
> directories nor even write files to existing directories.
I don't think it can do that.

> I sense there is a way (my senses can be very wrong sometimes).

You really need to look into using latexmk, which has an -outdir option
for doing this. Here's what the latexmk manual page has to say:

>> Choice of aux and output directories: Often the aux and output
>> directories are given as subdirectories of the document
>> directory, e.g., by -outdir=output. But it is possible to provide,
>> for example, an absolute path or a path relative to a parent
>> directory, e.g., "/ tmp/foo" or "../out‐ put". Be aware that
>> in general this can cause problems, notably with makeindex or
>> bibtex. This is because modern versions of these programs, by
>> default, will refuse to work when they find that they are asked to
>> write to a file in a directory that appears not to be the current
>> working directory or one of its subdirectories. This is part of
>> security measures by the whole TeX system that try to prevent
>> malicious or errant TeX documents from incorrectly messing with
>> a user's files.
Or see if there is an implementation of make[1] for Windows, which lets
you write a Makefile specification ("recipe" in make-speak) that can do
file management before and after running a program like TeX.

Peter

Peter

Reply all
Reply to author
Forward
0 new messages