2

I was working on a project and was trying to give Tikz-cd a shot but I was having trouble with adding a curved arrow beneath from one end to the other.

I have done something similar to this between two nodes before just using tikz, but since nodes aren't necessarily defined the same way when using tikz-cd I wasn't sure how I should go back and add the line. I included the regular tikz example to show how I had done it before and my new diagram exactly as it should appear except for another curved line from 0 to 0. Can anyone help explain how to do this in the new setting? Also, the new arrow does not need to be a \mapsto arrow, but ideally would be.

mwe:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx,tikz,tikz-cd}
\usepackage[margin=2.25cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Tikz vs. Tikz-cd}
\cfoot{}
\begin{document}
I have done this using just Tikz in the past.
\[\begin{tikzpicture}[node distance=2cm]
    \node (Q1){$0$};
    \node[right of=Q1] (Q2){$L$};
    \node[right of=Q2] (Q3){$M$};
    \node[right of=Q3] (Q4){$N$};
    \node[right of=Q4] (Q5){$0$};
    \draw[->,thick] (Q1) -- (Q2);
    \draw[->,thick] (Q2) -- node[pos=.5,above]{$\psi$}(Q3);
    \draw[->,thick] (Q3) -- node[pos=.5,above]{$\varphi$}(Q4);
    \draw[->,thick] (Q4) --(Q5);
    \draw [bend left,->,dashed] (Q4) to node[pos=.5,below]{$\alpha$}(Q3);
    \draw [bend left,->,dashed] (Q3) to node[pos=.5,below left]{$\beta$}(Q2);
\end{tikzpicture}\]

Now I am trying to switch to using Tikz-cd, and I would like to add a curved under arrow from the zero on one end to the other. I have been able to solve the rest of it but I am not very fluent with the tikz-cd syntax yet.

\[\begin{tikzcd}[node distance=2cm]
   0 \arrow[mapsto]{r}{\varphi^{(1)}_{1}}
& 24 \arrow[mapsto]{r}{\varphi^{(1)}_{1}}
& 17 \arrow[mapsto]{r}{\varphi^{(1)}_{1}}
& 18 \arrow[mapsto]{r}{\varphi^{(1)}_{1}}
& 0
\end{tikzcd}\]

\end{document}

Okay, I was able to add this line:

& 0 \arrow[mapsto, bend left]{l}

which got me the curved line, but only back one node instead of 4 if that helps.

4

tikz-cd basically a matrix of nodes or, in other words, a table. So if you write \arrow[mapsto, bend left]{l} it goes left (l) only one node, because you're indicating only one cell.

Replace it with \arrow[mapsto, bend left]{llll}.

enter image description here

  • Excellent, that makes sense. I remember reading something in the docs about it having some kind of node matrix but that aspect hadn’t' leapt out at me. – Tristen Mar 25 '16 at 19:56
1

This can be another approach with tikz-cd. enter image description here

\documentclass[a4paper,12pt]{article}

\usepackage{tikz-cd,amsmath,amssymb}

\begin{document}
\begin{tikzcd}
0 \arrow[r, "\varphi^{(1)}_{1}", maps to] & 24 \arrow[r, "\varphi^{(1)}_{1}", maps to] & 17 \arrow[r, "\varphi^{(1)}_{1}", maps to] & 18 \arrow[r, "\varphi^{(1)}_{1}", maps to] & 0 \arrow[llll, maps to, bend left]
\end{tikzcd}
\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.