如何将两幅 asy 图像放在一起?你使用 wrap-fig 吗?
\begin{center}
\begin{asy}
unitsize(0.98cm);
draw(Label("x",Relative(0.98)),(-5,0)--(5,0),Arrows);
draw(Label("y",Relative(0.98),align=LeftSide),(0,-5)--(0,5),Arrows);
real margin=.1;
for (int a : new int[]{-4,-3,-2,-1,1,2,3,4}){
draw((a,0)-(0,margin)--(a,0)+(0,margin));
draw((0,a)-(margin,0)--(0,a)+(margin,0));
}
draw((-3,4)--(1,-4)--(5,4));
\end{asy}
\end{center}
\begin{center}
\begin{asy}
unitsize(0.98cm);
draw(Label("x",Relative(0.98)),(-5,0)--(5,0),Arrows);
draw(Label("y",Relative(0.98),align=LeftSide),(0,-5)--(0,5),Arrows);
real margin=.1;
for (int a : new int[]{-4,-3,-2,-1,1,2,3,4}){
draw((a,0)-(0,margin)--(a,0)+(0,margin));
draw((0,a)-(margin,0)--(0,a)+(margin,0));
}
draw((-1,4)--(1,-4)--(3,4));
\end{asy}
\end{center}
答案1
副标题是你的朋友。
\usepackage{subcaption}
使它们变小,以便可以彼此相邻。
\begin{figure}
\begin{subfigure}{0.4\textwidth}
\begin{asy}[width=\textwidth]
unitsize(0.98cm);
draw(Label("x",Relative(0.98)),(-5,0)--(5,0),Arrows);
draw(Label("y",Relative(0.98),align=LeftSide),(0,-5)--(0,5),Arrows);
real margin=.1;
for (int a : new int[]{-4,-3,-2,-1,1,2,3,4}){
draw((a,0)-(0,margin)--(a,0)+(0,margin));
draw((0,a)-(margin,0)--(0,a)+(margin,0));
}
draw((-3,4)--(1,-4)--(5,4));
\end{asy}
\caption{Figure a}
\end{subfigure}
\hfill
\begin{subfigure}{0.4\textwidth}
\begin{asy}[width=\textwidth]
unitsize(0.98cm);
draw(Label("x",Relative(0.98)),(-5,0)--(5,0),Arrows);
draw(Label("y",Relative(0.98),align=LeftSide),(0,-5)--(0,5),Arrows);
real margin=.1;
for (int a : new int[]{-4,-3,-2,-1,1,2,3,4}){
draw((a,0)-(0,margin)--(a,0)+(0,margin));
draw((0,a)-(margin,0)--(0,a)+(margin,0));
}
draw((-1,4)--(1,-4)--(3,4));
\end{asy}
\caption{Figure b}
\end{subfigure}
\end{figure}