4

I'm writing a code with Tikz-cd. I want to make a lattice diagram such that I want to connect a label in the third row with a label in the first row. Here's the code and the output:

\documentclass[11pt,amssymb]{amsart}



\usepackage{sansmathaccent} 
\pdfmapfile{+sansmathaccent.map}
\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule 
in tables
\usepackage{xcolor}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{wrapfig}
\usepackage{empheq}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{amsthm}

\usepackage{fullpage}

\usepackage{tikz-cd}


\begin{document}


The following diagram gives the lattice diagram of $\mathbb{Z}_{12}$,
\begin{equation}
\begin{tikzcd}[column sep=1em,row sep=1.5em]
& \langle 1 \rangle = \mathbb{Z}_{12} \\
&& \langle 2 \rangle \arrow[ul] \\
\langle 3 \rangle \arrow[urr] 
\end{tikzcd}
\end{equation}
\end{document}

Output:

enter image description here

I want to be able to connect $\langle 3 \rangle 1$ directly with the label $\mathbb{Z}_{12}$.

Any ideas?

  • 1
    Maybe \arrow[uur] (2 up and 1 right). – Sigur Nov 5 '17 at 18:52
  • @Sigur Would you like to post an answer? – CarLaTeX Dec 2 '17 at 20:41
3

To direct the arrow up two rows and right one column, use \arrow[uur].

enter image description here

Similarly, \arrow[uuurr] will direct the arrow up 3 rows and right 2 columns, as in the arrow from <6> to <2>.

I changed the row sep and column sep values since I thought the diagram looked better if it was a bit wider relative to its height. That is just my opinion. However, it is good practice not to use em units for vertical spacing. If you want vertical spacing that adjusts to font size changes, use ex units instead. 1em is approximately the width of a capital M in the current font, whereas 1ex is approximately the height of a lower-case x. I changed both units to cm, which will not be affected by font size.

Here is the complete code:

\documentclass{article}

\usepackage{tikz-cd,amsfonts}

\begin{document}

The following diagram gives the lattice diagram of $\mathbb{Z}_{12}$,
\begin{equation}
\begin{tikzcd}[column sep=1cm,row sep=.3cm]
& \langle 1 \rangle = \mathbb{Z}_{12} \\
&& \langle 2 \rangle \arrow[ul] \\
\langle 3 \rangle \arrow[uur] \\
&& \langle 4 \rangle \arrow[uu] \\
\langle 6 \rangle \arrow[uu] \arrow[uuurr] \\
& \langle 0 \rangle \arrow[ul] \arrow[uur]
\end{tikzcd}
\end{equation}

\end{document}
1

enter image description here

\documentclass[11pt,amssymb]{amsart}

\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule 
\usepackage{xcolor}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{amsmath, amssymb}
\usepackage{wrapfig}
\usepackage{empheq}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{amsthm}

\usepackage{fullpage}

\usepackage{tikz-cd}


\begin{document}

The following diagram gives the lattice diagram of $\mathbb{Z}_{12}$,
\begin{equation}
\begin{tikzcd}
  & \langle 1 \rangle = \mathbb{Z}_{12} &  \\
 &  & \langle 2 \rangle \arrow[lu] \\
\langle 3 \rangle \arrow[rru] \arrow[ruu] &  & 
\end{tikzcd}
\end{equation}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.