拉直子群格子

拉直子群格子

我想理顺顶部节点和底部节点,以便它们创建更整齐的格子。我找到了这篇文章这里,但我不明白到底发生了什么。这是我目前所拥有的

我只是觉得我的子组图可以稍微...整洁一点。例如,这是我的书的图。我如何让我的图看起来更像书的图?

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{amsfonts}


\begin{document}
\begin{figure}
\centering
\newcommand{\mydistance}{.6cm}
\begin{tikzpicture}[node distance=1.5cm]
\title{Subgroup Diagram of $Z_{12}$}
\node(A1)  {$\langle 12 \rangle = \mathbb{Z}_{12}$};
\node(A2) [below left of= A1] {$\langle 6 \rangle$};
\node(A3) [right of=A2] {$\langle 4 \rangle$};
\node(A4) [below left of=A2] {$\langle 3 \rangle$};
\node(A5) [below left of=A3] {$\langle 2 \rangle$};
\node(A6) [below right of=A4] {$\langle 1 \rangle$};

\draw(A1) -- (A2);
\draw(A1) -- (A3);
\draw(A2) -- (A4);
\draw(A2) -- (A5);
\draw(A3) -- (A5);
\draw(A4) -- (A6);
\draw(A5) -- (A6);
\end{tikzpicture}
\caption{Subgroup Diagram of $\mathbb{Z}_{12}$}
\end{figure}
\end{document}

答案1

对于这样的定位选项要小心!

\documentclass[tikz]{standalone}
\usepackage{amssymb}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[every node/.style={inner sep=1pt},node distance=1.5cm]
\node(A1)  {$\langle 12 \rangle$};
\node(A2) [below left of= A1] {$\langle 6 \rangle$};
\node(A3) [below right of=A1] {$\langle 4 \rangle$};
\node(A4) [below left of=A2] {$\langle 3 \rangle$};
\node(A5) [below left of=A3] {$\langle 2 \rangle$};
\node(A6) [below right of=A4] {$\langle 1 \rangle$};
\node[right=0pt of A1,inner xsep=0pt] {$= \mathbb{Z}_{12}$};
\draw(A1) -- (A2);
\draw(A1) -- (A3);
\draw(A2) -- (A4);
\draw(A2) -- (A5);
\draw(A3) -- (A5);
\draw(A4) -- (A6);
\draw(A5) -- (A6);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

我喜欢它positioning,但当事物应该在网格上时不一定使用它。

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{amsfonts}
\title{Subgroup Diagram of $Z_{12}$}


\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
 \begin{scope}[rotate=45,scale=1.5,transform shape,nodes={fill=white,transform
   shape=false}]
   \draw (0,0) grid (2,1);
   \path (2,1) node (A1)  {$\langle 12 \rangle = \mathbb{Z}_{12}$}
   (1,1) node (A2)  {$\langle 6 \rangle$}
   (0,1) node (A3)  {$\langle 3 \rangle$}
   (2,0) node (A4)  {$\langle 4 \rangle$}
   (1,0) node (A5)  {$\langle 2 \rangle$}
   (0,0) node (A6)  {$\langle 1 \rangle$};
 \end{scope}
\end{tikzpicture}
\caption{Subgroup Diagram of $\mathbb{Z}_{12}$}
\end{figure}
\end{document}

在此处输入图片描述

或者焦耳 V ;-)

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{amsfonts}
\title{Subgroup Diagram of $Z_{12}$}


\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
 \begin{scope}[rotate=45,scale=1.5,transform shape,nodes={fill=white,transform
   shape=false}]
   \draw (0,0) grid (2,1);
   \path (2,1) node[text width=2em] (A1)  {${\langle 12 \rangle=\mathbb{Z}_{12}}$}
   (1,1) node (A2)  {$\langle 6 \rangle$}
   (0,1) node (A3)  {$\langle 3 \rangle$}
   (2,0) node (A4)  {$\langle 4 \rangle$}
   (1,0) node (A5)  {$\langle 2 \rangle$}
   (0,0) node (A6)  {$\langle 1 \rangle$};
 \end{scope}
\end{tikzpicture}
\caption{Subgroup Diagram of $\mathbb{Z}_{12}$}
\end{figure}
\end{document}

在此处输入图片描述

答案3

与往常一样,通过 TikZ-CD 的矩阵在这里似乎很合适。

mathtools'\mathrlap不是最安全的(但在这里已经足够好了)。有关它的讨论,请参阅我的另一个答案

代码

\documentclass[tikz]{standalone}
\usepackage{mathtools, amsfonts}
\usetikzlibrary{cd}
\newcommand*\lrangled[1]{\langle#1\rangle}
\begin{document}
\begin{tikzcd}[column sep={3.5em,between origins}, arrows=dash]
 & & \lrangled{13} \mathrlap{{}=\mathbb Z_{12}}
                    \ar[ld] \ar[rd] & \\
 & \lrangled{6}     \ar[ld] \ar[rd]
   & & \lrangled{4} \ar[ld]         \\
\lrangled{3}                \ar[rd]
 & & \lrangled{2}   \ar[ld]         \\
 & \lrangled{1}
\end{tikzcd}
\end{document}

输出

在此处输入图片描述

相关内容