![在 Tikz 中绘制 G 的子群格](https://linux22.com/image/449685/%E5%9C%A8%20Tikz%20%E4%B8%AD%E7%BB%98%E5%88%B6%20G%20%E7%9A%84%E5%AD%90%E7%BE%A4%E6%A0%BC.png)
由于我是 tikz 的新手,我尝试在 G 中绘制子群格,但很难让它工作。我尝试过的
\begin{figure}
\begin{tikzpicture}[node distance=2cm]
\title{Untergruppenverband der $A_4$}
\node(G) {$G$};
\node(81) [below left of=G] {$\langle\sigma^2,\tau\rangle$};
\node(82) [below of=G] {$\langle\sigma\rangle$};
\node(83) [below right of=G] {$\langle\sigma^2,\tau\sigma\rangle$};
\node(41) [below left of=81] {$\langle\tau\sigma^2,\sigma^4\rangle$};
\node(42) [below of=81] {$\langle\tau,\sigma^4\rangle$};
\node(43) [below of=82] {$\langle\sigma^2\rangle$};
\node(44) [below of=83] {$\langle\tau\sigma\rangle$};
\node(45) [below right of=83] {$\langle\tau\sigma^3$};
\node(21) [below right of=41] {$\langle\tau\sigma^6\rangle$}
\node(22) [below of=41] {$\langle\tau\sigma^2\rangle$}
\node(23) [below of=42] {$\langle\tau\sigma^4\rangle$}
\node(24) [below right of=42] {$\tau$}
\node(25) [below of=43] {$\sigma^4$}
\node(1) [below of=25] {$1$}
\draw(G) -- (81);
\draw(G) -- (82);
\draw(G) -- (83);
\draw(81) -- (41);
\draw(81) -- (42);
\draw(81) -- (43);
\draw(82) -- (43);
\draw(83) -- (43);
\draw(83) -- (44);
\draw(83) -- (45);
\draw(41) -- (21);
\draw(41) -- (22);
\draw(41) -- (25);
\draw(42) -- (23);
\draw(42) -- (24);
\draw(42) -- (25);
\draw(21) -- (1);
\draw(22) -- (1);
\draw(23) -- (1);
\draw(24) -- (1);
\draw(24) -- (1);
\end{tikzpicture}
\caption{Lattice of subgroups of G}
\end{figure}
答案1
您已经非常接近了。使用positioning
库。那么正确的语法是below=of G
,而不是below of=G
。节点距离是沿对角线测量的,这会阻止行对齐,因此只能使用left
、right
和 来定位节点below
。这需要重新排序。
最后,您可能想要使用单个绘图命令,这样如果您想更改所有线条的样式,您只需执行一次,例如\draw[thick]
。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[node distance=1cm]
\node(G) {$G$};
\node(82)[below=of G] {$\langle\sigma\rangle$};
\node(81)[left=of 82] {$\langle\sigma^2,\tau\rangle$};
\node(83)[right=of 82] {$\langle\sigma^2,\tau\sigma\rangle$};
\node(42)[below=of 81] {$\langle\tau,\sigma^4\rangle$};
\node(41)[left=of 42] {$\langle\tau\sigma^2,\sigma^4\rangle$};
\node(43)[below=of 82] {$\langle\sigma^2\rangle$};
\node(44)[below=of 83] {$\langle\tau\sigma\rangle$};
\node(45)[right=of 44] {$\langle\tau\sigma^3\rangle$};
\node(25)[below=of 43] {$\langle\sigma^4\rangle$};
\node(24)[left=of 25] {$\langle\tau\rangle$};
\node(23)[left=of 24] {$\langle\tau\sigma^4\rangle$};
\node(22)[left=of 23] {$\langle\tau\sigma^2\rangle$};
\node(21)[left=of 22] {$\langle\tau\sigma^6\rangle$};
\node(1)[below=of 25] {$\{1\}$};
\draw(G)--(81)
(G)--(82)
(G)--(83)
(81)--(41)
(81)--(42)
(81)--(43)
(82)--(43)
(83)--(43)
(83)--(44)
(83)--(45)
(41)--(21)
(41)--(22)
(41)--(25)
(42)--(23)
(42)--(24)
(42)--(25)
(43)--(25)
(21)--(1)
(22)--(1)
(23)--(1)
(24)--(1)
(24)--(1)
(25)--(1);
\end{tikzpicture}
\end{document}