1

I'm trying to compile a LaTeX document containg Asymptote code in WinEdt and my MWE is this:

\documentclass{standalone}
\usepackage{asymptote}

\begin{document}

\begin{asy}[width=10cm,height=10cm]
import graph3;

size3(200);
currentprojection=orthographic(3,3,2);
currentlight=light(8,10,2);

int k1, k2, n = 5;
real alpha = 0.3*pi;

// cross section of the quintic 6D Calabi-Yau manifold
triple cy(pair z) {

  pair z1, z2;

  if(z==(0,0)) {
    z1 = exp(2*pi*I*k1/n);
    z2 = 0;
  } else {
    z1 = exp(2*pi*I*k1/n)*exp(log(cos(I*z))*2/n);
    z2 = exp(2*pi*I*k2/n)*exp(log(-I*sin(I*z))*2/n);
  }

  return (z2.x, cos(alpha)*z1.y + sin(alpha)*z2.y, z1.x);

}

for(k1=0; k1<n; ++k1) {
  for(k2=0; k2<n; ++k2) {
    surface s = surface(cy,(-1,0),(1,0.5*pi),20,20);
    draw(s,yellow+orange);
  }
}

\end{asy}

\end{document}

Example above from calabi with Asymptote

The procedure I follow to compile it in WinEdt is:

  1. latex main
  2. Click icon "Asymptote" to use Asymptote add-on in WinEdt.
  3. latex main.
  4. Click icon "dvi-ps" in WinEdt.
  5. Click icon "ps-pdf" in WinEdt.

and I get a document with extension .pdf like this

iooo

My question is: is there a simpler procedure for compiling Asymptote code in WinEdt?

Hirwanto
  • 1,335
  • 13
  • 21
  • I am not used with Windows. If you want to create a pdf file, it is better to use pdflatex. So the method is 1) pdflatex compilation 2) asymptote compilation 3) pdflatex compilation (twice for reference, bibliography, etc). Do not forget that you have the choice to include asymptote figures in your latex file through asy environment or to create a sample and separate asymptote figure (name_of_your_figure.asy) (and then include it with \includegraphics). – O.G. Jan 06 '15 at 21:32

1 Answers1

5

I've just made some improvements to the Asymptote add-on for WinEdt.

You can find the latest version (just uploaded) at http://www.winedt.org/config/menus/Asymptote.html. Simply install it over the old one.

Now, what you have to do to have the above code fully compiled and have the final .pdf file, is to click on the "PDFTeXify" button in the toolbar

enter image description here

or press the corresponding shortcut: Shift+Ctrl+P.

karlkoeller
  • 124,410