I'm trying to compile a LaTeX project with a rather complex document structure and obviously run into issues with openout_any. I've been reasoning that it's a bad idea to change that variable for LaTeX globally. On Linux I could run openout_any=a pdflatex mydocument.tex to apply it to that run only, however I'm actually using Windows (7), where that as far as I'm aware won't work. I already checked pdflatex -help and found no mention of a flag that would do any changes to openout_any for the run. Can anyone tell me a way to actually accomplish that short-time change?
Asked
Active
Viewed 477 times
0
Egor Hans
- 249
1 Answers
1
I came across this question because I wanted to know how to set openout_any from command line. So I describe my solution and an alternative way to achieve the desired result, here. So your question is part of my answer:
openout_any=a pdflatex ../../../source/latex/file.ins
can be used inside the doc/latex/file folder together with the following content in docstrip.cfg:
\BaseDirectory{../../..}
\UseTDS
At least with pdfTeX 3.141592653-2.6-1.40.24 this can be changed to the following command:
pdflatex --cnf-line=openout_any=a file.ins
A better solution would be to use point $TEXMFOUTPUT to a common a directory which contains all generated files. It can also be given on as parameter to the parameter --cnf-line and avoids changing openout_any at all. A complete shell script could be
#!/bin/sh -x
TEXMFOUTPUT="$(realpath ../../..)"
cat >docstrip.cfg << EOF
\BaseDirectory{$TEXMFOUTPUT}
\UseTDS
EOF
pdflatex --cnf-line=TEXMFOUTPUT="${TEXMFOUTPUT}" file.ins
For batch scripts this would be similar.
Keinstein
- 306
MIKTEX_ALLOWUNSAFEOUTPUTFILESrather thanopenout_anyaccording to this answer so you do need to specify whether you're using MiKTeX or TeX Live on Windows. – Nicola Talbot Apr 21 '18 at 20:31openout_anyshould work. I also found out about thetexmf.cnf, but would prefer not to apply security-relevant changes to the entire distribution. Also, I tried changing it for now as a workaround, and PDFLaTeX just straight up ignores the change for some reason. – Egor Hans Apr 23 '18 at 10:57set openout_any=afollowed by (new line)pdflatex <file...>. – user202729 Dec 10 '21 at 13:10