7

I am trying to draw a lemniscate using the code from this answer: How to draw lemniscate with TikZ

However, if when I run asymptote I get the following error messages:

Error: /undefined in .setopacityalpha
Operand stack:
   0.5
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   2045   1   3   %oparray_pop   2044   1   3   %oparray_pop   --nostringval--   2025   1   3   %oparray_pop   1884   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:967/1684(ro)(G)--   --dict:0/20(G)--   --dict:82/200(L)--
Current allocation mode is local
Current file position is 31005
GPL Ghostscript 9.26: Unrecoverable error, exit code 1                                                                                                                                                                                       
/opt/texlive/2018/texmf-dist/asymptote/plain_shipout.asy: 87.10: runtime: shipout failed                                                                                                                                                     
Error: /undefined in .setopacityalpha                                                                                                                                                                                                        
Operand stack:                                                                                                                                                                                                                               
   0.2                                                                                                                                                                                                                                       
Execution stack:                                                                                                                                                                                                                             
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   2045   1   3   %oparray_pop   2044   1   3   %oparray_pop   --nostringval--   2025   1   3   %oparray_pop   1884   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--              
Dictionary stack:                                                                                                                                                                                                                            
   --dict:967/1684(ro)(G)--   --dict:0/20(G)--   --dict:82/200(L)--                                                                                                                                                                          
Current allocation mode is local                                                                                                                                                                                                             
Current file position is 38506                                                                                                                                                                                                               
GPL Ghostscript 9.26: Unrecoverable error, exit code 1                                                                                                                                                                                       
/opt/texlive/2018/texmf-dist/asymptote/plain_shipout.asy: 87.10: runtime: shipout failed        
9

Wow.

After a lot of digging I found this bug report (which isn't actually a bug) which suggests that GhostScript (which is called by Asymptote) runs into problems when opacity is used along the the -dSAFER option. This option assures that no PostScript code which could be harmful to the system is executed. Enabling this option makes the opacity fail. If you change the line fpen=lightred+opacity(0.5); to fpen=lightred;//+opacity(0.5); and pen fpen=lightgreen+opacity(0.2); to pen fpen=lightgreen;//+opacity(0.2); (commenting out the opacity) the picture is generated:

enter image description here

but it's not what you'd expect. And if you enable the opacity the problem persists because Asymptote calls GhostScript with -dSAFER by default since 2008 (from the change log):

commit 407a627a5d18b773739a9535b486b8a177dd7c49
Author: John Bowman <bowman@ualberta.ca>
Date:   Mon Jun 23 11:00:40 2008 -0600

    By default run gs with -dSAFER.

After more digging through code and documentation looking for opacity without success, I searched for safe and voilà:

enter image description here

there is a -nosafe option which you can (when you trust the code your are executing) pass to asy so that the opacity will work.

So you can use the same code from the answer you linked (How to draw lemniscate with TikZ) and compile the document with:

pdflatex cassini.tex
asy -nosafe cassini-*asy
pdflatex cassini.tex

and it will work :)

5

A better workaround for this ghostscript bug has already been implemented in the git source (and will be in the upcoming 2.48 Asymptote release):

https://github.com/vectorgraphics/asymptote/issues/77

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.