我想用 tikz-cd 绘制一个函子之间自然变换的组合图,如下所示
到目前为止我能做的最好的事情是由以下代码给出的:
\documentclass{article}
\usepackage{amsmath,amsfonts}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[row sep=huge]
\mathcal{A} \arrow[r, bend left=65, "F"]\arrow[r, "G", swap]\arrow[r, bend right=65, "H", swap] & \mathcal{B}.
\end{tikzcd}
\]
\end{document}
我想知道如何将 G 放在中间箭头上以及如何绘制垂直箭头\alpha
和\beta
。
答案1
以下是一个选项:
\documentclass{article}
\usepackage{amsmath,amsfonts}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[row sep=huge]
\mathcal{A}
\arrow[r, bend left=65, "F"{name=F}]
\arrow[r, "G"{inner sep=0,fill=white,anchor=center,name=G}]
\arrow[r, bend right=65, "H"{name=H, swap}]
\arrow[from=F.south-|G,to=G,Rightarrow,shorten=2pt,"\alpha"]
\arrow[from=G,to=H.north-|G,Rightarrow,shorten=2pt,"\beta"] &
\mathcal{B}.
\end{tikzcd}
\]
\end{document}
答案2
这是我的选项。现在有垂直对齐。
\documentclass{article}
\usepackage{amsmath,amsfonts}
\usepackage{tikz-cd}
\usepackage{mathrsfs}
\usepackage{graphicx}
\begin{document}
\[
\begin{tikzcd}[row sep=huge]
\mathscr{A} \arrow[r, "F"{sloped,above},"\hspace{0.15cm}\scalebox{1.5}{$\Downarrow$} \alpha"{sloped,below}, bend left=70] \arrow[r, "\hspace{0.15cm}\scalebox{1.5}{$\Downarrow$} \beta", "H"{sloped,below}, bend right=70] \arrow[r, "G" description] & \mathscr{B}
\end{tikzcd}
\]
\end{document}
或者与另一个包一起\usepackage{scalerel}
。
\documentclass{article}
\usepackage{amsmath,amsfonts}
\usepackage{tikz-cd}
\usepackage{mathrsfs}
\usepackage{scalerel}
\begin{document}
\[
\begin{tikzcd}[row sep=huge]
\mathscr{A} \arrow[r, "F"{sloped,above},"\hspace{0.15cm}\mathrel{\stretchto{\Downarrow}{2.6ex}} \alpha"{sloped,below}, bend left=65] \arrow[r, "\hspace{0.15cm}\mathrel{\stretchto{\Downarrow}{3ex}} \beta", "H"{sloped,below}, bend right=65] \arrow[r, "G" description] & \mathscr{B}
\end{tikzcd}
\]
\end{document}