7

I would like to draw pictures of cobordisms like this one:

enter image description here

but perhaps more complicated. For this, I used tqft. However the incoming and outgoing boundary components should be equidistant and aligned. What I really would like to have is the following:

suppose there are incoming boundary components 1,2,...,n and outgoing boundary components 1',2', ...,n' (equidistant and aligned), the position of these is fixed in advance; draw cobordisms connecting the boundary components {1,4}, {2,3,4',5'}, {1',3',6'} and so on. Any hint will be highly appreciated.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tqft}

\begin{document}
\begin{tikzpicture}
\pic[
  tqft,
  incoming boundary components=2,
  outgoing boundary components=2,
  draw,
  at={(1,0)},
  name=a,
  every outgoing lower boundary component/.style={draw},
  offset=1,
  cobordism height=3cm,
];
\pic[tqft,
     incoming boundary components=2,
     outgoing boundary components=0,
     draw,
     name=b,
         ];
 \pic[tqft,
     incoming boundary components=2,
     outgoing boundary components=0,
     draw,
     at={(4.5,0)},
     name=c,
         ];
\pic[tqft,
     incoming boundary components=0,
     outgoing boundary components=3,
     draw,
     name=d,
     every outgoing lower boundary component/.style={draw},
     at={(0,-1)},
         ];
\pic[tqft,
    incoming boundary components=0,
    outgoing boundary components=1,
    draw,
    name=e,
    every outgoing lower boundary component/.style={draw},
    at={(6.5,-1)},
        ];
 \end{tikzpicture}
\end{document} 

1 Answers1

4

This looks like quite a useful feature for the tqft library. I've had a go at implementing it, I'd like to know if it works "in the wild" before pushing it to CTAN. You can get the package from github, download the file tqft.dtx and run tex tqft.dtx to generate the package files. Put them somewhere that TeX can find them, and try the following code.

\documentclass{standalone}
%\url{https://tex.stackexchange.com/q/312405/86}
\usepackage{tikz}
\usetikzlibrary{tqft}

\begin{document}
\begin{tikzpicture}[
  tqft,
  every outgoing boundary component/.style={fill=blue!50},
  outgoing boundary component 3/.style={fill=none,draw=red},
  every incoming boundary component/.style={fill=green!50},
  every lower boundary component/.style={draw,ultra thick, dashed},
  every upper boundary component/.style={draw,purple},
  cobordism/.style={fill=red!50},
  cobordism edge/.style={draw},
  genus=3,
  hole 2/.style={ultra thick, blue},
  view from=incoming,
  anchor=between incoming 1 and 2
]
\pic[name=a,tqft,
    incoming boundary components=5,
    skip incoming boundary components={2,4},
    outgoing boundary components=7,
    skip outgoing boundary components={2,3,5},
    offset=-.5];

\begin{scope}[every pin edge/.style={<-}]
\foreach \anchor/\ang in {
  hole 1/-90,
  hole 2/90,
  hole 3/-90,
  incoming boundary 3/90,
  outgoing boundary 4/-90,
  between last incoming and last outgoing/0,
  between first incoming and first outgoing/180,
  between incoming 1 and 3/90,
  between outgoing 1 and 4/-90,
  between outgoing 4 and 6/-90
} {
  \node[pin=\ang:\anchor,at=(a-\anchor),inner sep=0pt] {};
}
\draw[<-] (0,0) -- ++(0,3);
\end{scope}
\end{tikzpicture}
\end{document}

There are two new keys demonstrated in the above:

  • skip incoming boundary components={2,4}
  • skip outgoing boundary components={2,3,5}

For both sets of boundary components, the number of components (set by the incoming boundary components=5 and outgoing boundary components=7) sets the total number of boundary slots that are available. The new keys then say which of those slots to ignore. So in the above cobordism, there are actually only 3 incoming boundary components as the 2nd and 4th are ignored. Notice that the anchors are defined with reference to the gaps, so that the boundary components are labelled as 1, 3, and 5.

The above code produces the following diagram.

cobordism with missing components

Comments, bugs, and feature requests welcome - either here or on github.


For completeness, here's my rendering of your original picture with all the boundary components aligned.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,tqft}
\usepackage{tqft}

\tikzset{
  tqft/use nodes=false,
}

\begin{document}

\begin{tikzpicture}[
  tqft,
  every outgoing boundary component/.style={fill=blue!50},
  outgoing boundary component 3/.style={fill=none,draw=red},
  every incoming boundary component/.style={fill=green!50},
  every lower boundary component/.style={draw,ultra thick, dashed},
  every upper boundary component/.style={draw,purple},
  cobordism/.style={fill=red!50},
  cobordism edge/.style={draw},
  view from=incoming,
  cobordism height=4cm,
]
\begin{scope}[every node/.style={rotate=90}]
\pic[name=a,
  tqft,
  incoming boundary components=3,
  skip incoming boundary components=2,
  outgoing boundary components=0
  ];
\pic[name=b,
  tqft,
  incoming boundary components=3,
  skip incoming boundary components=2,
  outgoing boundary components=3,
  skip outgoing boundary components=2,
  offset=1,
  anchor=incoming boundary 1,
  at=(a-incoming boundary 2)
];
\pic[name=c,
  tqft,
  incoming boundary components=2,
  outgoing boundary components=0,
  anchor={(0,0)},
  at=(b-incoming boundary 3)
];
\pic[name=d,
  tqft,
  incoming boundary components=0,
  outgoing boundary components=4,
  skip outgoing boundary components=3,
  at=(a-incoming boundary 1)
];
\pic[name=e,
  tqft,
  incoming boundary components=0,
  outgoing boundary components=1,
  at=(c-incoming boundary 2)
];
\end{scope}
\end{tikzpicture}

\end{document}

Cobordism with many components

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751
  • I'd like to thank a lot for the effort! There seem to be problems if one wants to ignore the first and/or last last slot (sometimes it works, but in most cases not). For my purpose (cobordism with several distinct connected components) I would need to set many slots (6 or 8, say) but ignore many of them in each of the components. I don't know how to communicate via github! – user 59363 May 16 '17 at 16:53
  • @user59363 My thinking was that if you want to ignore the last then you just decrease the number of boundary components. If you want to ignore the first, then you similarly decrease the number of boundary components and add an offset. So each cobordism component would have its own internal numbering of its boundary components which wouldn't correspond with the external numbering. If you could upload a sketch of what you are trying to achieve then I'll have a go at reproducing it. – Andrew Stacey May 16 '17 at 17:34
  • What I wanted to achieve are pictures like the one in the original question: here I have incoming slots 1--6, outgoing slots 1'--6'; but they should be equidistand and aligned in the sense that 1 is exactly above 1', 2 exactly above 2' and so on. – user 59363 May 16 '17 at 18:00
  • I got it, thanks a lot for your help, it works well!! – user 59363 May 16 '17 at 19:43
  • @user59363 Excellent! Just for completeness, I've added my version of your diagram. It's not perfect (I'd like the components which don't have both incoming and outgoing to not overlap), but shows that it is possible. I also fixed a bug with when there's only one outgoing component which I'll upload to github in a moment. – Andrew Stacey May 16 '17 at 19:49
  • Wow, great!! Once more, thanks a lot for this! – user 59363 May 16 '17 at 19:51
  • @user59363 I'm glad it's still of use to you after all this time since you asked the question. – Andrew Stacey May 16 '17 at 19:52