# Straighten subgroup lattice

I would like to straighten out the top node and the bottom node so that they create a more tidy lattice. I found this post here, but I wasn't able to follow what was going on.

I just think that my subgroup diagram can be a bit...neater. For example, here is what my book's diagram looks like. How do I get my diagram to look more like the book diagram?

\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}


Be careful with such positioning options!

\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}


• what does [every node/.style={inner sep=1pt},node distance=1.5cm] do after \begin{tikzpicture}? – Evan Kim Apr 11 at 17:17
• @EvanKim node distance is already there. every node set the style for every nodes inside the picture, here I use option inner sep for every nodes. To know what this option does, simply change it to e.g. 2pt or 1ex, etc. – JouleV Apr 11 at 17:18

I love positioning but may not necessarily use it when things should be on a grid.

\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}


Or for Joule 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}


• I think only \langle 12 \rangle should be in the grid, not \langle 12 \rangle = \mathbb{Z}_{12}. – JouleV Apr 11 at 17:21
• @JouleV Thanks, maybe it should. Personally I find this clearer because these are the Z_N subgroups of Z_12. – marmot Apr 11 at 17:25