更改 tikzcd 中箭头的角度

更改 tikzcd 中箭头的角度

我有以下交换图的代码。

交换图

\begin{tikzcd}[column sep=huge, row sep=huge]
    & G/A \arrow[dl, "\pi"] \arrow[dr, "\sigma"] \arrow[dd, "\omega"]& \\
    G \arrow[dr, "\rho"] & & (G/A)/(B/A) \arrow[dl, "\theta"] \\
    & G/B &
\end{tikzcd}

如您所见,它不太对称。您如何才能改变箭头的角度,使两侧的角度相同?

答案1

可以使用between origins,但是列间距要大一些。

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[column sep={6em,between origins}, row sep=huge]
& G/A \arrow[dl, "\pi"] \arrow[dr, "\sigma"] \arrow[dd, "\omega"] & \\
G \arrow[dr, "\rho"] & & (G/A)/(B/A) \arrow[dl, "\theta"] \\
& G/B &
\end{tikzcd}

\end{document}

在此处输入图片描述

答案2

您可以使用minimum width来设置最小距离。对于标签位置,您可以使用anchor=center和某个xshift,yshift常数1em

这是我的建议。我认为它不是 100% 对称,但差不多。

在此处输入图片描述

\documentclass{standalone}
\usepackage{tikz-cd}
\begin{document}
    \begin{tikzcd}[minimum width=5em,column sep=scriptsize, row sep=scriptsize]
& G/A \arrow{dd}[anchor=center,xshift=1ex,yshift=0ex]{\omega} 
\arrow{dr}[anchor=center,xshift=1ex,yshift=1ex]{\sigma} 
\arrow{dl}[anchor=center,xshift=-1ex,yshift=1ex]{\pi}
&  \\
G  \arrow{dr}[anchor=center,xshift=-1ex,yshift=-1ex]{\psi} &
& (G/A)/(B/A)  \arrow{dl}[anchor=center,xshift=1ex,yshift=-1ex]{\omega}\\
 & G/B 
& 
\end{tikzcd}
\end{document}

答案3

另一种解决方案:

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz-cd}

\begin{document}
 \begin{tikzcd}[column sep=huge, row sep=huge]
    & G/A \arrow[dl, "\pi", swap] \arrow[dr, to path={ -- node[midway,above right=-1pt] {\scriptsize $\sigma$}  (\tikztotarget.north west)}] \arrow[dd, "\omega", below]& \\
    G \arrow[dr, to path={-- node[midway,below left] {\scriptsize $\rho$} (\tikztotarget)}] & & (G/A)/(B/A) \arrow[dl, to path={(\tikztostart.south west) -- node[midway,below right] {\scriptsize $\theta$} (\tikztotarget)}] \\
    & G/B &
\end{tikzcd}
\end{document}

在此处输入图片描述

相关内容