summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex77
1 files changed, 49 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex b/Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex
index 8eb6cdae31b..e97880fece0 100644
--- a/Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex
+++ b/Master/texmf-dist/tex/latex/tqft/tikzlibrarytqft.code.tex
@@ -4,14 +4,15 @@
%%
%% The original source files were:
%%
-%% tqft.dtx (with options: `library')
+%% tqft_code.dtx (with options: `library')
%% ----------------------------------------------------------------
-%% tqft --- a library for drawing TQFT diagrams with TikZ/PGF
+%% tqft --- a TikZ library for drawing TQFT diagrams
%% E-mail: loopspace@mathforge.org
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
%%
+\ProvidesFile{tikzlibrarytqft.code.tex}[2024/05/31 v2.3 Tikz/PGF commands for drawing TQFT diagrams]
\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}
@@ -20,6 +21,7 @@
\def\pgf@tqft@minus{-}
\let\pgf@tqft@upper\@empty
\let\pgf@tqft@lower\pgf@tqft@minus
+\newif\iftqft@twisted
\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}}%
@@ -61,6 +63,7 @@
\let\pgf@tqft@lower\pgf@tqft@minus
\let\pgf@tqft@upper\@empty
},
+ twisted/.is if=tqft@twisted,
anchor/.initial = none,
pair of pants/.style={
/tikz/tqft,
@@ -138,6 +141,13 @@
\global\let\tqft@cobdrylist=\pgfutil@gobble
\global\let\tqft@robdrylist=\pgfutil@gobble
\global\let\tqft@rcobdrylist=\pgfutil@gobble
+ \iftqft@twisted
+ \pgfmathsetmacro\tqft@outgoing@end{0}%
+ \pgfmathsetmacro\tqft@outgoing@dir{-1}%
+ \else
+ \pgfmathsetmacro\tqft@outgoing@end{1}%
+ \pgfmathsetmacro\tqft@outgoing@dir{1}%
+ \fi
\ifnum\tqft@val{incoming boundary components}>0\relax
\xdef\tqft@fullpath{%
\tqft@fullpath
@@ -182,7 +192,10 @@
\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\xppos{%
+ (\tqft@outgoing@end * (\tqft@val{outgoing boundary components} -1)
+ + \tqft@val{offset}) * \tqft@val{boundary separation}
+ + \tqft@outgoing@dir * \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{%
@@ -205,35 +218,38 @@
.. 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@blist,between first 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)}%
+ \tqft@clist,-between first and last incoming/{(\xppos pt,-\tqft@ht*\tqft@val{cobordism height}*3/4)},-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}}
+ \pgfmathsetmacro\xppos{( \tqft@outgoing@end * (\tqft@val{outgoing boundary components} -1)+\tqft@val{offset}) * \tqft@val{boundary separation} + \tqft@outgoing@dir * \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}}%
+ \ifnum\tqft@val{outgoing boundary components}>0\relax
+ \pgfmathsetmacro\xppos{%
+ ( \tqft@outgoing@end * (\tqft@val{outgoing boundary components} -1)
+ + \tqft@val{offset}) * \tqft@val{boundary separation}
+ - \tqft@outgoing@dir * \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}]
+ arc[end angle=\pgf@tqft@upper180, start angle=0, x radius=\tqft@outgoing@dir * \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})}%
+ \tqft@alist,-outgoing boundary \tqft@val{outgoing boundary components}/{(\xppos pt + \tqft@outgoing@dir * \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}} {
+ \foreach \k [evaluate=\k as \ok using int(\tqft@outgoing@end * (\tqft@val{outgoing boundary components} + 1) - \tqft@outgoing@dir * \k)] in {2,...,\tqft@val{outgoing boundary components}} {
\edef\tqft@temp{\noexpand\pgfutil@in@{,\ok,}{,\tqft@val{skip outgoing boundary components},}}
\tqft@temp
\ifpgfutil@in@
@@ -246,15 +262,15 @@
\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},
+ evaluate=\k as \xpos using ( \tqft@outgoing@end * (\tqft@val{outgoing boundary components} + 1) - 1 - \tqft@outgoing@dir * \k + \tqft@val{offset})*\tqft@val{boundary separation} + \tqft@outgoing@dir * \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\xppos{(\tqft@outgoing@end * (\tqft@val{outgoing boundary components} + 1) - 1 - \tqft@outgoing@dir * \kmo + \tqft@val{offset})*\tqft@val{boundary separation} - \tqft@outgoing@dir * \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}]
+ .. 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@outgoing@dir * \tqft@val{circle x radius}, y radius=\tqft@val{circle y radius}]
}%
\xdef\tqft@blist{%
\tqft@blist,between outgoing \nk\space and \nkpo/outgoing/{%
@@ -278,11 +294,11 @@
}%
\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})
+ ({ ( (1 - \tqft@outgoing@end) * (\tqft@val{outgoing boundary components} - 1) + \tqft@val{offset}) * \tqft@val{boundary separation} - \tqft@outgoing@dir * \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)}%
+ \tqft@clist,-between first incoming and first outgoing/{({ ( (1 - \tqft@outgoing@end) * (\tqft@val{outgoing boundary components} - 1) +\tqft@val{offset})*\tqft@val{boundary separation}/2- \tqft@outgoing@end * \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}}%
@@ -299,7 +315,7 @@
\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})}%
+ \tqft@clist,-between first and last outgoing/{(\xppos pt,-\tqft@ht*\tqft@val{cobordism height})},-between first outgoing and last outgoing/{(\xppos pt,-\tqft@ht*\tqft@val{cobordism height})}%
}%
\fi
\fi
@@ -415,7 +431,8 @@
\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[
+ transform shape,
node contents={},
ellipse,
inner sep=0pt,
@@ -432,7 +449,8 @@
\ifx\tqft@cibdrylist\pgfutil@gobble
\else
\foreach[evaluate=\k as \xpos using (\k-1)*\tqft@val{boundary separation}] \k in \tqft@cibdrylist {
- \node[
+ \node[
+ transform shape,
node contents={},
ellipse,
inner sep=0pt,
@@ -455,13 +473,14 @@
\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 {
+\foreach \k [evaluate=\k as \ok using int(\tqft@outgoing@end * (\tqft@val{outgoing boundary components} + 1) - \tqft@outgoing@dir * \k)] 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[
+ transform shape,
node contents={},
ellipse,
inner sep=0pt,
@@ -477,13 +496,15 @@
}%
\ifx\tqft@cobdrylist\pgfutil@gobble
\else
-\foreach \k [evaluate=\k as \ok using int(\tqft@val{outgoing boundary components} - \k + 1)] in \tqft@cobdrylist {
+\foreach \k[evaluate=\k as \ok using int(\tqft@outgoing@end * (\tqft@val{outgoing boundary components} + 1) - \tqft@outgoing@dir * \k)]
+ 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[
+ transform shape,
node contents={},
ellipse,
inner sep=0pt,
@@ -586,7 +607,7 @@
}
%%
-%% Copyright (C) 2011 by Andrew Stacey <loopspace@mathforge.org>
+%% Copyright (C) 2011-2024 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
@@ -598,11 +619,11 @@
%% 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,
+%% This work consists of the files tqft_code.dtx,
+%% tqft.tex,
+%% and the derived files tqft_code.ins,
+%% tqft_code.pdf,
%% tqft.pdf,
-%% tqft_doc.pdf,
%% tqft.sty, and
%% tikzlibrarytqft.code.tex.
%%