使用渐近线(图形顺序)代码进行编译时出现问题

使用渐近线(图形顺序)代码进行编译时出现问题
\documentclass[12pt, UTF8, scheme = plain]{ctexart}
\usepackage{amsmath}
\usepackage{tasks}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{asymptote}
\begin{asydef}
size(6cm);
\end{asydef}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}
%%
%%
\begin{enumerate}

\item %%%% problematic one in 3D

This will be produced only when it is by itself.

\begin{center}
\begin{asy}
import graph3;
import solids;
real r=(3+sqrt(5))/2;
real s=sqrt(r);
real Brad=r;
real brad=1;
real Fht = 2*s;
currentprojection=orthographic(1,0,.2);
currentlight=(10,10,5);
unitsize(0.1cm);
revolution sph=sphere((0,0,Fht/2),Fht/2);
// draw(surface(sph),green+white+opacity(0.5));
// triple f(pair t) {return (t.x*cos(t.y),t.x*sin(t.y),t.x^(1/n)*sin(t.y/n));}
triple f(pair t) {
triple v0 = Brad*(cos(t.x),sin(t.x),0);
triple v1 = brad*(cos(t.x),sin(t.x),0)+(0,0,Fht);
return (v0 + t.y*(v1-v0));
}
triple g(pair t) {
return (t.y*cos(t.x),t.y*sin(t.x),0);
}
surface sback=surface(f,(3pi/4,0),(7pi/4,1),80,2);
surface sfront=surface(f,(7pi/4,0),(11pi/4,1),80,2);
surface base = surface(g,(0,0),(2pi,Brad),80,2);
draw(sback,gray(0.9));
draw(sfront,gray(0.5));
draw(base,gray(0.9));
draw(surface(sph),gray(0.4));
\end{asy}
\end{center}

what I mean is, if I put the one at the end back to item 2,
the document would not produce the 3D graph in item 1.
Why is that the case??




\end{enumerate}
%%
%%
\end{document}
%%
%%
\item 
%%%% if this is Item 2 - neither graph would compile - only asy files are produced.
%%%% only works when it is item 1 (but then the 3D graph would not be produced)!!!
\begin{center}
\begin{asy}
unitsize(0.15cm);
fill((0,0)--(2,0)--(2,26)--(0,26)--cycle,gray);
fill((6,0)--(8,0)--(8,26)--(6,26)--cycle,gray);
fill((12,0)--(14,0)--(14,26)--(12,26)--cycle,gray);
fill((18,0)--(20,0)--(20,26)--(18,26)--cycle,gray);
fill((24,0)--(26,0)--(26,26)--(24,26)--cycle,gray);
fill((0,0)--(26,0)--(26,2)--(0,2)--cycle,gray);
fill((0,12)--(26,12)--(26,14)--(0,14)--cycle,gray);
fill((0,24)--(26,24)--(26,26)--(0,26)--cycle,gray);
\end{asy}
\end{center}

使用以下方式编译时(在 ```Notepad++`` 中)

pdflatex $(NAME_PART).tex
asy -v $(NAME_PART)-*.asy
pdflatex $(NAME_PART).tex
pdflatex $(NAME_PART).tex

它将生成最终的 pdf,并附有正确的 3D 图片。 在此处输入图片描述

但如果我把项目2返回时,两个图表均不会显示。

如果我把项目2作为项目1(没有3D代码)可以生成2D图片,但是不能生成3D图形。 在此处输入图片描述

为什么?我该如何修复它?以便两者都可以被编译并生成一个 PDF 文件。

相关内容