# Drawing subgroup lattice of G in Tikz

Since I am new to tikz I have made an attempt to draw the subgroup lattice in G, but struggling to make it work. what I have tried

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


Where the nodes 81-83 correspond to the nodes from left to right below G, in a similar fashion 41 corresponds to the first below 81 from the left. The desired result

• In the future, when you post a question, always provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output. May 6 at 19:19

You're pretty close. Use the positioning library. Then the correct syntax is below=of G, not below of=G. The node distance is measured along the diagonals, which is preventing the rows from lining up, so only position your nodes with left, right and below. This requires some reordering.

Lastly, you may want to use a single draw command, so that if you want to change the style of all the lines you only have to do it once, for example \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}

• This is great, I was thinking of making the lattice more compact like in my diagram, just so it takes less space in the latex document but this as good. Thank you!!! :) May 6 at 18:52