38

This question led to a new package:
tqft — Blog: The TQFT Package

I'm going to write a brief note about topological quantum field theories, so I need to draw some copies of the "pair of pants"... I'm wondering if there's a simple way to obtain such an object with tikz or PStricks; the challenge is that I would like to create a "modular" set of objects to assembly in a second moment: drawn the pair of pants, and another object, I don't want to recreate everything to obtain the juxtaposition of the two.

Edit: this is what I want to obtain.

enter image description here

10
  • I guess you'd regard math.ntnu.no/~stacey/documents/smooth_chern.1.pdf as overkill! Apr 30, 2011 at 17:35
  • 2
    You should include the drawings available at your links as part of your question, so there is no need to follow the links.
    – ipavlic
    Apr 30, 2011 at 18:07
  • @tetrapharmakon: I was serious when I said it was overkill! I know the sort of diagram that you want, I was just being a little silly posting that link (plus I'm quite pleased with that picture). Apr 30, 2011 at 18:09
  • @ipavlic: you completely right, sorry... @Andrew: Even if that drawing din't help, I found this beautiful pdf :)
    – fosco
    Apr 30, 2011 at 18:21
  • @tetrapharmakon: Thanks. I'm quite pleased with that talk. Apr 30, 2011 at 19:02

1 Answer 1

32

Update (2011-05-06): A reworked version of this code is available for download at: http://bazaar.launchpad.net/~tex-sx/tex-sx/development/files as the file tqft.dtx. To generate the package file and the documentation, run pdflatex tqft.dtx. This file is part of the package proposed at What are your favourite TikZ/PGF answers? which will be released on CTAN in due course.


What follows is an example, based on a previous version of this answer. I hope that I've edited it correctly to reflect the current methodology of the package, but if there's a conflict, refer to the package documentation.

Right, here's a more comprehensive solution. The main hassle was setting things up so that one can change the direction of the "flow" of the cobordisms. That's done by a key tqft/flow which, at the moment, can take one of the directions north, south, east, and west (default is south). This rotates stuff so that the incoming to outgoing directions are in the right direction. It also reflects things so that the boundary numbering is always from top to bottom or from left to right.

The node types are, with the anchors that they define (all define centre and center so I haven't listed them) (update the anchors have been reworked a little so that all now define incoming boundary n and outgoing boundary n for n a reasonable integer (less than 10 by default)):

  • tqft/pair of pants: incoming boundary 1, outgoing boundary 1, outgoing boundary 2
  • tqft/reverse pair of pants: incoming boundary 1, incoming boundary 2, outgoing boundary 1
  • tqft/cylinder to prior: incoming boundary 1, outgoing boundary 1; this is a cylinder that is skewed in so that the outgoing boundary is shifted towards the lower numbered boundary components by just the right amount to fit with a tqft/pair of pants
  • tqft/cylinder to next: incoming boundary 1, outgoing boundary 1; this is a cylinder that is skewed in so that the outgoing boundary is shifted towards the higher numbered boundary components by just the right amount to fit with a tqft/pair of pants
  • tqft/cylinder: incoming boundary 1, outgoing boundary 1; this is a straight cylinder
  • tqft/cap: this "caps off" a boundary component
  • tqft/cup: this starts a boundary component

Global keys:

  • tqft/flow: see above
  • tqft/cobordism height: this is the separation between the levels in the cobordism (aka the height of the pair of pants, etc)
  • tqft/boundary separation: this is the separation between the centres of the boundary components (aka the width of the pair of pants, etc)
  • tqft/circle width: the boundary components are ellipses, this sets the horizontal axis (relative to the cobordism)
  • tqft/circle depth: this sets the vertical axis of the boundary ellipses

And here's the code:

\documentclass{article}
\usepackage{tikz}
\usepackage{tqft}
\begin{document}
\begin{tikzpicture}[tqft/flow=east]
\node[tqft/pair of pants,draw] (a) {};
\node[tqft/reverse pair of pants,draw,anchor=incoming boundary 1] (b) at (a.outgoing boundary 2) {};
\node[tqft/cylinder to next,draw,anchor=incoming boundary 1] (c) at (a.outgoing boundary 1) {};
\node[tqft/cylinder to next,draw,anchor=outgoing boundary 1] (e) at (b.incoming boundary 2) {};
\path (b.outgoing boundary 1) ++(1.5,1) node[font=\Huge] {\(=\)};
\path (b.outgoing boundary 1) ++(3,0) node[tqft/reverse pair of pants,draw,anchor=incoming boundary 2] (e) {};
\node[tqft/pair of pants,draw,anchor=incoming boundary 1] (f) at (e.outgoing boundary 1) {};
\end{tikzpicture}
\end{document}

And here's the result:

tqft with tikz

10
  • 3
    This is wonderful!
    – fosco
    May 1, 2011 at 9:04
  • I obtained any possible permutation and combination of pants, but... Telling the truth i blindely copypasted your code: I'm a bit lost in it so I don't see how to modify things to create other shapes. :( Could you please write how to obtain cups and caps? Thanks a lot
    – fosco
    May 1, 2011 at 9:17
  • Decomposition of a connected sum of tori can be drawn with a "chain" of pants: this is what I tried to do \begin{tikzpicture} \node[scale=.5, pair of pants,draw,minimum height=2cm,minimum width=2cm,rotate=90] (a) {}; \node[scale=.5,pair of pants,draw,minimum height=2cm,minimum width=2cm,anchor=north,rotate=270] (b) at (a.north) {}; \node[scale=.5,pair of pants,draw,minimum height=2cm,minimum width=2cm,anchor=north] (c) at (b.north) {}; \end{tikzpicture} but maybe I don't understand properly how nodes work in tikz...
    – fosco
    May 1, 2011 at 9:46
  • @tetrapharmakon: From your prior comment, it looks as though you need to look at the details of how TikZ places a node. In short, saying \node[anchor=east] (a.north) {}; places the east anchor of the new node at the same place as the north anchor of the old node. The other thing you have to know is that when you rotate a node then the anchors rotate as well, so that \node[rotate=180] {}; swaps the east and west anchors, and the north and south. May 2, 2011 at 12:45
  • 1
    @Marion That's normally a reasonable thing to do, but in this case then I turned it into a proper TikZ library. There should be documentation with your distribution, or you could go to ctan or to www.texdoc.net and search for tqft Mar 21, 2017 at 23:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .