如何绘制像这样的交换图?

如何绘制像这样的交换图?

我需要一个像这样的图表:

在此处输入图片描述

这是我目前得到的:

    \documentclass{article}
    \usepackage{amsmath}
    \usepackage{tikz}
    
    \begin{document}
    
    \begin{tikzpicture}[node distance=2cm, auto]
    \node (Lambda1) {$\Lambda$};
    \node(Sigma1) [right of=Lambda1] {$\Sigma_2$};
    \node (Lambda2) [below of=Lambda1] {$\Lambda$};
    \node (Sigma2) [below of=Sigma1] {$\Sigma_2$};
    \draw[->](Lambda1) to node {$S$}(Sigma1);
    \draw[->](Lambda2) to node [left] {$f_\mu$}(Lambda1);
    \draw[->](Sigma2) to node [right] {$\tau$}(Sigma1);
    \draw[->](Lambda2) to node [below] {$S$}(Sigma2);
    \end{tikzpicture}
    
    \end{document}

结果:

在此处输入图片描述

我不知道如何在构图中插入那些弯曲的箭头:

$ S \circ f_\mu$$\tau \circ S$

答案1

为了更好地观察行为,节点之间的距离稍微扩大一些,并且文本相同:

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[node distance=3cm, auto]
\node (Lambda1) {$\Lambda$};
\node(Sigma1) [right of=Lambda1] {$\Sigma_2$};
\node (Lambda2) [below of=Lambda1] {$\Lambda$};
\node (Sigma2) [below of=Sigma1] {$\Sigma_2$};
\draw[->](Lambda1) to node {$S$}(Sigma1);
\draw[->](Lambda2) to node [left] {$f_\mu$}(Lambda1);
\draw[->](Sigma2) to node [right] {$\tau$}(Sigma1);
\draw[->](Lambda2) to node [below] {$S$}(Sigma2);

\draw[->](Lambda2) to  [bend left=30] node [right,xshift=2pt] {$S\circ f_\mu$} (Sigma1);
\draw[->](Lambda2) to  [bend right=30] node [ left, xshift=-2pt] {$S\circ f_\mu$} (Sigma1);


\end{tikzpicture}

在此处输入图片描述

答案2

直接法tikz-cd

在此处输入图片描述

\documentclass{article}

\usepackage{tikz-cd}

\begin{document}

\[
  \begin{tikzcd}
    \Lambda & {\Sigma_2} \\
    \Lambda & {\Sigma_2}
    \arrow["S", from=1-1, to=1-2]
    \arrow["S"', from=2-1, to=2-2]
    \arrow["{f_\mu}", from=2-1, to=1-1]
    \arrow["\tau"', from=2-2, to=1-2]
    \arrow["{\scriptstyle S \circ f_\mu}"{marking}, bend left = 30pt, from=2-1, to=1-2]
    \arrow["{\scriptstyle \tau \circ S}"{marking}, bend right = 30pt, from=2-1, to=1-2]
  \end{tikzcd}
\]

\end{document}

更好的视觉效果,如果你有quiver.sty

在此处输入图片描述

\documentclass{article}

\usepackage{quiver}

\begin{document}

\[
  \begin{tikzcd}
    \Lambda & {\Sigma_2} \\
    \Lambda & {\Sigma_2}
    \arrow["S", from=1-1, to=1-2]
    \arrow["S"', from=2-1, to=2-2]
    \arrow["{f_\mu}", from=2-1, to=1-1]
    \arrow["\tau"', from=2-2, to=1-2]
    \arrow["{\scriptstyle S \circ f_\mu}"{marking}, shift right=1, curve={height=-12pt}, from=2-1, to=1-2]
    \arrow["{\scriptstyle \tau \circ S}"{marking}, shift left=1, curve={height=12pt}, from=2-1, to=1-2]
  \end{tikzcd}
\]

\end{document}

如果您希望标签偏离箭头,您可以沿 y 轴移动标签(请注意yshift):

\begin{tikzcd}
    \Lambda & {\Sigma_2} \\
    \Lambda & {\Sigma_2}
    \arrow["S", from=1-1, to=1-2]
    \arrow["S"', from=2-1, to=2-2]
    \arrow["{f_\mu}", from=2-1, to=1-1]
    \arrow["\tau"', from=2-2, to=1-2]
    \arrow["{\scriptstyle S \circ f_\mu}"{marking, yshift=-5pt}, shift right=1, curve={height=-12pt}, from=2-1, to=1-2]
    \arrow["{\scriptstyle \tau \circ S}"{marking, yshift=5pt}, shift left=1, curve={height=12pt}, from=2-1, to=1-2]
\end{tikzcd}

在此处输入图片描述

相关内容