summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tqft/tqft.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/tqft/tqft.dtx')
-rw-r--r--Master/texmf-dist/source/latex/tqft/tqft.dtx145
1 files changed, 118 insertions, 27 deletions
diff --git a/Master/texmf-dist/source/latex/tqft/tqft.dtx b/Master/texmf-dist/source/latex/tqft/tqft.dtx
index 4db565611b9..dc471eed3d8 100644
--- a/Master/texmf-dist/source/latex/tqft/tqft.dtx
+++ b/Master/texmf-dist/source/latex/tqft/tqft.dtx
@@ -26,7 +26,7 @@ This package defines some shapes useful for drawing TQFT diagrams with TikZ/PGF.
\preamble
----------------------------------------------------------------
tqft --- a library for drawing TQFT diagrams with TikZ/PGF
-E-mail: stacey@math.ntnu.no
+E-mail: loopspace@mathforge.org
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
----------------------------------------------------------------
@@ -34,7 +34,7 @@ See http://www.latex-project.org/lppl.txt
\endpreamble
\postamble
-Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no>
+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
@@ -83,7 +83,7 @@ and the derived files tqft.ins,
%</internal>
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tqft}[2014/04/07 v2.0 Tikz/PGF commands for drawing TQFT diagrams]
+\ProvidesPackage{tqft}[2017/06/01 v2.1 Tikz/PGF commands for drawing TQFT diagrams]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -109,7 +109,7 @@ and the derived files tqft.ins,
%</driver>
% \fi
%
-% \CheckSum{2418}
+% \CheckSum{2577}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -130,13 +130,14 @@ and the derived files tqft.ins,
%
% \changes{1.0}{2011/05/03}{Converted to DTX file}
% \changes{2.0}{2014/04/07}{Converted nodes to pics}
+% \changes{2.1}{2017/06/01}{Can skip boundary components}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \providecommand*{\url}{\texttt}
% \GetFileInfo{tqft.dtx}
% \title{The \textsf{tqft} package: codebase}
-% \author{Andrew Stacey \\ \url{stacey@math.ntnu.no}}
+% \author{Andrew Stacey \\ \url{loopspace@mathforge.org}}
%
% \maketitle
%
@@ -1313,6 +1314,8 @@ and the derived files tqft.ins,
% \begin{macrocode}
incoming boundary components/.initial=5,
outgoing boundary components/.initial=4,
+ skip incoming boundary components/.initial={},
+ skip outgoing boundary components/.initial={},
genus/.initial = 0,
% \end{macrocode}
% This is the ``horizontal'' offset of the first outgoing component from the first incoming one.
@@ -1448,6 +1451,15 @@ and the derived files tqft.ins,
% \begin{macrocode}
\global\let\tqft@alist\pgfutil@gobble
% \end{macrocode}
+% These will be lists of the boundary components, divided into sets as to whether or not they are rendered. For the outgoing ones, we need too lists because they are rendered in the opposite order to how they are labelled.
+% \begin{macrocode}
+ \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
+% \end{macrocode}
% The first stage is to iterate over the incoming boundary components (if there are any), building up the various paths.
% \begin{macrocode}
\ifnum\tqft@val{incoming boundary components}>0\relax
@@ -1468,13 +1480,24 @@ and the derived files tqft.ins,
% \end{macrocode}
% If there are more than one then for each subsequent one we add the curve between them and the corresponding arc of the boundary circle.
% \begin{macrocode}
- \ifnum\tqft@val{incoming boundary components}>1\relax
- \foreach[
+ \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},
- 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}} {
+ ] in \tqft@ibdrylist {
+ \pgfmathsetmacro\xppos{(\kmo - 1)*\tqft@val{boundary separation} + \tqft@val{circle x radius}}
+ \pgfmathsetmacro\cpos{(\xpos + \xppos)/2}
% \end{macrocode}
% Add the curve and the arc.
% \begin{macrocode}
@@ -1501,7 +1524,8 @@ and the derived files tqft.ins,
\xdef\tqft@alist{%
\tqft@alist,-incoming boundary \k/{(\kmo * \tqft@val{boundary separation},0)}%
}%
- }%
+ }%
+ \fi
\fi
% \end{macrocode}
% We're at the edge of the last incoming boundary component.
@@ -1600,13 +1624,25 @@ and the derived files tqft.ins,
% \end{macrocode}
% Yes, so add a curve and arc for each.
% \begin{macrocode}
- \foreach[
+ \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},
- 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}} {
+ ] 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)}
% \end{macrocode}
% Both are added to the full path.
% \begin{macrocode}
@@ -1635,7 +1671,8 @@ and the derived files tqft.ins,
\tqft@alist,-outgoing boundary \nk/{(\xpos pt - \tqft@val{circle x radius},-\tqft@val{cobordism height})}%
}%
}%
- \fi
+ \fi
+ \fi
% \end{macrocode}
% Now we're at the end of the outgoing boundary components (well, the start actually).
% What we do now depends on whether or not there are any incoming boundary components.
@@ -1880,8 +1917,13 @@ and the derived files tqft.ins,
% \end{macrocode}
% At each incoming boundary component we place an elliptical node of the right size.
% \begin{macrocode}
- \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}} {
+\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,
@@ -1896,6 +1938,24 @@ and the derived files tqft.ins,
/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
% \end{macrocode}
% Add an alias for the first.
% \begin{macrocode}
@@ -1905,9 +1965,17 @@ and the derived files tqft.ins,
% Same for the outgoing boundary components.
% \begin{macrocode}
\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 {1,...,\tqft@val{outgoing boundary components}} {
+ evaluate=\k as \xpos using (\k-1+\tqft@val{offset})*\tqft@val{boundary separation}
+ ] \k in \tqft@robdrylist {
\node[
node contents={},
ellipse,
@@ -1921,7 +1989,30 @@ and the derived files tqft.ins,
/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
% \end{macrocode}
% Add an alias for the first.
% \begin{macrocode}
@@ -1931,7 +2022,7 @@ and the derived files tqft.ins,
% Now we draw the lower paths of the incoming boundary components.
% \begin{macrocode}
\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}} {
+ \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,
@@ -1945,7 +2036,7 @@ and the derived files tqft.ins,
\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}} {
+ ] \k in \tqft@robdrylist {
\path[
/tikz/tqft/every lower boundary component/.try,
/tikz/tqft/every outgoing lower boundary component/.try,
@@ -2016,7 +2107,7 @@ and the derived files tqft.ins,
% First, incoming.
% \begin{macrocode}
\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}} {
+ \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,
@@ -2030,7 +2121,7 @@ and the derived files tqft.ins,
\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}} {
+ ] \k in \tqft@robdrylist {
\path[
/tikz/tqft/every upper boundary component/.try,
/tikz/tqft/every outgoing upper boundary component/.try,