Today I want to draw several 3D schematic diagrams that could be inserted in my LaTeX files. And I chose asymptote because of its widely known 3D rendering advantage over other tools.

I configured "asy-mode" in my favorable Emacs to code my first script. However, when I press C-c C-c to compile, the compilation process will open the output file(.eps or .pdf) and will half untile I close that file.

That is really a trouble to close preview every time. When I compile tex files, the compiler only parses and processes and won't open the .dvi file and wait for me to preview. Instead, after the compilation, yap can detect the change and automatically reload it. Many pdf viewers also have auto reload feature. That's particularly convenient when I'm using a computer with two screens.

But now every time "asy" will open the preview file and I have to close it to proceed. I notice the command for the compilation is

asy -V -wait file.asy

I tried many ways, but nothing prevents "asy" from opening the output files. I edited asy-mode.el to delete the -wait parameters; I compile it manually outside Emacs trying all possible parameters, like

asy -silent file.asy

the window keeps jumping out after successful execution of the command.

That's really frustrated. Do you guys have any solutions or work around? I'm using Emacs 23.4 on Windows 7 and the asymptote version is 2.24.

Thanks in advance.

  • 1
    The -V option is precisely the one that asks the OS to view the file.
    – egreg
    Jan 8, 2014 at 7:42
  • 1
    Have you tried asy -noV file.asy? Another possibility is to end your file with the line shipout(view=false); the latter should (I think) suppress the output even when you compile in Emacs with C-c C-c. Jan 8, 2014 at 10:55
  • @egreg, asy will pop out the file even without any argument.
    – anecdote
    Jan 8, 2014 at 14:59
  • 1
    @anecdote: It does say negate by replacing - with -no. In general, I recommend looking at the Asymptote manual, which you can probably see by typing texdoc asymptote at the command line. Jan 8, 2014 at 15:33
  • 1
    @CharlesStaats On Mac OS X, if I don't call asy with -V, no preview is attempted.
    – egreg
    Jan 8, 2014 at 15:48

1 Answer 1


From the Asymptote FAQ:

Question 9.1. How can I disable automatic invocation of the PS viewer after an asy file is done processing?

It's actually not on by default, unless you happen to be using Microsoft Windows (because that is what most Microsoft Windows users expect). Microsoft Windows users can turn this feature off with the command-line option -noV or by putting

import settings;

in their config.asy file. See http://asymptote.sourceforge.net/doc/Options.html.

Other options that should work:

  • Rather than using the config.asy file, you can probably put the lines

    directly in your .asy file (at the beginning). I do not know whether this will disable the preview after using emacs.

  • You can put the line
    at the end of your .asy file, which should disable the preview even when running from emacs. The shipout() function is what tells Asymptote to actually produce a file; it is called automatically after the end of the file if you did not call it yourself (which you are doing here). The view option seems to do what you think it does, more or less; the default is true, so I'm not sure how exactly it interacts with the view settings.

  • It's strange that even with -noV and with all those options, asymptote still pops up a window (that closes almost immediately). That's annoying when your Makefile calls asymptote 30 times, for example! (30 windows popping up, one each three or five seconds -- that means I have to stop working).
    – Jay
    Feb 6, 2014 at 16:22

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.