\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}
你會得到