我正在尝试复制这张图片
% impsurfsmooth.tex :
%
\documentclass[10pt,a4paper]{article}
\usepackage{lmodern}
\usepackage{subcaption}
\usepackage{asypictureB}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{asyheader}
settings.outformat="png";
settings.render=8;
import graph3;
import smoothcontour3;
pen bpen = rgb(0.75, 0.7, 0.1);
material m = material(diffusepen=0.7bpen, ambientpen=bpen, emissivepen=0.3*bpen,
specularpen=0.999white, shininess=1.0);
\end{asyheader}
%
\begin{document}
%
\begin{figure}
\captionsetup[subfigure]{justification=centering}
\centering
\begin{subfigure}[b]{0.49\textwidth}
\begin{asypicture}{name=ellipsoid}
size(200,0);
currentprojection = orthographic(9,10,4);
// ellipsoid
real f(real x, real y, real z) {
return (x^2)/(2^2) + (y^2)/(3^2) + (z^2)/(2^2) - 1;
}
draw(implicitsurface(f, (-3,-3,-3), (3,3,3), overlapedges=true), surfacepen=m);
xaxis3(Label("$x$",1),-4,4,red);
yaxis3(Label("$y$",1),-4,4,red);
zaxis3(Label("$z$",1),-4,4,red);
\end{asypicture}
%
\caption{$(\frac{x}{2})^2+(\frac{y}{3})^2+(\frac{z}{2})^2= 1$ (ellipsoid)}
\label{fig:1a}
\end{subfigure}
%
\begin{subfigure}[b]{0.49\textwidth}
\begin{asypicture}{name=hyperboliccylinder}
size(200,0);
currentprojection=orthographic(9,4,4);
// hyperbolic cylinder
real f(real x, real y, real z) {
return 2*x*y + 2*x*z - 1;
}
draw(implicitsurface(f, (-3,-3,-3), (3,3,3), overlapedges=true), surfacepen=m);
xaxis3(Label("$x$",1),-4,4,red);
yaxis3(Label("$y$",1),-4,4,red);
zaxis3(Label("$z$",1),-4,4,red);
\end{asypicture}
%
\caption{$2xy + 2xz = 1$ (hyperbolic cylinder)}
\label{fig:1b}
\end{subfigure}
\caption{}
\label{fig:1}
\end{figure}
%
\end{document}
%
% Process:
%
% pdflatex --shell-escape impsurfsmooth.tex
当我执行时pdflatex --shell-escape impsurfsmooth.tex
,我没有得到答案中显示的输出,而只是图形和子图标题。输出的相关部分是:
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
Attempting to run asy on impsurfsmooth-ellipsoid.asy
|
(/usr/local/texlive/2019/texmf-dist/tex/latex/lm/omllmm.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lm/omslmsy.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lm/omxlmex.fd)
Attempting to run asy on impsurfsmooth-hyperboliccylinder.asy
/
[1{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
Asymptote 产生两个错误文件,trial3-ellipsoid_errors.txt
和trial3-hyperboliccylinder_errors.txt
,但它们都是空的。
在 中impsurfsmooth.log
有以下内容:
\openout3 = `impsurfsmooth-temp.asy'.
runsystem(cp impsurfsmooth-temp.asy impsurfsmooth-ellipsoid.asy)...executed.
Attempting to run asy on impsurfsmooth-ellipsoid.asy
runsystem(asy -noV impsurfsmooth-ellipsoid.asy 2> impsurfsmooth-ellipsoid_error
s.txt)...executed.
! LaTeX Error: File `impsurfsmooth-ellipsoid' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.41 \end{asypicture}
I could not locate the file with any of these extensions:
.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPEG,.JBIG2,.JB2,.eps
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
有一个类似的部分抱怨impsurfsmooth-hyperboliccylinder
未找到该文件。
我在 TeXShop 中尝试了同样的操作,结果相同。我做错了什么?(我在 macOS 10.14.6 上运行 MacTeX 2019(完全最新)。)
编辑:我按照@Marijn的建议尝试直接在文件上运行 Asymptote。我从上面的示例中提取了以下内容:
settings.outformat="png";
settings.render=8;
import graph3;
import smoothcontour3;
pen bpen = rgb(0.75, 0.7, 0.1);
material m = material(diffusepen=0.7bpen, ambientpen=bpen, emissivepen=0.3*bpen,
specularpen=0.999white, shininess=1.0);
size(200,0);
currentprojection = orthographic(9,10,4);
// ellipsoid
real f(real x, real y, real z) {
return (x^2)/(2^2) + (y^2)/(3^2) + (z^2)/(2^2) - 1;
}
draw(implicitsurface(f, (-3,-3,-3), (3,3,3), overlapedges=true), surfacepen=m);
xaxis3(Label("$x$",1),-4,4,red);
yaxis3(Label("$y$",1),-4,4,red);
zaxis3(Label("$z$",1),-4,4,red);
使用 through 运行此命令asy -vv trial4.asy
似乎不会产生任何错误消息,但也不会产生任何输出。输出的最后几行是:
latex \scrollmode
latex -output-format=dvi \nonstopmode\input trial4_.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2018-12-01>
(./trial4_.tex (/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-def/dvips.def)))
No file trial4_.aux.
[1] [2] [3] (./trial4_.aux) )
Output written on trial4_.dvi (3 pages, 2312 bytes).
Transcript written on trial4_.log.
dvips -R -Pdownload35 -D600 -q -otrial4_.ps trial4_.dvi
gs -q -dBATCH -P -dSAFER -sDEVICE=eps2write -sOutputFile=/dev/null trial4_.ps
没有生成任何文件 - 甚至没有 trial4_.aux 或 trial4_.log。运行 with-vvv
不会给出任何线索(至少对我来说没有)。
编辑2:根据@Willie Wong 的建议,我改为settings.render=0;
,生成了此栅格化图像: