
Estaba trabajando en un proyecto e intentaba darle una oportunidad a Tikz-cd, pero tenía problemas para agregar una flecha curva debajo de un extremo al otro.
Hice algo similar a esto entre dos nodos antes de usar tikz, pero como los nodos no están necesariamente definidos de la misma manera cuando uso tikz-cd, no estaba seguro de cómo debía regresar y agregar la línea. Incluí el ejemplo normal de tikz para mostrar cómo lo había hecho antes y mi nuevo diagrama exactamente como debería aparecer excepto por otra línea curva de 0 a 0. ¿Alguien puede ayudarme a explicar cómo hacer esto en la nueva configuración? Además, no es necesario que la nueva flecha sea una \mapsto
flecha, pero lo ideal sería que lo fuera.
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{documento}
Bien, pude agregar esta línea:
& 0 \arrow[mapsto, bend left]{l}
lo que me dio la línea curva, pero solo retrocedió un nodo en lugar de 4 si eso ayuda.
Respuesta1
tikz-cd
básicamente una matriz de nodos o, en otras palabras, una tabla. Entonces si escribes \arrow[mapsto, bend left]{l}
va a la izquierda ( l
) solo un nodo, porque estás indicando solo una celda.
Reemplácelo con \arrow[mapsto, bend left]{llll}
.
Respuesta2
Este puede ser otro enfoque con tikz-cd
.
\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}