0

I use Asymptote to create 3D plots with the asymptote package loaded in my preamble

\documentclass[a4paper]{article}
\usepackage[no-math,cm-default]{fontspec}
\usepackage{amsmath}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setmainfont[Mapping=tex-text,Numbers=Lining,Scale=1.0,BoldFont={Times New Roman Bold}]{Times New Roman}
\usepackage[inline]{asymptote}

\begin{document}

\begin{center}
\begin{asy}
import graph3;
settings.render=4;
size(7.5cm,0);

currentprojection=orthographic(4,2,3);
currentlight=(5,-2,4);

real f(pair z) {return sin(z.x*z.y);}

draw(surface(f,(-3,-3),(3,3),nx=32,Spline),
rgb(0.7,0,0)+opacity(0.9),black+0.2bp);
\end{asy}
\end{center}

\end{document}

In order to fully complile the document I use the chain XeLaTeX->Asymptote->XeLaTeX. As shown in the picture below document-1.tex and document-1+0.tex files are produced.

enter image description here

Things were going well and the entire procedure worked. But suddenly the second complilation of XeLaTeX produces the following errors:

Undefined control sequence. ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}
Missing number, treated as zero. ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}
Illegal unit of measure (pt inserted). ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}
Undefined control sequence. ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}
You can't use `the letter b' after \advance. ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}
Missing number, treated as zero. ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}
Illegal unit of measure (pt inserted). ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}
Undefined control sequence. ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}
Illegal unit of measure (pt inserted). ...-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}

Everything shows that something is wrong with the document-1.tex file. I have to mention again that everything was working fine and I didn't delete, change or edit any file or reinstall any program. The 3D plot is the file document-1+0_0.pdf.

EDIT

Maybe showing the domument-1.tex and document-1+0.tex content would help. This is document-1.tex

\setlength{\unitlength}{1pt}
\makeatletter%
\let\ASYencoding\f@encoding%
\let\ASYfamily\f@family%
\let\ASYseries\f@series%
\let\ASYshape\f@shape%
\makeatother%
\leavevmode\vbox to 151.001880pt{}%
\kern 183.001810pt%
\definecolor{ASYcolor}{gray}{0.000000}\color{ASYcolor}
\fontsize{12.000000}{14.400000}\selectfont
\usefont{\ASYencoding}{\ASYfamily}{\ASYseries}{\ASYshape}%
\ASYalign(-91.500905,75.500940)(-0.500000,-0.500000){\hbox to 0pt{\includegraphics[hiresbb]{\ASYprefix\jobname-1+0_0.pdf}\hss}%
\includemedia[noplaybutton,3Dlights=Headlamp,3Dmenu,3Dtoolbar=false,label=document-1,3Dortho=0.005556462,3Dc2w=0.624695048 -0.780868809 0 -0.232810099 -0.186248079 0.954521404 -0.745355992 -0.596284794 -0.298142397 468.793647676 359.48703512 211.818718139,3Droo=626.926947579,3Dpsob=Max,3Dbg=1 1 1,add3Djscript=asylabels.js]{\phantom{\includegraphics[hiresbb]{\ASYprefix\jobname-1+0_0.pdf}}}{\ASYprefix\jobname-1+0.prc}}%

and this is document-1_0.tex

\setlength{\unitlength}{1pt}
\makeatletter%
\let\ASYencoding\f@encoding%
\let\ASYfamily\f@family%
\let\ASYseries\f@series%
\let\ASYshape\f@shape%
\makeatother%
{\catcode`"=12%
\includegraphics{\ASYprefix\jobname-1+0_0.pdf}%
}%
  • Please paste errors as text (with code formatting) and not as images. First, images are much harder to read for everyone. Second, they are impossible to read for screen reading software. – cfr Jul 25 '18 at 0:16
  • 1
    I can compile your code without problems, which editor are you using ?, Do you have the program installed on your computer? The Asymptote command is configured with the installation directory "C:/Program Files/Asymptote/asy.exe"?m*.asy - example for TeXstudio. – J Leon V. Jul 25 '18 at 5:05
  • I could compile too. But now without any obvious reason it shows these errors. Asymptote seems to be working fine thats why the plot is created. The error shows up at the second compilation of XeLaTeX. – mac Jul 25 '18 at 5:12
  • I am using Texstudio. The command for Asymptote is "C:/Program Files/Asymptote/asy.exe"?m*.asy – mac Jul 25 '18 at 5:58
  • No problem here with a fully updated TeX Live 2018 and using latexmk (executing xelatex) with a proper latexmkrc file. Let us know the output of \listfiles, placed at the top of your sample file) to make sure you have a correct set of versions. Also, I'm using asy version 2.44. – Herb Schulz Jul 25 '18 at 16:49

Your Answer

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

Browse other questions tagged or ask your own question.