我正在寻找一些用于生成基本凯莱图的 LaTeX 代码的良好示例像这个:
理想情况下,我希望这些示例能够清楚地说明如何修改或删除图表的各种元素(标签、颜色、线条样式等),以及如何为不同的基本组生成图表。
答案1
TikZ 应该非常有用。这是一个在 latex 中“绘制”东西的包。我尝试复制你的图片,仍然有一些粗糙的边缘,但我认为它看起来相当不错。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{arrows,positioning}
\begin{tikzpicture} [%
nd/.style = {circle,fill=black,text=white,inner sep=1pt},
tn/.style = {node distance=1pt},
redarrow/.style={->, red, fill=none,>=stealth},
blueline/.style={-,blue,fill=none}]
\node[nd] (otl) at (0,0) {\sffamily F};
\node[nd] (itl) [below right=of otl] {\sffamily F};
\node[nd] (itr) [right=of itl] {\sffamily F};
\node[nd] (otr) [above right=of itr] {\sffamily F};
\node[nd] (ibl) [below=of itl] {\sffamily F};
\node[nd] (obl) [below left=of ibl] {\sffamily F};
\node[nd] (ibr) [right=of ibl] {\sffamily F};
\node[nd] (obr) [below right=of ibr] {\sffamily F};
\draw[redarrow] (otr) -- (otl);
\draw[redarrow] (otl) -- (obl);
\draw[redarrow] (obl) -- (obr);
\draw[redarrow] (obr) -- (otr);
\draw[redarrow] (itl) -- (itr);
\draw[redarrow] (itr) -- (ibr);
\draw[redarrow] (ibr) -- (ibl);
\draw[redarrow] (ibl) -- (itl);
\draw[blueline] (ibl) -- (obl);
\draw[blueline] (itl) -- (otl);
\draw[blueline] (ibr) -- (obr);
\draw[blueline] (itr) -- (otr);
\node[tn] [below right=of itl] {\tiny{$a$}};
\node[tn] [below left=of itr] {\tiny{$a^2$}};
\node[tn] [above left=of ibr] {\tiny{$a^3$}};
\node[tn] [above right=of ibl] {\tiny{$e$}};
\node[tn] [below left=of obl] {\tiny{$b$}};
\node[tn] [below=of obr] {\tiny{$ab=ba^3$}};
\node[tn] [above=of otl] {\tiny{$ba=a^3b$}};
\node[tn] [above=of otr] {\tiny{$a^2b=ba^2$}};
\end{tikzpicture}
\end{document}
看起来像
我通常会根据样式的用途来命名样式,但由于我不知道该图代表什么,所以我只是根据样式来命名它们。旋转仍然缺失,但我正在努力将其改正 ;)
编辑:
我让旋转等功能正常工作。由于语法有点难以阅读,我想我应该为图中的节点定义一个命令。我还修复了“标题”的文本高度,这样文本的丑陋偏移就消失了。只是上半部分发生了变化,但本着提供 MWE 的精神,我还再次复制了其余代码:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{arrows,positioning}
\newcommand{\nd}[4]{\node[nd] (#1) #2 [label={[white,rotate=#3]center:{\sffamily #4}}] {}};
\begin{tikzpicture} [%
nd/.style = {circle,fill=black,text=white,inner sep=4pt},
tn/.style = {node distance=1pt,text height=0.5ex},
redarrow/.style={->, red, fill=none,>=stealth},
blueline/.style={-,blue,fill=none}]
\nd{otl}{at (0,0)}{0}{F};
\nd{itl}{[below right=of otl]}{270}{F};
\nd{itr}{[right=of itl]}{0}{F};
\nd{otr}{[above right=of itr]}{90}{x};
\nd{ibl}{[below=of itl]}{90}{F};
\nd{obl}{[below left=of ibl]}{0}{e};
\nd{ibr}{[right=of ibl]}{180}{F};
\nd{obr}{[below right=of ibr]}{90}{F};
\draw[redarrow] (otr) -- (otl);
\draw[redarrow] (otl) -- (obl);
\draw[redarrow] (obl) -- (obr);
\draw[redarrow] (obr) -- (otr);
\draw[redarrow] (itl) -- (itr);
\draw[redarrow] (itr) -- (ibr);
\draw[redarrow] (ibr) -- (ibl);
\draw[redarrow] (ibl) -- (itl);
\draw[blueline] (ibl) -- (obl);
\draw[blueline] (itl) -- (otl);
\draw[blueline] (ibr) -- (obr);
\draw[blueline] (itr) -- (otr);
\node[tn] [below right=of itl] {\tiny{$a$}};
\node[tn] [below left=of itr] {\tiny{$a^2$}};
\node[tn] [above left=of ibr] {\tiny{$a^3$}};
\node[tn] [above right=of ibl] {\tiny{$e$}};
\node[tn] [below left=of obl] {\tiny{$b$}};
\node[tn] [below=of obr] {\tiny{$ab=ba^3$}};
\node[tn] [above=of otl] {\tiny{$ba=a^3b$}};
\node[tn] [above=of otr] {\tiny{$a^2b=ba^2$}};
\end{tikzpicture}
\end{document}
答案2
作为一名新手,我可以使用tikz
这个petri
库(不管它是什么)
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{petri}
\tikzset{state/.style={circle,draw=gray,inner sep=0pt,minimum size=7mm,label=center:$#1$,name=#1},
redarrow/.style={->, red, fill=none,>=stealth},bluearrow/.style={->, blue, fill=none,>=stealth},
redline/.style={-,red,fill=none},blueline/.style={-,blue,fill=none}}
\begin{tikzpicture}
\node[state=e]{};
\node[state=a,above=of e]{};
\node[state=a^2,right=of a]{};
\node[state=a^3,below=of a^2]{};
\node[state=b,below left=of e]{};
\node[state=ba^3,above left=of a]{};
\node[state=ba^2,above right=of a^2]{};
\node[state=ba,below right=of a^3]{};
\draw[redarrow](e)--(a);\draw[redarrow](b)--(ba);
\draw[redarrow](a)--(a^2);\draw[redarrow](ba)--(ba^2);
\draw[redarrow](a^2)--(a^3);\draw[redarrow](ba^2)--(ba^3);
\draw[redarrow](a^3)--(e);\draw[redarrow](ba^3)--(b);
\draw[blueline](e)--(b);
\draw[blueline](a)--(ba^3);
\draw[blueline](a^2)--(ba^2);
\draw[blueline](a^3)--(ba);
\end{tikzpicture}
得到这个:
答案3
以下是一个简单的尝试元帖子,使用两个内置转换命令:rotated t
和reflectedabout(p,q)
。
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
% define the image of the F to transform
s = 16;
picture f;
f = image(fill fullcircle scaled s; label("F" infont "cmss10" scaled 1.2,origin) withcolor white;);
% define the 8 points we need
% it's convenient to have the origin at the centre.
z1 = 50 right rotated -135;
z2 = z1 rotated -90;
z3 = z2 rotated -90;
z4 = z3 rotated -90;
z5 = 2z1;
z6 = 2z2;
z7 = 2z3;
z8 = 2z4;
% loop to draw the lines, arrows, and the F suitably transformed
% the cutbefore/cutafter parts shorten the arrows to avoid the discs
for i=0 upto 3:
draw z[i+1] -- z[5+i] withcolor blue;
n := (i+1) mod 4 + 1;
drawarrow z[i+1] -- z[n]
cutbefore fullcircle scaled s shifted z[i+1]
cutafter fullcircle scaled s shifted z[n]
withcolor red;
drawarrow z[n+4] -- z[i+5]
cutbefore fullcircle scaled s shifted z[n+4]
cutafter fullcircle scaled s shifted z[i+5]
withcolor red;
draw f rotated 90i shifted z[i+1];
draw f reflectedabout(up,down) rotated 90i shifted z[i+5];
endfor
% add suitable labels, carefully positioned.
label(btex $e$ etex, .7 z1);
label(btex $a$ etex, .7 z2);
label(btex $a^2$ etex, .7 z3);
label(btex $a^3$ etex, .7 z4);
label.bot(btex $b$ etex, z5-(0,s/2));
label.top(btex $ba=a^3b$ etex, z6+(0,s/2));
label.top(btex $ba^2=a^2b$ etex, z7+(0,s/2));
label.bot(btex $ba^3=ab$ etex, z8-(0,s/2));
endfig;
end.