vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
533 stars 89 forks source link

Automatic shipout still executing, even after manual call #396

Closed thornoar closed 9 months ago

thornoar commented 10 months ago

The documentation reads,

A shipout() command is added implicitly at file exit if no previous shipout commands have been executed.

However, it seems as if the shipout() command was added always. Here is a minimal working example file test.asy:

draw(unitcircle);
shipout(prefix = "picture", format = "pdf");

After compilation, two files are added in the directory, picture.pdf and test.eps, while it should be only picture.pdf. What is even more interesting, if I remove the prefix keyword from shipout and specify only the format, then only test.eps results after compilation, without any pdf file.

OS: Manjaro Linux Asymptote: 2.86git

Thank you for any help in advance.

johncbowman commented 9 months ago

Yes, this changed in commit 451a260ae50d02867c1e54726a68d8af2c55761d but the documentation was not updated.

johncbowman commented 9 months ago

If you shipout to the defaultprefix, the implicit shipout will override the specified format. Use settings.outformat="pdf"; instead.

thornoar commented 9 months ago

The problem still stands, however, when shipouting to a non-defaultprefix. Is there maybe a constant for enabling/disabling automatic shipout? A nice thing would also be to have something like settings.outprefix

johncbowman commented 9 months ago

What problem still stands? If you shipout to a non-default prefix, you will get two output files, as now documented (unless you erase currentpicture at the end of the file; see for example Koch1.asy).

thornoar commented 9 months ago

I assume you are saying that Asymptote now works exactly as it is supposed to, to which I fully agree. My comment was more that it shouldn't really be supposed to work like that (imho), and I was only asking if there was a way not to produce this extra file each time after manual shipout. Since there seems to be none (apart from exit()ing thereafter), this should be considered closed indeed. Thank you in any case, your reply was helpful!

johncbowman commented 9 months ago

To suppress the implicit shipout, add erase(); at the end of your file.