请看下面的例子:
\begin{center}
\begin{tikzcd}
x_1(k+1) \arrow{d}{x_1(k)} & \\
x_2(k+1) \arrow{d}{x_2(k)} & x_4(k+1) \arrow{lu}{x_1(k)} \arrow{l}{x_2(k)} \arrow[loop right]{l}{x_4(k)} \\
x_3(k+1) \arrow[ru, equal]{x_3(k)} & \\
\end{tikzcd}
\end{center}
并输出:
问题是我想在双线(x_3(k+1) 和 x_4(k+1) 之间)的两侧获得箭头。我该怎么做?
答案1
添加箭头并移动它。我会给图表留出更多空间,并改变大多数标签的侧面。
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\begin{equation*}
\begin{tikzcd}[row sep=3em,column sep=3em]
x_1(k+1) \arrow[d,swap,"x_1(k)"] & \\
x_2(k+1) \arrow[d,swap,"x_2(k)"] &
x_4(k+1)
\arrow[lu,swap,"x_1(k)"]
\arrow[l,swap,"x_2(k)"]
\arrow[l,loop right,"x_4(k)"]
\arrow[dl,shift right]
\\
x_3(k+1) \arrow[ru,shift right,swap,"x_3(k)"]
\end{tikzcd}
\end{equation*}
\end{document}
答案2
箭头类型是Leftrightarrow
您想要的吗?
\documentclass[tikz,border=4mm]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
x_1(k+1) \arrow{d}{x_1(k)} & \\
x_2(k+1) \arrow{d}{x_2(k)} & x_4(k+1) \arrow{lu}{x_1(k)} \arrow{l}{x_2(k)} \arrow[loop right]{l}{x_4(k)} \\
x_3(k+1) \arrow[ru, Leftrightarrow]{x_3(k)} & \\
\end{tikzcd}
\end{document}