用凯莱图制作图像

用凯莱图制作图像

我正在尝试将这张凯莱图的图片转换为乳胶,但我不知道如何创建自己的图像。有没有易于使用的软件可以让用户在乳胶中制作凯莱图?

谢谢。

凯莱图

答案1

这是你的凯莱图的一个版本元帖子luamplib

在此处输入图片描述

您需要编译下面的源代码才能lualatex使用内置的 Metapost 引擎。如果您使用的是不同的 LaTeX 引擎,您可以轻松地调整此解决方案以与普通的 Metapost 配合使用。请点击上面的链接了解详情。

当然,这是否“易于使用”取决于您的背景和技能。优点是您可以获得非常精确的结果。这个程序唯一棘手的部分是绘制连接的功能,但其中没有任何东西没有在上面链接的各种 Metapost 教程和手册中解释过。

\documentclass[border=5mm]{standalone}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Schola Math}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
    vardef connect(expr a,b, txt, shade) = 
      save p; path p; p = a { (b-a) rotated 24 } .. b;
      save m; numeric m; m = arctime (arclength(p)+ahlength)/2 of p;
      drawarrow subpath(0,m) of p cutbefore fullcircle scaled 20 shifted a withcolor shade;
      draw      subpath(m,1) of p cutafter  fullcircle scaled 20 shifted b withcolor shade;
      label(txt, point m of p shifted (unitvector(direction m of p) rotated 90 scaled 8)) withcolor shade;
    enddef;

    beginfig(1);
       path inside, outside;
       inside = reverse fullcircle scaled 100 rotated 90;
       z0 = point 0   of inside;
       z1 = point 1.6 of inside;
       z2 = point 3.2 of inside;
       z3 = point 4.8 of inside;
       z4 = point 6.4 of inside;

       outside = inside scaled 1.8;
       z10 = point 0   of outside;
       z11 = point 1.6 of outside;
       z12 = point 3.2 of outside;
       z13 = point 4.8 of outside;
       z14 = point 6.4 of outside;

       label("$e$"  , z0);
       label("$r_1$", z1); 
       label("$r_2$", z2); 
       label("$r_3$", z3); 
       label("$r_4$", z4); 

       label("$d_1$", z10);
       label("$d_4$", z11); 
       label("$d_2$", z12); 
       label("$d_5$", z13); 
       label("$d_3$", z14); 

       connect(z0,z1, "$r$", 1/2 red+blue);
       connect(z1,z2, "$r$", 1/2 red+blue);
       connect(z2,z3, "$r$", 1/2 red+blue);
       connect(z3,z4, "$r$", 1/2 red+blue);
       connect(z4,z0, "$r$", 1/2 red+blue);

       connect(z10,z11, "$r$", 1/2 red+blue);
       connect(z11,z12, "$r$", 1/2 red+blue);
       connect(z12,z13, "$r$", 1/2 red+blue);
       connect(z13,z14, "$r$", 1/2 red+blue);
       connect(z14,z10, "$r$", 1/2 red+blue);

       connect(z0,z10, "$d$", 2/3 blue); connect(z10,z0, "$d$", 2/3 blue);
       connect(z1,z11, "$d$", 2/3 blue); connect(z11,z1, "$d$", 2/3 blue);
       connect(z2,z12, "$d$", 2/3 blue); connect(z12,z2, "$d$", 2/3 blue);
       connect(z3,z13, "$d$", 2/3 blue); connect(z13,z3, "$d$", 2/3 blue);
       connect(z4,z14, "$d$", 2/3 blue); connect(z14,z4, "$d$", 2/3 blue);

    endfig;
\end{mplibcode}
\end{document}

答案2

可能并不完美,但却朝着正确的方向迈出了一步:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{decorations.markings,arrows.meta}
\begin{document}
\begin{tikzpicture}[mid arrow/.style={postaction={
  decoration={markings, mark=at position 0.5 with {\arrow{Triangle}}},
  decorate}},looseness=0.5]
\foreach \i [count=\j, count=\r from 0] in {1, 4, 2, 5, 3}{
   \node (d\j) at (90+72-\j*72:3) {$d_\i$};
   \node (r\j) at (90+72-\j*72:3/2) {$\ifnum\i=1e\else r_\r\fi$};
}
\foreach \i [evaluate={\j=int(mod(\i, 5)+1);}] in {1,...,5}{
  \draw [purple, mid arrow] (d\i) to [bend left] node [auto] {$r_1$} (d\j);
  \draw [purple, mid arrow] (r\i) to [bend left] node [auto] {$r_1$} (r\j);
  \draw [blue, mid arrow]   (r\i) to [bend left] node [auto] {$d_1$} (d\i);
  \draw [blue, mid arrow]   (d\i) to [bend left] node [auto] {$d_1$} (r\i);
} 
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容