答案1
\ar
作为( 的别名) 宏的选项\arrow
,您会发现u
= up、d
= down、l
= left 和r
=right。
要改变箭头的方向,只需反转这些选项并将\ar
宏定位在新的起点即可。
使用swap
(这使得标签放置在箭头的右侧,相对于其方向,参见包装文档,第 5 页),您可以指示放置标签的位置。
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
Original:
\[
\begin{tikzcd}[row sep=huge]
& S\ar[dl,"f_{x}",swap,sloped] \ar[dr,"f_{y}",sloped] \ar[d,dashed,"{(f_{x},f_{y})}" description] & \\
X & X\times Y\ar[l,"\pi_{X}"] \ar[r,"\pi_{Y}",swap] & Y
\end{tikzcd}
\]
With all arrows flipped:
\[
\begin{tikzcd}[row sep=huge]
& S & \\
X\ar[ur,"f_{x}",sloped] \ar[r,"\pi_{X}", swap] & X\times Y \ar[u,dashed,"{(f_{x},f_{y})}" description] & Y \ar[ul,"f_{y}", swap,sloped] \ar[l,"\pi_{Y}"]
\end{tikzcd}
\]
\end{document}