幺半范畴中的弦图

幺半范畴中的弦图

我正在写一篇论文,其中有一章是关于某种单半群类别(即球面类别)的,我想在其中加入常见的态射图解。具体来说,我正在寻找某种方法来绘制如下图表: 在此处输入图片描述

(取自这张纸其中包含许多很好的例子)。现在,我搜索了一整天,就是找不到办法。我找到的唯一东西是编织包,但我认为它不能让你在左侧和右侧制作盖子和杯子X箭头。我开始变得非常绝望,如果有人知道如何绘制它们,我会很高兴接受任何建议!

答案1

这是一个使用选项TikZ

在此处输入图片描述

代码:

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{decorations.markings,arrows,arrows.meta}

\tikzset{
  myblock/.style={
    draw,text width=0.75cm,minimum height=2cm,align=center,
    append after command={node[fill,anchor=north west,minimum size=0.35cm] at (\tikzlastnode.north west) {}}
  },
  twoarrows/.style n args={4}{
    decoration={
      markings,
      mark=at position #1 with {\arrow{>}\node[above] {#3};}, 
      mark=at position #2 with {\arrow{>}\node[above] {#4};} 
    },
  postaction=decorate  
  },
  onearrow/.style 2 args={
    decoration={
      markings,
      mark=at position #1 with {\arrow{>}\node[above] {#2};}, 
    },
  postaction=decorate  
  },
}

\begin{document}

\begin{tikzpicture}
\node[myblock]
  (G) 
  {$g$};
\draw[rounded corners,twoarrows={0.07}{0.95}{$X$}{$X$}]
  ([shift={(0pt,10pt)}]G.south east) -|
  ([shift={(25pt,-20pt)}]G.south east) --
  ([shift={(-25pt,-20pt)}]G.south west) |-
  ([shift={(0pt,10pt)}]G.south west);
\draw[onearrow={0.5}{$A$}]
  ([shift={(-40pt,-15pt)}]G.north west) -- ([shift={(0pt,-15pt)}]G.north west);
\draw[onearrow={0.5}{$B$}]
  ([shift={(0pt,-15pt)}]G.north east) -- ([shift={(40pt,-15pt)}]G.north east);
\end{tikzpicture}

\end{document}

另一个例子是,重现链接文档第 6 页顶部的表格:

\documentclass{article} 
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,positioning}
\usepackage{array}

\DeclareMathOperator{\iden}{id}

\tikzset{
  myblock/.style={
    draw,text width=0.75cm,minimum height=2cm,align=center,
    append after command={node[fill,anchor=north west,minimum size=0.35cm] at (\tikzlastnode.north west) {}}
  },
  mysquare/.style={
    draw,minimum size=1cm,align=center,
    append after command={node[fill,anchor=north west,minimum size=0.35cm] at (\tikzlastnode.north west) {}}
  },
  twoarrows/.style n args={4}{
    decoration={
      markings,
      mark=at position #1 with {\arrow{>}\node[above] {#3};}, 
      mark=at position #2 with {\arrow{>}\node[above] {#4};} 
    },
  postaction=decorate  
  },
  onearrow/.style 2 args={
    decoration={
      markings,
      mark=at position #1 with {\arrow{>}\node[above] {#2};}, 
    },
  postaction=decorate  
  },
}

\begin{document}

\begin{table}

\renewcommand\arraystretch{3}
\begin{tabular}{l>{$}l<{$}c}
Object & A & 
  \begin{tikzpicture}[baseline]
  \draw[onearrow={0.5}{$A$}] (0,0) -- ++(40pt,0pt);
  \end{tikzpicture}
\\
Morphism & f\colon A\to B &
  \begin{tikzpicture}[baseline]
  \node[mysquare] (F) {$f$};
  \draw[onearrow={0.5}{$A$}]
    ([xshift=-40pt]F.west) -- (F.west);
  \draw[onearrow={0.5}{$A$}]
    (F.east) -- ([xshift=40pt]F.east);
  \end{tikzpicture}
\\
Identity &  \iden_{A}\colon A\to A &
  \begin{tikzpicture}[baseline]
  \draw[onearrow={0.5}{$A$}] (0,0) -- ++(40pt,0pt);
  \end{tikzpicture}
\\
Composition & t\circ s &
  \begin{tikzpicture}[baseline]
  \node[mysquare] (T) {$t$};
  \node[mysquare,right=40 pt of T] (S) {$s$};
  \draw[onearrow={0.5}{$A$}]
    ([xshift=-40pt]T.west) -- (T.west);
  \draw[onearrow={0.5}{$B$}]
    (T.east) -- (S.west);
  \draw[onearrow={0.5}{$C$}]
    (S.east) -- ([xshift=40pt]S.east);
  \end{tikzpicture}
\end{tabular}
\end{table}

\end{document}

在此处输入图片描述

相关内容