我怎样才能将这个 tikzcd 的两个副本放在同一行上?
\[
\begin{tikzcd}[row sep=2.5em]
& \text{A} \arrow[dash]{dr}{1} \\
\text{B} \arrow[dash]{ur}{2} \arrow[dash]{rr}{3} && \text{C}
\end{tikzcd}
\]
答案1
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[row sep=2.5em]
& \text{A} \arrow[dash]{dr}{1} \\
\text{B} \arrow[dash]{ur}{2} \arrow[dash]{rr}{3} && \text{C}
\end{tikzcd}
\quad
\begin{tikzcd}[row sep=2.5em]
& \text{A} \arrow[dash]{dr}{1} \\
\text{B} \arrow[dash]{ur}{2} \arrow[dash]{rr}{3} && \text{C}
\end{tikzcd}
\]
\end{document}
如果你有不同的图表,你可能需要使用该baseline
选项,
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[row sep=2.5em,baseline=(B.base)]
& \text{A} \arrow[dash]{dr}{1} & \\
|[alias=B]|\text{B} \arrow[dash]{ur}{2} \arrow[dash]{rr}{3} && \text{C}
\end{tikzcd}
\quad
\begin{tikzcd}[row sep=2.5em,baseline=(B.base)]
& \text{A} \arrow[dash]{dr}{1} &\\
|[alias=B]|\text{B} \arrow[dash]{ur}{2}
\arrow[dash]{dr}{4} \arrow[dash]{rr}{3} && \text{C} \\
& \text{D} &
\end{tikzcd}
\]
\end{document}
或者将图表\vcenter{\hbox{...}}
垂直居中放置。