
私はあるプロジェクトに取り組んでいて、Tikz-cd を試してみようとしていたのですが、端から端まで下に曲線の矢印を追加するのに苦労しました。
以前、tikz だけを使用して 2 つのノード間でこれと似たようなことをしたことがありますが、tikz-cd を使用する場合、ノードは必ずしも同じように定義されるとは限らないため、戻って線を追加する方法がわかりませんでした。 通常の tikz の例を含めて、以前に実行した方法と、0 から 0 への別の曲線を除いて、新しい図が正確に表示される方法を示しました。 新しい設定でこれを行う方法を説明できる人はいますか? また、新しい矢印は矢印である必要はありません\mapsto
が、理想的には矢印である必要があります。
私たち:
\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{ドキュメント}
はい、次の行を追加できました:
& 0 \arrow[mapsto, bend left]{l}
これにより、曲線が得られましたが、役立つかどうかはわかりませんが、4 つのノードではなく 1 つのノードのみが戻されます。
答え1
tikz-cd
基本的にはノードのマトリックス、つまりテーブルです。したがって、\arrow[mapsto, bend left]{l}
it goes left ( l
) と記述すると、1 つのセルのみを指定しているため、1 つのノードのみが指定されます。
に置き換えてください\arrow[mapsto, bend left]{llll}
。
答え2
これは、 を使用した別のアプローチになります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}