Open frankplow opened 1 year ago
Keep in mind that convert
calls a shell command (e.g. ghostscript) which will not be affected by output-directory
option of pdflatex
. For this standlone
would need to read out the output-directory
setting and call the shell command accordantly.
If you have a complex convert setup, you might want to use a Makefile calling the shell script directly.
@MartinScharrer Yeah I wasn't expecting this to be easy to fix, more just thought it was worth documenting. I've been working around the issue in a similar manner to how you've suggested. Is there no access to the output directory in the context standalone
calls the shell command from?
I have to check. output-directory
is a rather new option (compared to age of LaTeX), and I did not used it myself so far.
It looks like (https://tex.stackexchange.com/questions/294931/access-value-of-output-directory) that the value of output-directory
is not available as a TeX variable. Determine it using some checks might be possible but not really feasible.
You can specify an output name (including path) with the outfile
option of convert
. As the PDF is also there you also need to change infile
.
The following example would place the PNG in a subdirectory called myoutdir
. Run with pdflatex -output-directory myoutdir filename.tex
. I set the converter manually to Ghostscript 64bit, which is needed on my installation.
\documentclass[convert={ghostscript,gsexe={gswin64c},outfile={myoutdir/\noexpand\outname\noexpand\outext},infile={myoutdir/\noexpand\inname\noexpand\inext}}]{standalone}
\begin{document}
test
\end{document}
I think I will add an extra option to set the output directory in the options in a nicer way, like [convert={outputdir=...}]
.
I added a outputdir
option which can be set. Will be in the next release.
Using pdflatex's
output-directory
option (or other distributions' equivalents) with\usepackage[convert]{standalone}
causes the output files to be generated under the current directory, rather than the one set withoutput-directory
. There's also some other unexpected behaviour, for example if the source file is not in the current directory then the build fails.