答案1
这个怎么样?
这是通过元帖子包裹在内luamplib
,因此您需要用 来编译它lualatex
。
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
vardef pentacycle(text t) =
save n; numeric n; n = 0;
save p; numeric p[];
for $ = t:
p[incr n] = $;
endfor
save w, z;
image(
for a = 1 upto n:
pair z, w;
z = 20 up rotated ((1-a) / n * 360);
w = 20 up rotated ((1-p[a]) / n * 360);
label(decimal a, z);
if abs (z-w) < eps:
drawarrow subpath (1, -5) of fullcircle
scaled 10 shifted z shifted 5 down;
else:
drawarrow z {w-z rotated 30} .. w
cutbefore fullcircle scaled 10 shifted z
cutafter fullcircle scaled 10 shifted w;
fi
endfor
)
enddef;
beginfig(1);
interim ahangle := 30;
draw pentacycle(2,3,1,4,5);
draw pentacycle(2,3,1,5,4) shifted 60 right;
draw pentacycle(2,3,4,5,1) shifted 120 right;
draw pentacycle(3,4,5,1,2) shifted 180 right;
endfig;
\end{mplibcode}
\end{document}