以下是 MacLane 的经典著作《工作数学家的范畴》中的片段:
下面是另一个稍微复杂一点的例子:
是否有一个包可以允许(希望轻松)排版此类东西?
PS:我一直在使用几个软件包来制作交换图(amscd、tikz-cd),这对于范畴论中的很多东西来说已经足够了。但上面的图片实际上并不是“交换图”,而是别的东西。我甚至不知道如何称呼它,所以在网上查找它有点麻烦。谢谢。
答案1
以下是我的版本,也使用tikz-cd
:
% arara: pdflatex
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}
C \ar[shift left=7pt, ""{name=UL, below}]{r}{S} \ar[shift right=7pt, ""name=LL]{r}[swap]{T\vphantom{'}} &
B \ar[shift left=7pt, ""{name=UR, below}]{r}{S'} \ar[shift right=7pt, ""name=LR]{r}[swap]{T'} &
A\\
\ar[from=UL, to=LL, "r", shorten <= -2pt, shorten >= -2pt]
\ar[from=UR, to=LR, "r\smash{'}", shorten <= -2pt, shorten >= -2pt]
\end{tikzcd}\]
\[\begin{tikzcd}
C \ar[shift left=10pt, ""{name=UL, below}]{r} \ar[shift right=10pt, ""name=LL]{r} \ar[""name=ML, ""{name=MLL, below}]{r} &
B \ar[shift left=10pt, ""{name=UR, below}]{r} \ar[shift right=10pt, ""name=LR]{r} \ar[""name=MR, ""{name=MLR, below}]{r} &
A\\
\ar[from=UL, to=ML, "\sigma", shorten <= -3pt, shorten >= -3pt]
\ar[from=UR, to=MR, "\sigma\smash{'}", shorten <= -3pt, shorten >= -3pt]
\ar[from=MLL, to=LL, "\tau", shorten <= -3pt, shorten >= -3pt]
\ar[from=MLR, to=LR, "\tau\smash{'}", shorten <= -3pt, shorten >= -3pt]
\end{tikzcd}\]
\end{document}
答案2
我认为你可以使用 tikz-cd 来制作这种图表。例如,使用
\documentclass[preview,border=1pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-cd}
\begin{document}
%% Hint for the positions: L=left, R=right, U=up D=down
\begin{tikzcd}
C \arrow[bend left=80]{r}[name=LUU, below]{}
\arrow{r}[name=LUD]{}
\arrow[swap]{r}[name=LDU]{}
\arrow[bend right=80]{r}[name=LDD]{}
\arrow[Rightarrow,to path=(LUU) -- (LUD)\tikztonodes]{r}{\sigma}
\arrow[Rightarrow,to path=(LDU) -- (LDD)\tikztonodes]{r}{\tau}
&
B
\arrow[bend left=80]{r}[name=RUU, below]{}
\arrow{r}[name=RUD]{}
\arrow[swap]{r}[name=RDU]{}
\arrow[bend right=80]{r}[name=RDD]{}
\arrow[Rightarrow,to path=(RUU) -- (RUD)\tikztonodes]{r}{\sigma'}
\arrow[Rightarrow,to path=(RDU) -- (RDD)\tikztonodes]{r}{\tau'}
& A
\end{tikzcd}
\end{document}
答案3
使用 MetaPost 的解决方案可能如下所示:
u:=1.8cm; % Horizontal scale
s:=6pt; % shift from letters
h:=10pt; % height
label(btex $C$ etex, (0,0));
label(btex $B$ etex, (u,0));
label(btex $A$ etex, (2u,0));
drawarrow ((s,0)--(u-s,0)) shifted (0,-h);
drawarrow ((s,0)--(u-s,0)) shifted (0,h);
drawarrow ((u+s,0)--(2u-s,0)) shifted (0,-h);
drawarrow ((u+s,0)--(2u-s,0)) shifted (0,h);
label.top(btex $\strut S$ etex, (0.5u,h));
label.bot(btex $\strut T$ etex, (0.5u,-h));
drawarrow ((0.5u,0.8h)--(0.5u,-0.8h));
label.rt(btex $\strut\tau$ etex, (0.5u,0));
label.top(btex $\strut S'$ etex, (1.5u,h));
label.bot(btex $\strut T'$ etex, (1.5u,-h));
drawarrow ((1.5u,0.8h)--(1.5u,-0.8h));
label.rt(btex $\strut\tau'$ etex, (1.5u,0));
结果如下:
答案4
带有堆栈。
\documentclass{article}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\stackMath
\def\xtnd{-\kern-5pt-\kern-5pt}
\setstackgap{L}{.45\baselineskip}
\begin{document}
\[C
\mathop{\raisebox{1pt}{\Centerstack{
S\\
\xtnd\rightarrow\\
\raisebox{.5pt}{$\scalebox{.8}{$\downarrow$}\scriptstyle\tau$}\\
\xtnd\rightarrow\\
T}}}
B
\mathop{\raisebox{1pt}{\Centerstack{
S'\\
\xtnd\rightarrow\\
\raisebox{.5pt}{$\scalebox{.8}{$\downarrow$}\scriptstyle\tau'$}\\
\xtnd\rightarrow\\
T'}}}
A\]
\[C
\mathop{\Centerstack{
\xtnd\rightarrow\\
\raisebox{.5pt}{$\scalebox{.8}{$\downarrow$}\scriptstyle\sigma$}\\
\xtnd\rightarrow\\
\raisebox{.5pt}{$\scalebox{.8}{$\downarrow$}\scriptstyle\tau$}\\
\xtnd\rightarrow}}
B
\mathop{\Centerstack{
\xtnd\rightarrow\\
\raisebox{.5pt}{$\scalebox{.8}{$\downarrow$}\scriptstyle\sigma'$}\\
\xtnd\rightarrow\\
\raisebox{.5pt}{$\scalebox{.8}{$\downarrow$}\scriptstyle\tau'$}\\
\xtnd\rightarrow}}
A\]
\end{document}