1

I have installed asymptote separately and created a 3d figure by compiling the code directly on command prompt. The source code (b2.asy) and the corresponding output (b2.pdf) is attached. I would like to include these figures in a separate latex figure just like figures.

  \documentclass{article}
  \usepackage{graphicx}
    \begin{document}
    \begin{figure}
        \includegraphics[scale=10]{b2.pdf}
        \caption{b2 figure}
    \end{figure}
   \end{document}

This code did not result in error, but the output pdf file does not contain the 3d figure.

I have taken a source code from Internet and compiled it.

\documentclass[12pt,twocolumn]{article}
    \usepackage[inline]{asymptote}
    \usepackage[paper=a4paper,hmargin=2cm,vmargin=2.5cm]{geometry}
    \usepackage{parskip}
    \setlength{\columnsep}{3em}

\title{Asymptote 3D graphics}
\begin{document}

Purely 2D asymptote drawings:

\begin{asy}
size(5cm);
draw(circle((1,0), 1.5), blue);
draw(ellipse((1,0), 1.5, 0.5));
\end{asy}
\end{document} 

This also could not result in even a figure.

PS:

I am using texstudio IDE. In the commands, the path to asymptote is provided to the one that is externally installed, which I have used to compile b2.asy and generated the pdf file. To compile the code, I am using pdflatex->asymptote->pdflatex->pdflatex

2
  • The b2.pdf file on google drive doesn't show anything as a preview. Downloading the b2.asy file and compileing using asy b2.asy produces a be.eps which converts fine to a b2.pdf but us very small. It then shows fine (but ugly scaled x10) in the initial document. I have no problems with the second document. How is texstudio typesetting the second document? is it processing the asy file ar the initial typesetting and then re-typesetting? Commented Dec 23, 2021 at 17:25
  • @Herd Schulz : I have named this file as test3.tex. After compiling it, I could find a aux, txt, pdf, pre, synctex.gz and test3-1 files in the same folder. The output pdf file shows the text, "Purely 2D asymptote drawings:" and nothing more. I am not sure whether latex is processing asy code!
    – rajendra
    Commented Dec 24, 2021 at 6:18

1 Answer 1

1

If you view your b2.pdf file with Adobe Reader, which understands PRC content, you will see that it is not blank. If you simply want a rendered preview bitmap and not 3D vector graphics, then specify for example -render=2 on the command line (or put settings.render=2; at the top of your file). See https://asymptote.sourceforge.io/doc/three.html for further information on Asymptote's output options.

In the upcoming 2.71 release -noprc is now the default option, as PRC is effectively end-of-life and seems to cause a lot of confusion like this.

1
  • I would like to include the 3D figure in my latex output file. Using the asy file, I could compile using the asymptote, that is externally installed, and generate the desired 3D figure. Now, I would like to include that 3D file into latex output file, which I could not, which is mentioned in the first source code given. In the second attempt, I am trying to put the asymptote code directly into latex code and compile it. In this case also I could not get the desired output! I am happy if you could address at least one of the issues.
    – rajendra
    Commented Dec 24, 2021 at 6:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .