diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-08 22:20:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-08 22:20:48 +0000 |
commit | d213249d916724bc567b5c28883cf6965db2e18e (patch) | |
tree | d312409939a24d78081449664e8ff32a5654a427 /Master/texmf-dist/tex/latex | |
parent | 2cf705b464bf17366d3da797f80f41965c54f85b (diff) |
tqft (8apr14)
git-svn-id: svn://tug.org/texlive/trunk@33411 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex | 523 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tqft/tqft.sty | 59 |
2 files changed, 564 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex b/Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex new file mode 100644 index 00000000000..24dcfb1bd46 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex @@ -0,0 +1,523 @@ +%% +%% 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: stacey@math.ntnu.no +%% 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, + 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 + \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[ + evaluate=\k as \xpos using (\k-1)*\tqft@val{boundary separation} -\tqft@val{circle x radius}, + evaluate=\k as \xppos using (\k-2)*\tqft@val{boundary separation} +\tqft@val{circle x radius}, + evaluate=\k as \cpos using (\k-1.5)*\tqft@val{boundary separation}, + evaluate=\k as \kmo using int(\k-1) + ] \k in {2,...,\tqft@val{incoming boundary components}} { + \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 + \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[ + evaluate=\k as \xpos using (\tqft@val{outgoing boundary components} - \k + \tqft@val{offset})*\tqft@val{boundary separation} + \tqft@val{circle x radius}, + evaluate=\k as \xppos using (\tqft@val{outgoing boundary components} - \k + 1 + \tqft@val{offset})*\tqft@val{boundary separation} - \tqft@val{circle x radius}, + evaluate=\k as \cpos using (\tqft@val{outgoing boundary components} - \k + .5 + \tqft@val{offset})*\tqft@val{boundary separation}, + evaluate=\k as \nk using int(\tqft@val{outgoing boundary components} - \k + 1), + evaluate=\k as \nkpo using int(\tqft@val{outgoing boundary components} - \k + 2), + ] \k in {2,...,\tqft@val{outgoing boundary components}} { + \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 + \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 + \foreach[evaluate=\k as \xpos using (\k-1)*\tqft@val{boundary separation}] \k in {1,...,\tqft@val{incoming boundary components}} { + \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 + ]; + }% + \path node also[pic alias=-incoming boundary] (-incoming boundary 1); + \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 {1,...,\tqft@val{outgoing boundary components}} { + \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 + ]; + }% + \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 {1,...,\tqft@val{incoming boundary components}} { + \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 {1,...,\tqft@val{outgoing boundary components}} { + \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 {1,...,\tqft@val{incoming boundary components}} { + \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 {1,...,\tqft@val{outgoing boundary components}} { + \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 <stacey@math.ntnu.no> +%% +%% 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'. diff --git a/Master/texmf-dist/tex/latex/tqft/tqft.sty b/Master/texmf-dist/tex/latex/tqft/tqft.sty index 490c95867b2..a85df63cc49 100644 --- a/Master/texmf-dist/tex/latex/tqft/tqft.sty +++ b/Master/texmf-dist/tex/latex/tqft/tqft.sty @@ -6,14 +6,14 @@ %% %% tqft.dtx (with options: `package') %% ---------------------------------------------------------------- -%% tqft --- a style file for drawing TQFT diagrams with TikZ/PGF +%% tqft --- a library for drawing TQFT diagrams with TikZ/PGF %% E-mail: stacey@math.ntnu.no %% Released under the LaTeX Project Public License v1.3c or later %% See http://www.latex-project.org/lppl.txt %% ---------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tqft}[2011/05/03 v1.0 Tikz/PGF commands for drawing TQFT diagrams] +\ProvidesPackage{tqft}[2014/04/07 v2.0 Tikz/PGF commands for drawing TQFT diagrams] \RequirePackage{pgfkeys} \RequirePackage{pgf} \def\pgf@tqft@minus{-} @@ -40,22 +40,42 @@ \newdimen\tqft@w \newif\iftqft@within@node \pgfkeys{ - /tikz/tqft/.style={% - /tikz/shape=tqft cobordism, - /pgf/tqft, - /tikz/every tqft + /tikz/tqft/use nodes/.is choice, + /tikz/tqft/use nodes/true/.code={% + \tikzset{ + tqft/.style={% + /tikz/shape=tqft cobordism, + /pgf/tqft, + /tikz/every tqft/.try + }, + tqft/.unknown/.code={% + \let\tqft@searchname=\pgfkeyscurrentname% + \pgfkeys{% + /pgf/tqft/\tqft@searchname={##1} + } + }, + }% }, - /pgf/tqft/.unknown/.code={% - \let\tqft@searchname=\pgfkeyscurrentname% - \pgfkeysalso{% - /tikz/\tqft@searchname=#1 - } + /tikz/tqft/use nodes/false/.code={% + \tikzset{ + tqft/.style={% + pic type=cobordism, + tqft/.cd, + every tqft/.try, + }, + tqft/.unknown/.code={% + \let\tqft@searchname=\pgfkeyscurrentname% + \pgfkeys{% + /tikz/\tqft@searchname={##1} + } + }, + }% }, - /tikz/every tqft/.style={}, - /tikz/tqft/.unknown/.code={% + /tikz/tqft/use nodes=true, + /pgf/tqft/.unknown/.code={% \let\tqft@searchname=\pgfkeyscurrentname% \pgfkeysalso{% - /pgf/tqft/\tqft@searchname=#1 + /tikz/\tqft@searchname={#1} } }, /pgf/tqft/.is family, @@ -744,10 +764,13 @@ %% This work is "maintained" (as per LPPL maintenance status) by %% Andrew Stacey. %% -%% This work consists of the file tqft.dtx -%% and the derived files tqft.ins, -%% tqft.pdf, and -%% tqft.sty. +%% 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 `tqft.sty'. |