Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%
- %% This is file `tikzlibrarytqft.code.tex',
- %% generated with the docstrip utility.
- %%
- %% The original source files were:
- %%
- %% tqft.dtx (with options: `library')
- %% ----------------------------------------------------------------
- %% tqft --- a library for drawing TQFT diagrams with TikZ/PGF
- %% E-mail: loopspace@mathforge.org
- %% Released under the LaTeX Project Public License v1.3c or later
- %% See http://www.latex-project.org/lppl.txt
- %% ----------------------------------------------------------------
- %%
- \ifcsname pgfk@/handlers/.pic/.@cmd\endcsname
- \else
- \pgfwarning{This library only works with TikZ 3.0 or later; for earlier versions of TikZ use the TQFT package}
- \fi
- \usetikzlibrary{shapes.geometric}
- \def\pgf@tqft@minus{-}
- \let\pgf@tqft@upper\@empty
- \let\pgf@tqft@lower\pgf@tqft@minus
- \def\tqft@split(#1,#2){%
- \pgfmathsetmacro\tqft@y{#2 * (-\tqft@val{cobordism height})}%
- \pgfmathsetmacro\tqft@x{(#1 - 1 + max(min(#2,1),0)*\tqft@val{offset}) * \tqft@val{boundary separation}}%
- \def\tqft@shift{(\tqft@x pt, \tqft@y pt)}%
- }%
- \tikzset{
- pic alias/.code={%
- \tikz@fig@mustbenamed
- \expandafter\def\expandafter\tikz@alias\expandafter{\tikz@alias\pgfnodealias{\tikz@pp@name{#1}}{\tikz@fig@name}}%
- },
- tqft/.style={%
- pic type=cobordism,
- every tqft/.try,
- tqft/.cd,
- },
- tqft/.unknown/.code={%
- \let\tqft@searchname=\pgfkeyscurrentname%
- \pgfkeysalso{%
- /tikz/\tqft@searchname={#1}
- }
- },
- tqft/.cd,
- incoming boundary components/.initial=5,
- outgoing boundary components/.initial=4,
- skip incoming boundary components/.initial={},
- skip outgoing boundary components/.initial={},
- genus/.initial = 0,
- offset/.initial=0,
- cobordism height/.initial=2cm,
- boundary separation/.initial=2cm,
- circle x radius/.initial=10pt,
- circle y radius/.initial=5pt,
- view from/.is choice,
- view from/incoming/.code={%
- \let\pgf@tqft@upper\pgf@tqft@minus
- \let\pgf@tqft@lower\@empty
- },
- view from/outgoing/.code={%
- \let\pgf@tqft@lower\pgf@tqft@minus
- \let\pgf@tqft@upper\@empty
- },
- anchor/.initial = none,
- pair of pants/.style={
- /tikz/tqft,
- incoming boundary components=1,
- outgoing boundary components=2,
- offset=-.5
- },
- /tikz/tqft pair of pants/.style={
- /tikz/tqft/pair of pants,
- },
- reverse pair of pants/.style={
- /tikz/tqft,
- incoming boundary components=2,
- outgoing boundary components=1,
- offset=.5
- },
- /tikz/tqft reverse pair of pants/.style={
- /tikz/tqft/reverse pair of pants,
- },
- cylinder to prior/.style={
- /tikz/tqft,
- incoming boundary components=1,
- outgoing boundary components=1,
- offset=-.5
- },
- /tikz/tqft cylinder to prior/.style={
- /tikz/tqft/cylinder to prior,
- },
- cylinder to next/.style={
- /tikz/tqft,
- incoming boundary components=1,
- outgoing boundary components=1,
- offset=.5
- },
- /tikz/tqft cylinder to next/.style={
- /tikz/tqft/cylinder to next,
- },
- cylinder/.style={
- /tikz/tqft,
- incoming boundary components=1,
- outgoing boundary components=1
- },
- /tikz/tqft cylinder/.style={
- /tikz/tqft/cylinder,
- },
- cup/.style={
- /tikz/tqft,
- incoming boundary components=1,
- outgoing boundary components=0
- },
- /tikz/tqft cup/.style={
- /tikz/tqft/cup,
- },
- cap/.style={
- /tikz/tqft,
- incoming boundary components=0,
- outgoing boundary components=1
- },
- /tikz/tqft cap/.style={
- /tikz/tqft/cap,
- },
- }
- \def\tqft@val#1{\pgfkeysvalueof{/tikz/tqft/#1}}
- \tikzset{
- cobordism/.pic={
- \gdef\tqft@fullpath{}%
- \global\let\tqft@blist\pgfutil@gobble%
- \gdef\tqft@gclip{}%
- \global\let\tqft@glist\pgfutil@gobble%
- \global\let\tqft@clist\pgfutil@gobble%
- \global\let\tqft@alist\pgfutil@gobble
- \global\let\tqft@ibdrylist=\pgfutil@gobble
- \global\let\tqft@cibdrylist=\pgfutil@gobble
- \global\let\tqft@obdrylist=\pgfutil@gobble
- \global\let\tqft@cobdrylist=\pgfutil@gobble
- \global\let\tqft@robdrylist=\pgfutil@gobble
- \global\let\tqft@rcobdrylist=\pgfutil@gobble
- \ifnum\tqft@val{incoming boundary components}>0\relax
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- (-\tqft@val{circle x radius},0) arc[start angle=\pgf@tqft@upper180, end angle=0, x radius=\tqft@val{circle x radius}, y radius=\tqft@val{circle y radius}]
- }%
- \xdef\tqft@alist{%
- \tqft@alist,-incoming boundary 1/{(0,0)},-incoming boundary/{(0,0)}%
- }%
- \ifnum\tqft@val{incoming boundary components}>1\relax
- \foreach \k in {2,...,\tqft@val{incoming boundary components}} {
- \edef\tqft@temp{\noexpand\pgfutil@in@{,\k,}{,\tqft@val{skip incoming boundary components},}}
- \tqft@temp
- \ifpgfutil@in@
- \xdef\tqft@cibdrylist{\tqft@cibdrylist,\k}
- \else
- \xdef\tqft@ibdrylist{\tqft@ibdrylist,\k}
- \fi
- }
- \ifx\tqft@ibdrylist\pgfutil@gobble
- \else
- \foreach \k [
- remember=\k as \kmo (initially 1),
- evaluate=\k as \xpos using (\k-1)*\tqft@val{boundary separation} -\tqft@val{circle x radius},
- ] in \tqft@ibdrylist {
- \pgfmathsetmacro\xppos{(\kmo - 1)*\tqft@val{boundary separation} + \tqft@val{circle x radius}}
- \pgfmathsetmacro\cpos{(\xpos + \xppos)/2}
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- .. controls +(0,-\tqft@val{cobordism height}/3) and +(0,-\tqft@val{cobordism height}/3) .. (\xpos pt,0) arc[start angle=\pgf@tqft@upper180, end angle=0, x radius=\tqft@val{circle x radius}, y radius=\tqft@val{circle y radius}]
- }%
- \xdef\tqft@blist{%
- \tqft@blist,incoming boundary \k/incoming/{%
- (\xppos pt,0) .. controls +(0,-\tqft@val{cobordism height}/3) and +(0,-\tqft@val{cobordism height}/3) .. (\xpos pt,0)}%
- }%
- \xdef\tqft@clist{%
- \tqft@clist,-between incoming \kmo\space and \k/{(\cpos pt,-\tqft@val{cobordism height}/4)}%
- }%
- \xdef\tqft@alist{%
- \tqft@alist,-incoming boundary \k/{(\kmo * \tqft@val{boundary separation},0)}%
- }%
- }%
- \fi
- \fi
- \ifnum\tqft@val{outgoing boundary components}>0\relax
- \pgfmathsetmacro\xppos{(\tqft@val{outgoing boundary components} -1+\tqft@val{offset}) * \tqft@val{boundary separation} +\tqft@val{circle x radius}}%
- \pgfmathsetmacro\tqft@ht{abs(\tqft@val{incoming boundary components} - \tqft@val{outgoing boundary components} - \tqft@val{offset})}%
- \pgfmathsetmacro\tqft@ht{1/3 + 2/3*\tqft@ht/(\tqft@ht + 1)}%
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- .. controls +(0,-\tqft@ht*\tqft@val{cobordism height}) and +(0,\tqft@ht*\tqft@val{cobordism height}) .. (\xppos pt, -\tqft@val{cobordism height})
- }%
- \xdef\tqft@blist{%
- \tqft@blist,between last incoming and last outgoing/incoming and outgoing/{%
- (\tqft@val{incoming boundary components} * \tqft@val{boundary separation} + \tqft@val{circle x radius} - \tqft@val{boundary separation},0pt)
- .. controls +(0,-\tqft@ht*\tqft@val{cobordism height}) and +(0,\tqft@ht*\tqft@val{cobordism height}) .. (\xppos pt, -\tqft@val{cobordism height})}%
- }%
- \pgfmathsetmacro\xppos{(\xppos + (\tqft@val{incoming boundary components} -1) * \tqft@val{boundary separation} +\tqft@val{circle x radius})/2}%
- \xdef\tqft@clist{%
- \tqft@clist,-between last incoming and last outgoing/{(\xppos pt,-\tqft@val{cobordism height}/2)}%
- }%
- \else
- \pgfmathsetmacro\tqft@ht{1/3 + 2/3*(\tqft@val{incoming boundary components} - 1)/\tqft@val{incoming boundary components}}
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- .. controls +(0,-\tqft@ht*\tqft@val{cobordism height}) and +(0,-\tqft@ht*\tqft@val{cobordism height}) .. (-\tqft@val{circle x radius},0)
- }%
- \xdef\tqft@blist{%
- \tqft@blist,between first incoming and last incoming/incoming and outgoing/{%
- (\tqft@val{incoming boundary components} * \tqft@val{boundary separation} + \tqft@val{circle x radius} - \tqft@val{boundary separation},0pt)
- .. controls +(0,-\tqft@ht*\tqft@val{cobordism height}) and +(0,-\tqft@ht*\tqft@val{cobordism height}) .. (-\tqft@val{circle x radius},0)}
- }%
- \pgfmathsetmacro\xppos{(\tqft@val{incoming boundary components} -1) * \tqft@val{boundary separation}/2}%
- \xdef\tqft@clist{%
- \tqft@clist,-between first incoming and last incoming/{(\xppos pt,-\tqft@ht*\tqft@val{cobordism height}*3/4)}%
- }%
- \fi
- \else
- \ifnum\tqft@val{outgoing boundary components}>0\relax
- \pgfmathsetmacro\xppos{(\tqft@val{outgoing boundary components} -1+\tqft@val{offset}) * \tqft@val{boundary separation} +\tqft@val{circle x radius}}
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- (\xppos pt, -\tqft@val{cobordism height})
- }%
- \fi
- \fi
- \ifnum\tqft@val{outgoing boundary components}>0\relax
- \pgfmathsetmacro\xppos{(\tqft@val{outgoing boundary components} -1+\tqft@val{offset}) * \tqft@val{boundary separation} -\tqft@val{circle x radius}}%
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- arc[end angle=\pgf@tqft@upper180, start angle=0, x radius=\tqft@val{circle x radius}, y radius=\tqft@val{circle y radius}]
- }%
- \xdef\tqft@alist{%
- \tqft@alist,-outgoing boundary \tqft@val{outgoing boundary components}/{(\xppos pt + \tqft@val{circle x radius},-\tqft@val{cobordism height})},-outgoing boundary/{(\tqft@val{offset}*\tqft@val{boundary separation},-\tqft@val{cobordism height})}%
- }%
- \ifnum\tqft@val{outgoing boundary components}>1\relax
- \foreach \k [evaluate=\k as \ok using int(\tqft@val{outgoing boundary components} - \k + 1)] in {2,...,\tqft@val{outgoing boundary components}} {
- \edef\tqft@temp{\noexpand\pgfutil@in@{,\ok,}{,\tqft@val{skip outgoing boundary components},}}
- \tqft@temp
- \ifpgfutil@in@
- \xdef\tqft@cobdrylist{\tqft@cobdrylist,\k}
- \else
- \xdef\tqft@obdrylist{\tqft@obdrylist,\k}
- \fi
- }
- \ifx\tqft@obdrylist\pgfutil@gobble
- \else
- \foreach \k [
- remember=\k as \kmo (initially 1),
- evaluate=\k as \xpos using (\tqft@val{outgoing boundary components} - \k + \tqft@val{offset})*\tqft@val{boundary separation} + \tqft@val{circle x radius},
- ] in \tqft@obdrylist {
- \pgfmathsetmacro\xppos{(\tqft@val{outgoing boundary components} - \kmo + \tqft@val{offset})*\tqft@val{boundary separation} - \tqft@val{circle x radius}}
- \pgfmathsetmacro\cpos{(\xpos + \xppos)/2}
- \pgfmathsetmacro\nk{int(\tqft@val{outgoing boundary components} - \k + 1)}
- \pgfmathsetmacro\nkpo{int(\tqft@val{outgoing boundary components} - \kmo + 1)}
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- .. controls +(0,\tqft@val{cobordism height}/3) and +(0,\tqft@val{cobordism height}/3) .. (\xpos pt,-\tqft@val{cobordism height}) arc[end angle=\pgf@tqft@upper180, start angle=0, x radius=\tqft@val{circle x radius}, y radius=\tqft@val{circle y radius}]
- }%
- \xdef\tqft@blist{%
- \tqft@blist,between outgoing \nk\space and \nkpo/outgoing/{%
- (\xppos pt,-\tqft@val{cobordism height})
- .. controls +(0,\tqft@val{cobordism height}/3) and +(0,\tqft@val{cobordism height}/3) .. (\xpos pt,-\tqft@val{cobordism height}) ++(-2*\tqft@val{circle x radius},0)}%
- }%
- \xdef\tqft@clist{%
- \tqft@clist,-between outgoing \nk\space and \nkpo/{(\cpos pt,-3*\tqft@val{cobordism height}/4)}%
- }%
- \xdef\tqft@alist{%
- \tqft@alist,-outgoing boundary \nk/{(\xpos pt - \tqft@val{circle x radius},-\tqft@val{cobordism height})}%
- }%
- }%
- \fi
- \fi
- \ifnum\tqft@val{incoming boundary components}>0\relax
- \pgfmathsetmacro\tqft@ht{1/3 + 2/3*abs(\tqft@val{offset})/(abs(\tqft@val{offset}) + 1)}%
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- .. controls +(0,\tqft@ht*\tqft@val{cobordism height}) and +(0,-\tqft@ht*\tqft@val{cobordism height}) .. (-\tqft@val{circle x radius},0)
- }%
- \xdef\tqft@blist{%
- \tqft@blist,between first incoming and first outgoing/incoming and outgoing/{%
- (\tqft@val{offset} * \tqft@val{boundary separation} - \tqft@val{circle x radius},-\tqft@val{cobordism height})
- .. controls +(0,\tqft@ht*\tqft@val{cobordism height}) and +(0,-\tqft@ht*\tqft@val{cobordism height}) .. (-\tqft@val{circle x radius},0)}%
- }%
- \xdef\tqft@clist{%
- \tqft@clist,-between first incoming and first outgoing/{(\tqft@val{offset}*\tqft@val{boundary separation}/2-\tqft@val{circle x radius},-\tqft@val{cobordism height}/2)}%
- }%
- \else
- \pgfmathsetmacro\xppos{(\tqft@val{outgoing boundary components} -1+\tqft@val{offset}) * \tqft@val{boundary separation} +\tqft@val{circle x radius}}%
- \pgfmathsetmacro\tqft@ht{1/3 + 2/3*(\tqft@val{outgoing boundary components} - 1)/\tqft@val{outgoing boundary components}}
- \xdef\tqft@fullpath{%
- \tqft@fullpath
- .. controls +(0,\tqft@ht*\tqft@val{cobordism height}) and +(0,\tqft@ht*\tqft@val{cobordism height}) .. (\xppos pt,-\tqft@val{cobordism height})
- }%
- \xdef\tqft@blist{%
- \tqft@blist,between first and last outgoing/incoming and outgoing/{%
- (\tqft@val{offset} * \tqft@val{boundary separation} - \tqft@val{circle x radius},-\tqft@val{cobordism height})
- .. controls +(0,\tqft@ht*\tqft@val{cobordism height}) and +(0,\tqft@ht*\tqft@val{cobordism height}) .. (\xppos pt,-\tqft@val{cobordism height})}%
- }%
- \pgfmathsetmacro\xppos{(\tqft@val{outgoing boundary components}/2 + \tqft@val{offset} -1/2) * \tqft@val{boundary separation}}%
- \pgfmathsetmacro\tqft@ht{1 -\tqft@ht*3/4}%
- \xdef\tqft@clist{%
- \tqft@clist,-between first and last outgoing/{(\xppos pt,-\tqft@ht*\tqft@val{cobordism height})}%
- }%
- \fi
- \fi
- \pgfmathsetmacro\xpos{%
- (
- \tqft@val{outgoing boundary components} > 0 ?
- (
- \tqft@val{incoming boundary components} > 0 ?
- min(0,\tqft@val{offset}) : \tqft@val{offset}
- ) : 0
- )
- *\tqft@val{boundary separation} - 2*\tqft@val{circle x radius}}%
- \xdef\tqft@gclip{(\xpos pt,2*\tqft@val{circle y radius}) rectangle }%
- \pgfmathsetmacro\xpos{%
- ((
- \tqft@val{outgoing boundary components} > 0 ?
- (
- \tqft@val{incoming boundary components} > 0 ?
- max(\tqft@val{incoming boundary components},\tqft@val{outgoing boundary components} + \tqft@val{offset}) : \tqft@val{outgoing boundary components} + \tqft@val{offset}
- ) : \tqft@val{incoming boundary components}
- )-1)
- *\tqft@val{boundary separation} + 2*\tqft@val{circle x radius}}%
- \xdef\tqft@gclip{\tqft@gclip (\xpos pt,-\tqft@val{cobordism height} - 2*\tqft@val{circle y radius})}%
- \ifnum\tqft@val{genus}>0\relax
- \pgfmathsetmacro\xpos{%
- (
- \tqft@val{outgoing boundary components} > 0 ?
- (
- \tqft@val{incoming boundary components} > 0 ?
- \tqft@val{offset}/2 : \tqft@val{offset}
- ) : 0
- )
- *\tqft@val{boundary separation} - \tqft@val{circle x radius}}%
- \pgfmathsetmacro\ypos{%
- (
- \tqft@val{outgoing boundary components} > 0 ?
- (
- \tqft@val{incoming boundary components} > 0 ?
- -\tqft@val{cobordism height}/2 : -1 + \tqft@val{cobordism height}/3
- ) : - \tqft@val{cobordism height}/3
- )}%
- \xdef\tqft@gclip{%
- \tqft@gclip
- (\xpos pt,\ypos pt)
- }%
- \pgfmathsetmacro\gsize{%
- ((
- \tqft@val{outgoing boundary components} > 0 ?
- (
- \tqft@val{incoming boundary components} > 0 ?
- (\tqft@val{incoming boundary components} + \tqft@val{outgoing boundary components})/2 : \tqft@val{outgoing boundary components}
- ) : \tqft@val{incoming boundary components}
- )-1)
- *\tqft@val{boundary separation}/\tqft@val{circle x radius} + 2}%
- \pgfmathsetmacro\gscale{min(1,\gsize/(3*\tqft@val{genus}+1))}%
- \pgfmathsetmacro\gyscale{\tqft@val{circle y radius}*\gscale*.707}%
- \pgfmathsetmacro\gxscale{\tqft@val{circle x radius}*\gscale}%
- \pgfmathsetmacro\gsep{((\gsize - 2*\tqft@val{genus}*\gscale)/(\tqft@val{genus} + 1)*\tqft@val{circle x radius}}%
- \xdef\tqft@gclip{%
- \tqft@gclip
- ++(\gsep/2 pt,0)
- }%
- \pgfmathsetmacro\omrstwo{1 - 1/sqrt(2)}%
- \pgfmathsetmacro\sqrtwo{sqrt(2)}%
- \foreach[
- evaluate=\k as \kmo using int(2 * \k-1)
- ] \k in {1,...,\tqft@val{genus}} {
- \xdef\tqft@gclip{%
- \tqft@gclip
- ++(\gsep/2 pt + \omrstwo*\gxscale pt,0)
- .. controls +(\gxscale*\sqrtwo/3 pt,4/3*\gyscale pt) and +(-\gxscale*\sqrtwo/3 pt,4/3*\gyscale pt)
- .. ++(\sqrtwo*\gxscale pt,0)
- .. controls +(-\gxscale*\sqrtwo/3 pt,-4/3*\gyscale pt) and +(\gxscale*\sqrtwo/3 pt,-4/3*\gyscale pt)
- .. ++(-\sqrtwo*\gxscale pt,0)
- ++(2*\gxscale pt -\omrstwo*\gxscale pt + \gsep/2 pt,0)
- }
- \xdef\tqft@glist{%
- \tqft@glist,%
- hole \k/lower/{%
- (\xpos pt + \k * \gsep pt + \kmo * \gxscale pt + \gxscale pt -\omrstwo*\gxscale pt,\ypos pt)
- .. controls +(-\gxscale pt*\sqrtwo/3,\pgf@tqft@upper4/3*\gyscale pt) and +(\gxscale pt*\sqrtwo/3,\pgf@tqft@upper4/3*\gyscale pt)
- .. ++(-\sqrtwo*\gxscale pt,0)},%
- hole \k/upper/{(\xpos pt + \k * \gsep pt + \kmo * \gxscale pt - \gxscale pt,\ypos pt + \pgf@tqft@upper\gyscale pt)%
- .. controls +(\gxscale pt*2/3,\pgf@tqft@lower8/3*\gyscale pt) and +(-\gxscale pt*2/3,\pgf@tqft@lower8/3*\gyscale pt)
- .. ++(2*\gxscale pt,0)}%
- }%
- \xdef\tqft@clist{%
- \tqft@clist,-hole \k/{(\xpos pt + \k * \gsep pt + \kmo * \gxscale pt,\ypos pt)}%
- }%
- }%
- \fi
- \gdef\tqft@shift{(0,0)}%
- \edef\tqft@anchor{\tqft@val{anchor}}%
- \expandafter\pgfutil@in@\expandafter{\expandafter,\expandafter}\expandafter{\tqft@anchor}%
- \ifpgfutil@in@
- \expandafter\tqft@split\tqft@anchor\relax
- \else
- \edef\tqft@anchor{-\tqft@val{anchor}}%
- \xdef\tqft@alist{\tqft@clist,\tqft@alist}%
- \foreach \anchor/\coord in \tqft@alist
- {
- \ifx\anchor\tqft@anchor\relax
- \global\let\tqft@shift\coord
- \fi
- }%
- \fi
- \tikz@scan@one@point\pgfutil@firstofone\tqft@shift\relax
- \begin{scope}[shift={(-\pgf@x,-\pgf@y)}]
- \ifnum\tqft@val{incoming boundary components}>0\relax
- \ifx\tqft@ibdrylist\pgfutil@gobble
- \xdef\tqft@ibdrylist{1}
- \else
- \xdef\tqft@ibdrylist{1,\tqft@ibdrylist}
- \fi
- \foreach[evaluate=\k as \xpos using (\k-1)*\tqft@val{boundary separation}] \k in \tqft@ibdrylist {
- \node[
- node contents={},
- ellipse,
- inner sep=0pt,
- outer sep=0pt,
- minimum width=2*\tqft@val{circle x radius},
- minimum height=2*\tqft@val{circle y radius},
- at={(\xpos pt,0)},
- name=-incoming boundary \k,
- /tikz/tqft/every boundary component/.try,
- /tikz/tqft/every incoming boundary component/.try,
- /tikz/tqft/incoming boundary component \k/.try
- ];
- }%
- \ifx\tqft@cibdrylist\pgfutil@gobble
- \else
- \foreach[evaluate=\k as \xpos using (\k-1)*\tqft@val{boundary separation}] \k in \tqft@cibdrylist {
- \node[
- node contents={},
- ellipse,
- inner sep=0pt,
- outer sep=0pt,
- minimum width=2*\tqft@val{circle x radius},
- minimum height=2*\tqft@val{circle y radius},
- at={(\xpos pt,0)},
- name=-incoming boundary \k,
- /tikz/tqft/every skipped boundary component/.try,
- /tikz/tqft/every skipped incoming boundary component/.try,
- /tikz/tqft/skipped incoming boundary component \k/.try,
- ];
- }%
- \fi
- \path node also[pic alias=-incoming boundary] (-incoming boundary 1);
- \fi
- \ifnum\tqft@val{outgoing boundary components}>0\relax
- \ifx\tqft@obdrylist\pgfutil@gobble
- \xdef\tqft@obdrylist{1}
- \else
- \xdef\tqft@obdrylist{1,\tqft@obdrylist}
- \fi
- \foreach \k [evaluate=\k as \ok using int(\tqft@val{outgoing boundary components} - \k + 1)] in \tqft@obdrylist {
- \xdef\tqft@robdrylist{\tqft@robdrylist,\ok}
- }
- \foreach[
- evaluate=\k as \xpos using (\k-1+\tqft@val{offset})*\tqft@val{boundary separation}
- ] \k in \tqft@robdrylist {
- \node[
- node contents={},
- ellipse,
- inner sep=0pt,
- outer sep=0pt,
- minimum width=2*\tqft@val{circle x radius},
- minimum height=2*\tqft@val{circle y radius},
- at={(\xpos pt,-\tqft@val{cobordism height})},
- name=-outgoing boundary \k,
- /tikz/tqft/every boundary component/.try,
- /tikz/tqft/every outgoing boundary component/.try,
- /tikz/tqft/outgoing boundary component \k/.try
- ];
- }%
- \ifx\tqft@cobdrylist\pgfutil@gobble
- \else
- \foreach \k [evaluate=\k as \ok using int(\tqft@val{outgoing boundary components} - \k + 1)] in \tqft@cobdrylist {
- \xdef\tqft@rcobdrylist{\tqft@rcobdrylist,\ok}
- }
- \foreach[
- evaluate=\k as \xpos using (\k-1+\tqft@val{offset})*\tqft@val{boundary separation}
- ] \k in \tqft@rcobdrylist {
- \node[
- node contents={},
- ellipse,
- inner sep=0pt,
- outer sep=0pt,
- minimum width=2*\tqft@val{circle x radius},
- minimum height=2*\tqft@val{circle y radius},
- at={(\xpos pt,-\tqft@val{cobordism height})},
- name=-outgoing boundary \k,
- /tikz/tqft/every skipped boundary component/.try,
- /tikz/tqft/every skipped outgoing boundary component/.try,
- /tikz/tqft/skipped outgoing boundary component \k/.try
- ];
- }%
- \fi
- \path node also[pic alias=-outgoing boundary] (-outgoing boundary 1);
- \fi
- \ifnum\tqft@val{incoming boundary components}>0\relax
- \foreach[evaluate=\k as \xpos using (\k-1)*\tqft@val{boundary separation}] \k in \tqft@ibdrylist {
- \path[
- /tikz/tqft/every lower boundary component/.try,
- /tikz/tqft/every incoming lower boundary component/.try,
- /tikz/tqft/incoming lower boundary component \k/.try
- ] (\xpos pt - \tqft@val{circle x radius},0) arc[start angle=\pgf@tqft@lower180,end angle=0, x radius=\tqft@val{circle x radius}, y radius =\tqft@val{circle y radius}];
- }%
- \fi
- \ifnum\tqft@val{outgoing boundary components}>0\relax
- \foreach[
- evaluate=\k as \xpos using (\k-1+\tqft@val{offset})*\tqft@val{boundary separation}
- ] \k in \tqft@robdrylist {
- \path[
- /tikz/tqft/every lower boundary component/.try,
- /tikz/tqft/every outgoing lower boundary component/.try,
- /tikz/tqft/outgoing lower boundary component \k/.try
- ] (\xpos pt - \tqft@val{circle x radius},-\tqft@val{cobordism height}) arc[start angle=\pgf@tqft@lower180,end angle=0, x radius=\tqft@val{circle x radius}, y radius =\tqft@val{circle y radius}];
- }%
- \fi
- \begin{scope}
- \path[overlay,clip] \tqft@gclip;
- \path[
- /tikz/tqft/cobordism/.try,
- pic actions,
- /tikz/tqft/cobordism outer path/.try,
- ] \tqft@fullpath;
- \end{scope}
- \ifx\tqft@glist\pgfutil@gobble
- \else
- \foreach \tqft@gstyle/\tqft@gside/\tqft@gpath in \tqft@glist {
- \path[
- /tikz/tqft/cobordism/.try,
- pic actions,
- fill=none,
- shade=none,
- /tikz/tqft/cobordism edge/.try,
- /tikz/tqft/genus style/.try,
- /tikz/tqft/genus \tqft@gside/.try,
- /tikz/tqft/\tqft@gstyle/.try,
- /tikz/tqft/\tqft@gstyle\space\tqft@gside/.try,
- ] \tqft@gpath;
- }
- \fi
- \ifx\tqft@blist\pgfutil@gobble
- \else
- \foreach \tqft@bstyle/\tqft@btype/\tqft@bpath in \tqft@blist {
- \path[
- /tikz/tqft/cobordism edge/.try,
- /tikz/tqft/cobordism outer edge/.try,
- /tikz/tqft/between \tqft@btype/.try,
- /tikz/tqft/\tqft@bstyle/.try,
- ] \tqft@bpath;
- }
- \fi
- \ifx\tqft@clist\pgfutil@gobble
- \else
- \foreach \name/\coord in \tqft@clist {
- \path \coord node[coordinate,node contents={},name=\name];
- }
- \fi
- \ifnum\tqft@val{incoming boundary components}>0\relax
- \foreach[evaluate=\k as \xpos using (\k-1)*\tqft@val{boundary separation}] \k in \tqft@ibdrylist {
- \path[
- /tikz/tqft/every upper boundary component/.try,
- /tikz/tqft/every incoming upper boundary component/.try,
- /tikz/tqft/incoming upper boundary component \k/.try
- ] (\xpos pt - \tqft@val{circle x radius},0) arc[start angle=\pgf@tqft@upper180,end angle=0, x radius=\tqft@val{circle x radius}, y radius =\tqft@val{circle y radius}];
- }
- \fi
- \ifnum\tqft@val{outgoing boundary components}>0\relax
- \foreach[
- evaluate=\k as \xpos using (\k-1+\tqft@val{offset})*\tqft@val{boundary separation}
- ] \k in \tqft@robdrylist {
- \path[
- /tikz/tqft/every upper boundary component/.try,
- /tikz/tqft/every outgoing upper boundary component/.try,
- /tikz/tqft/outgoing upper boundary component \k/.try
- ] (\xpos pt - \tqft@val{circle x radius},-\tqft@val{cobordism height}) arc[start angle=\pgf@tqft@upper180,end angle=0, x radius=\tqft@val{circle x radius}, y radius =\tqft@val{circle y radius}];
- }
- \fi
- \end{scope}
- }
- }
- %%
- %% Copyright (C) 2011 by Andrew Stacey <loopspace@mathforge.org>
- %%
- %% This work may be distributed and/or modified under the
- %% conditions of the LaTeX Project Public License (LPPL), either
- %% version 1.3c of this license or (at your option) any later
- %% version. The latest version of this license is in the file:
- %%
- %% http://www.latex-project.org/lppl.txt
- %%
- %% This work is "maintained" (as per LPPL maintenance status) by
- %% Andrew Stacey.
- %%
- %% This work consists of the files tqft.dtx,
- %% tqft_doc.tex,
- %% and the derived files tqft.ins,
- %% tqft.pdf,
- %% tqft_doc.pdf,
- %% tqft.sty, and
- %% tikzlibrarytqft.code.tex.
- %%
- %%
- %% End of file `tikzlibrarytqft.code.tex'.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement