我希望我的 tikzcd 图中的所有箭头都有标签,如下例所示。
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[sep = large]
T
\arrow[drr, bend left, "x" description]
\arrow[ddr, bend right, "y" description]
\arrow[dr, dotted, "{(x,y)}" description] & & \\
& X \times_Z Y \arrow[r, "p" description] \arrow[d, "q" description] & X
\arrow[d, "f" description] \\
& Y \arrow[r, "g" description] & Z
\end{tikzcd}
\end{document}
但我不想写所有这些“描述”。是否可以为 tikzcd 环境设置一个选项,使其成为默认值?是否也可以为 \arrow 设置一个选项,以恢复该箭头的正常行为?
答案1
使用labels=description
:
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[sep = large,labels=description]
T
\arrow[drr, bend left, "x"]
\arrow[ddr, bend right, "y"]
\arrow[dr, dotted, "{(x,y)}"] & & \\
& X \times_Z Y \arrow[r, "p"] \arrow[d, "q"] & X
\arrow[d, "f"] \\
& Y \arrow[r, "g"] & Z
\end{tikzcd}
\end{document}