5

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. Here is what I have so far

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?

enter image description here

\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}
Evan Kim
  • 430

3 Answers3

4

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}

enter image description here

  • what does [every node/.style={inner sep=1pt},node distance=1.5cm] do after \begin{tikzpicture}? – Evan Kim Apr 11 '19 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. –  Apr 11 '19 at 17:18
3

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}

enter image description here

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}

enter image description here

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

As always, a matrix by way of TikZ-CD seems appropriate here.

mathtools' \mathrlap is not the safest (but here it's good enough). For a discussion about it, see another answer of mine.

Code

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

Output

enter image description here

Qrrbrbirlbel
  • 119,821