# [Tex/LaTex] Is it possible to compile asymptote(.asy) file without displaying the figure

asymptoteemacs

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.

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;
interactiveView=false;
batchView=false;


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

settings.interactiveView=false;
settings.batchView=false;
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
shipout(view=false);
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.