TransWikia.com

output directory Asymptote in TeXLive

TeX - LaTeX Asked by Shuodao on September 21, 2020

How does the asymptote and asypictureB packages determine the output file and working directories? I tried to use asypictureB and TeXLive to produce my files and put all the output files to a different directory. For pdflatex, this can be done by the -output-directory=dir option, and the *.asy files are in the dir folder. but then asy.exe cannot find this file. I tried to let TeX know the working directory by following this post: Asymptote Files
and tried all the options

begin{document}
renewcommandasydir{asytmp}
asysetup{dir= xxx}
begin{asypicture}{}
end{asypicture}
end{document}

none of them seemed to affect the working directory. I also tried to use TexStudio to change the asymptote command to be asy.exe dir/filename.asy, or include the -cd dir after asy.exe, but none of these work. asy.exe keeps searching for the files under the current directory.

Under mac, I found a workaround by revising the pdflatex command in TexStudio to include a series of bash commands:

sh -c "cp %.tex ~/asytmp/%.tex
& cd ~/asytmp/ && pdflatex -shell-escape -synctex=1 -interaction=nonstopmode 
%.tex
&& cd - && cp ~/asytmp/%.pdf %.pdf
&& cd ~/asytmp && find . ! -name '1' -delete"

but when I followed the same way and tried under Windows by using
cmd /C "... | ... | ..." it does not work because the cd dir command doesn’t work under windows and everything seems to be still executed under the current directory.

any thoughts on how to get this to work? Is it possible to revise the ~/.asy/config.asy file? I don’t even know if the asymptote and asypictureB packages use this config file.

One Answer

I tried again and the /asydir command seems to interfere with how pdflatex proccesses the *.asy file and I got the error "cannot write on the file dir/*-noname-1.asy".

It turns out that the workaround in MacOS described above works in windows. just need to keep using "&" instead of "|" between the different codes.

cmd /C "@echo off && pushd .
&& copy %.tex C:localtexmftmp%.tex & cd C:localtexmftmp
&& pdflatex.exe --shell-escape -synctex=1 -interaction=nonstopmode %.tex
&& asy.exe *.asy
&& pdflatex.exe --shell-escape -synctex=1 -interaction=nonstopmode %.tex
&& popd
&& copy C:localtexmftmp%.pdf %.pdf"
| txs:///view

NOTE: I formatted these codes to be multi-lines for readability, but it should be made sure that all the things are written in one line in TeXStudio.

Answered by Shuodao on September 21, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP