\documentclass{beamer}
\usepackage{tikz-cd}
\usetikzlibrary{matrix}
\begin{document}
\begin{frame}[fragile]
\begin{center}
\begin{tikzcd}[row sep=2.3cm, column sep =
2.3cm]
A\arrow{r}{e}\arrow{d}[swap]{f} & B\arrow{r}
{e1} \arrow{d}{g} &B1 \arrow{d}{g1}\\
C\arrow{r}[swap]{h} & D \arrow{r}[swap]
{h}&D1\\
\end{tikzcd}
\end{center}
\end{frame}
\end{document}
在这里我想将每个箭头改为双箭头/平行箭头。我正在使用Leftrightarrow
选项,例如,\arrow{r, Leftrightarrow}
但出现错误。
如能提供任何帮助解决该问题,我们将不胜感激。
答案1
您可以使用该选项arrows=Leftrightarrow
\documentclass{beamer}
\usepackage{tikz-cd}
\usetikzlibrary{matrix}
\begin{document}
\begin{frame}[fragile]
\begin{center}
\begin{tikzcd}[
row sep=2.3cm,
column sep=2.3cm,
arrows=Leftrightarrow,
]
A\arrow{r}{e}\arrow{d}[swap]{f} & B\arrow{r}
{e1} \arrow{d}{g} &B1 \arrow{d}{g1}\\
C\arrow{r}[swap]{h} & D \arrow{r}[swap]
{h}&D1\\
\end{tikzcd}
\end{center}
\end{frame}
\end{document}
“现代”语法更简单:
\begin{tikzcd}[
row sep=2.3cm,
column sep=2.3cm,
arrows=Leftrightarrow,
]
A \arrow[r,"e"] \arrow[d,swap,"f"] &
B \arrow[r,"e1"] \arrow[d,"g"] &
B1 \arrow[d,"g1"]
\\
C \arrow[r,swap,"h"] & D \arrow[r,swap,"h"] &
D1
\end{tikzcd}
说只有左上角的箭头应该是Leftrightarrow
;那么它可以输入为
\arrow[r,Leftrightarrow,"e"]
例如,
\begin{tikzcd}[
row sep=2.3cm,
column sep=2.3cm,
]
A \arrow[r,Leftrightarrow,"e"] \arrow[d,swap,"f"] &
B \arrow[r,"e1"] \arrow[d,"g"] &
B1 \arrow[d,"g1"]
\\
C \arrow[r,swap,"h"] & D \arrow[r,swap,"h"] &
D1
\end{tikzcd}
你会得到