%%
%% This is file `brunnian.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% brunnian.dtx  (with options: `package')
%% ----------------------------------------------------------------
%% brunnian --- a style file for drawing link 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{brunnian}[2011/03/10 v1.0 Tikz/PGF commands for drawing knots and links]



\ProvidesPackage{brunnian}
\newif\ifsvg
\@ifpackageloaded{tex4ht}{
\svgtrue
}{}
\ifsvg
\def\pgfsysdriver{pgfsys-tex4ht.def}
\fi
\RequirePackage[svgnames]{xcolor}
\RequirePackage{tikz}
\RequirePackage{colorinfo}
\usetikzlibrary{calc}
\xglobal\colorlet{background}{white}
\newcommand{\resetbgcolour}[1]{%
  \xglobal\colorlet{background}{#1}
  \colorInfo{background}
  \edef\br@white{\colorValue}
}
\AtBeginDocument{%
  \colorInfo{background}%
  \edef\br@white{\colorValue}%
}
\xglobal\colorlet{ring1}{Red}
\xglobal\colorlet{ring2}{Green}
\xglobal\colorlet{ring3}{Blue}
\xglobal\colorlet{ring4}{Orange}
\xglobal\colorlet{ring5}{Purple}
\xglobal\colorlet{ring6}{Chartreuse}
\xglobal\colorlet{ring7}{Sienna}
\xglobal\colorlet{ring8}{DeepPink}
\xglobal\colorlet{ring9}{Gold}
\xglobal\colorlet{ring10}{DarkViolet}
\foreach \k in {1,2,3,4} {
  \foreach \m in {1,2,3,4} {
    \pgfmathparse{int(Mod(\m + \k - 2,4) + 1)}
    \xglobal\colorlet{ring\k\m}{ring\k!50!ring\pgfmathresult}
    \foreach \l in {1,2,3,4} {
      \pgfmathparse{int(Mod(\l + \k - 2,4) + 1)}
      \xglobal\colorlet{ring\k\m\l}{ring\k\m!50!ring\pgfmathresult}
    }
  }
}
\pgfdeclarelayer{back}
\pgfdeclarelayer{front}
\pgfsetlayers{back,main,front}
\pgfmathsetmacro{\br@step}{1/4}
\pgfmathsetmacro{\br@theta}{10}
\let\brstep=\br@step
\edef\br@one{1}
\edef\br@zero{0}
\newcommand{\setbrstep}[1]{%
\def\br@step{#1}}
\tikzset{knot/.style={double distance=1pt,line width=2pt,background}}
\tikzset{thin knot/.style={double distance=.5pt,line width=1pt,background}}
\tikzset{thick knot/.style={double distance=2pt,line width=4pt,background}}
\tikzset{string/.style={line width=1pt}}
\newcommand{\getangle}[5]{%
\pgfmathsetmacro{\br@num}{int(4 ^ (#1 - 1) + .5)}
\pgfmathsetmacro{\br@dir}{#3}
\pgfmathsetmacro{\br@innersep}{#1 == 1 ? 4 : 0}
\pgfmathsetmacro{\br@mr}{#2 -\br@step + (2*\br@num + .5) *\br@step * (1 - \br@dir)}
\pgfmathsetmacro{\br@angle}{atan((6 * \br@num + 2*\br@innersep) * \br@step/\br@mr)}
\ifx\relax#4\relax
\pgfmathparse{ceil(\br@angle)}
\else
\pgfmathparse{int(#4 > \br@angle ? #4 : ceil(\br@angle))}
\fi
\xdef\clockangle{\pgfmathresult}
\ifx\relax#5\relax
\pgfmathparse{ceil(\br@angle)}
\else
\pgfmathparse{int(#5 > \br@angle ? #5 : ceil(\br@angle))}
\fi
\xdef\aclockangle{\pgfmathresult}
\pgfmathparse{int(\clockangle + \aclockangle)}
\xdef\totalangle{\pgfmathresult}
}
\newcommand{\junction}[5]{%
\pgfmathsetmacro{\br@midpt}{#3}
\pgfmathsetmacro{\br@dir}{(\br@midpt == 0 ? 1 : \br@midpt)}
\begin{scope}[xscale=\br@dir]
\pgfmathsetmacro{\br@num}{int(4 ^ (#1 - 1) + .5)}
\pgfmathsetmacro{\br@innersep}{#1 == 1 ? 4 : 0}
\pgfmathsetmacro{\br@mr}{#2 -\br@step + (2*\br@num + .5) *\br@step * (1 - \br@dir)}
\pgfmathsetmacro{\br@angle}{atan((6 * \br@num + 2*\br@innersep) * \br@step/\br@mr)}
\ifx\relax#4\relax
\pgfmathsetmacro{\br@outerangle}{ceil(\br@angle)}
\else
\pgfmathsetmacro{\br@outerangle}{#4 > \br@angle ? #4 : ceil(\br@angle)}
\fi
\ifx\relax#5\relax
\pgfmathsetmacro{\br@innerangle}{ceil(\br@angle)}
\else
\pgfmathsetmacro{\br@innerangle}{#5 > \br@angle ? #5 : ceil(\br@angle)}
\fi
\pgfmathsetmacro{\br@sin}{sin(\br@angle)}
\pgfmathsetmacro{\br@cos}{cos(\br@angle)}
\path (0,0) circle (2pt);
\edef\br@itstart{1}
\pgfmathsetmacro{\br@itend}{2*\br@num}
\edef\br@mcolor{outer}
\foreach \br@m in {\br@itstart,...,\br@itend} {
\@ifundefinedcolor{outer\br@m}{%
}{%
\global\edef\br@mcolor{outer\br@m}
}
\pgfmathsetmacro{\br@inr}{\br@mr +  \br@m * \br@dir * \br@step}
\pgfmathsetmacro{\br@outr}{\br@mr + (\br@num * 4 + 1 - \br@m) * \br@dir * \br@step}
\pgfmathsetmacro{\br@x}{-1*\br@inr *\br@sin}
\pgfmathsetmacro{\br@y}{-1*\br@inr *\br@cos}
\pgfmathsetmacro{\br@xx}{-1*\br@outr *\br@sin}
\pgfmathsetmacro{\br@yy}{-1*\br@outr *\br@cos}
\pgfmathsetmacro{\br@r}{(6*\br@num - 2*\br@m + \br@innersep)*\br@step/2}
\pgfmathsetmacro{\br@midr}{(\br@midpt == 0 ? (\br@inr + \br@outr)/2 + \br@r: \br@outr)}
\colorInfo{\br@mcolor}
\ifx\colorValue\br@white
\else
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) to[out=-\br@angle,in=180] (0,-\br@midr) arc(-\br@dir * 90:\br@dir * 90:\br@r) to[out=180,in=-\br@angle] (\br@x,\br@y);
\draw[knot,double=\br@mcolor] (\br@x,\br@y) arc(-90-\br@angle:-90-\br@outerangle:\br@inr);
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) arc(-90-\br@angle:-90-\br@outerangle:\br@outr);
\fi
}
\edef\br@itstart{1}
\pgfmathsetmacro{\br@itend}{2*\br@num}
\edef\br@mcolor{inner}
\foreach \br@m in {\br@itstart,...,\br@itend} {
\@ifundefinedcolor{inner\br@m}{%
}{%
\global\edef\br@mcolor{inner\br@m}
}
\pgfmathsetmacro{\br@inward}{2 * (-.5 + (\br@m > \br@num))}
\pgfmathsetmacro{\br@inr}{\br@mr + (\br@num+\br@m) * \br@dir * \br@step}
\pgfmathsetmacro{\br@outr}{\br@mr + (3*\br@num + 1 + \br@inward * 2*\br@num - \br@m) * \br@dir * \br@step}
\pgfmathsetmacro{\br@inmidr}{\br@inr - \br@midpt * \br@innersep * \br@step / 2 - \br@num * \br@midpt * \br@step + .5*\br@midpt * \br@step}
\pgfmathsetmacro{\br@outmidr}{\br@outr - \br@midpt * \br@innersep * \br@step /2 + \br@inward * \br@dir * \br@innersep * \br@step/2 - \br@num * \br@midpt * \br@step + .5*\br@midpt * \br@step}
\pgfmathsetmacro{\br@x}{\br@inr *\br@sin}
\pgfmathsetmacro{\br@y}{-1*\br@inr *\br@cos}
\pgfmathsetmacro{\br@xx}{\br@outr *\br@sin}
\pgfmathsetmacro{\br@yy}{-1*\br@outr *\br@cos}
\pgfmathsetmacro{\br@r}{(\br@num * (1 + \br@inward) - \br@inward * (\br@m - .5)) *\br@step + \br@innersep * \br@step/4}
\colorInfo{\br@mcolor}
\ifx\colorValue\br@white
\else
\begin{pgfonlayer}{front}
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) to[out=180+\br@angle,in=0] (0,-\br@outmidr) arc(\br@inward *\br@dir * 270:\br@inward *\br@dir * 90:\br@r);
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) arc(-90+\br@angle:-90+\br@innerangle:\br@outr);
\end{pgfonlayer}
\begin{pgfonlayer}{back}
\draw[knot,double=\br@mcolor] (\br@x,\br@y) to[out=180+\br@angle,in=0] (0,-\br@inmidr);
\draw[knot,double=\br@mcolor] (\br@x,\br@y) arc(-90+\br@angle:-90+\br@innerangle:\br@inr);
\end{pgfonlayer}
\fi
}
\end{scope}
}
\newcommand{\flatjunction}[5]{%
\begin{scope}[xscale=#3]
\pgfmathsetmacro{\br@num}{4 ^ (#1 - 1)}
\pgfmathsetmacro{\br@dir}{#3}
\pgfmathsetmacro{\br@innersep}{#1 == 1 ? 4 : 0}
\pgfmathsetmacro{\br@mr}{0}%#2 -\br@step + (2*\br@num + .5) *\br@step * (1 - \br@dir)}
\edef\br@itstart{1}
\pgfmathsetmacro{\br@itend}{2*\br@num}
\edef\br@mcolor{outer}
\foreach \br@m in {\br@itstart,...,\br@itend} {
\@ifundefinedcolor{outer\br@m}{%
}{%
\global\edef\br@mcolor{outer\br@m}
}
\pgfmathsetmacro{\br@inr}{\br@mr +  \br@m * \br@dir * \br@step}
\pgfmathsetmacro{\br@outr}{\br@mr + (\br@num * 4 + 1 - \br@m) * \br@dir * \br@step}
\pgfmathsetmacro{\br@x}{-8*\br@step}
\pgfmathsetmacro{\br@y}{-1*\br@inr}
\pgfmathsetmacro{\br@xx}{-8*\br@step}
\pgfmathsetmacro{\br@yy}{-1*\br@outr}
\pgfmathsetmacro{\br@r}{(6*\br@num - 2*\br@m + \br@innersep)*\br@step/2}
\colorInfo{\br@mcolor}
\ifx\colorValue\br@white
\else
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) -- ++(8*\br@step,0) arc(-90:-90:\br@outr) arc(-\br@dir * 90:\br@dir * 90:\br@r) to[out=180,in=0] (\br@x,\br@y);
\fi
}
\edef\br@itstart{1}
\pgfmathsetmacro{\br@itend}{2*\br@num}
\edef\br@mcolor{inner}
\foreach \br@m in {\br@itstart,...,\br@itend} {
\@ifundefinedcolor{inner\br@m}{%
}{%
\global\edef\br@mcolor{inner\br@m}
}
\pgfmathsetmacro{\br@inward}{2 * (-.5 + (\br@m > \br@num))}
\pgfmathsetmacro{\br@inr}{\br@mr + (\br@num+\br@m) * \br@dir * \br@step}
\pgfmathsetmacro{\br@outr}{\br@mr + (3*\br@num + 1 + \br@inward * 2*\br@num - \br@m) * \br@dir * \br@step}
\pgfmathsetmacro{\br@inmidr}{\br@inr - \br@dir * \br@innersep * \br@step / 2 - \br@num * \br@dir * \br@step + .5*\br@dir * \br@step}
\pgfmathsetmacro{\br@outmidr}{\br@outr - \br@dir * \br@innersep * \br@step /2 + \br@inward * \br@dir * \br@innersep * \br@step/2 - \br@num * \br@dir * \br@step + .5*\br@dir * \br@step}
\pgfmathsetmacro{\br@x}{8*\br@step}
\pgfmathsetmacro{\br@y}{-1*\br@inr}
\pgfmathsetmacro{\br@xx}{8*\br@step}
\pgfmathsetmacro{\br@yy}{-1*\br@outr}
\pgfmathsetmacro{\br@r}{(\br@num * (1 + \br@inward) - \br@inward * (\br@m - .5)) *\br@step + \br@innersep * \br@step/4}
\colorInfo{\br@mcolor}
\ifx\colorValue\br@white
\else
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) to[out=180,in=0] (0,-\br@outmidr) arc(\br@inward *\br@dir * 270:\br@inward *\br@dir * 90:\br@r);
\begin{pgfonlayer}{back}
\draw[knot,double=\br@mcolor] (\br@x,\br@y) to[out=180,in=0] (0,-\br@inmidr);
\end{pgfonlayer}
\fi
}
\end{scope}
}
\newcommand{\gethopfangle}[5]{%
\pgfmathsetmacro{\br@num}{2 ^ (#1 - 1)}
\pgfmathsetmacro{\br@dir}{#3}
\pgfmathsetmacro{\br@innersep}{2}%{#1 == 1 ? 2 : 0}
\pgfmathsetmacro{\br@mr}{#2 -\br@step + (\br@num + .5) *\br@step * (1 - \br@dir)}
\pgfmathsetmacro{\br@angle}{atan((3 * \br@num + 2*\br@innersep) * \br@step/\br@mr)}
\ifx\relax#4\relax
\pgfmathparse{ceil(\br@angle)}
\else
\pgfmathparse{int(#4 > \br@angle ? #4 : ceil(\br@angle))}
\fi
\xdef\clockangle{\pgfmathresult}
\ifx\relax#5\relax
\pgfmathparse{ceil(\br@angle)}
\else
\pgfmathparse{int(#5 > \br@angle ? #5 : ceil(\br@angle))}
\fi
\xdef\aclockangle{\pgfmathresult}
\pgfmathparse{int(\clockangle + \aclockangle)}
\xdef\totalangle{\pgfmathresult}
}
\newcommand{\hopfjunction}[5]{%
\begin{scope}[xscale=#3]
\pgfmathsetmacro{\br@num}{2 ^ (#1 - 1)}
\pgfmathsetmacro{\br@dir}{#3}
\pgfmathsetmacro{\br@innersep}{2}%{#1 < 3 ? 2 : 0}
\pgfmathsetmacro{\br@mr}{#2 -\br@step + (\br@num + .5) *\br@step * (1 - \br@dir)}
\pgfmathsetmacro{\br@angle}{atan((3 * \br@num + 2*\br@innersep) * \br@step/\br@mr)}
\ifx\relax#4\relax
\pgfmathsetmacro{\br@outerangle}{ceil(\br@angle)}
\else
\pgfmathsetmacro{\br@outerangle}{#4 > \br@angle ? #4 : ceil(\br@angle)}
\fi
\ifx\relax#5\relax
\pgfmathsetmacro{\br@innerangle}{ceil(\br@angle)}
\else
\pgfmathsetmacro{\br@innerangle}{#5 > \br@angle ? #5 : ceil(\br@angle)}
\fi
\pgfmathsetmacro{\br@sin}{sin(\br@angle)}
\pgfmathsetmacro{\br@cos}{cos(\br@angle)}
\path (0,0) circle (2pt);
\edef\br@itstart{1}
\pgfmathsetmacro{\br@itend}{\br@num}
\edef\br@mcolor{outer}
\foreach \br@m in {\br@itstart,...,\br@itend} {
\@ifundefinedcolor{outer\br@m}{%
}{%
\global\edef\br@mcolor{outer\br@m}
}
\pgfmathsetmacro{\br@inr}{\br@mr +  \br@m * \br@dir * \br@step}
\pgfmathsetmacro{\br@outr}{\br@mr + (\br@num * 2 + 1 - \br@m) * \br@dir * \br@step}
\pgfmathsetmacro{\br@x}{-1*\br@inr *\br@sin}
\pgfmathsetmacro{\br@y}{-1*\br@inr *\br@cos}
\pgfmathsetmacro{\br@xx}{-1*\br@outr *\br@sin}
\pgfmathsetmacro{\br@yy}{-1*\br@outr *\br@cos}
\pgfmathsetmacro{\br@r}{(\br@num - \br@m + \br@innersep + .5)*\br@step}
\colorInfo{\br@mcolor}
\ifx\colorValue\br@white
\else
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) arc(-90-\br@angle:-90:\br@outr) arc(-\br@dir * 90:\br@dir * 90:\br@r) to[out=180,in=-\br@angle] (\br@x,\br@y);
\draw[knot,double=\br@mcolor] (\br@x,\br@y) arc(-90-\br@angle:-90-\br@outerangle:\br@inr);
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) arc(-90-\br@angle:-90-\br@outerangle:\br@outr);
\fi
}
\edef\br@itstart{1}
\pgfmathsetmacro{\br@itend}{\br@num}
\edef\br@mcolor{inner}
\foreach \br@m in {\br@itstart,...,\br@itend} {
\@ifundefinedcolor{inner\br@m}{%
}{%
\global\edef\br@mcolor{inner\br@m}
}
\pgfmathsetmacro{\br@inr}{\br@mr +  \br@m * \br@dir * \br@step}
\pgfmathsetmacro{\br@outr}{\br@mr + (\br@num * 2 + 1 - \br@m) * \br@dir * \br@step}
\pgfmathsetmacro{\br@x}{\br@inr *\br@sin}
\pgfmathsetmacro{\br@y}{-1*\br@inr *\br@cos}
\pgfmathsetmacro{\br@xx}{\br@outr *\br@sin}
\pgfmathsetmacro{\br@yy}{-1*\br@outr *\br@cos}
\pgfmathsetmacro{\br@r}{-(\br@num - \br@m + \br@innersep + .5)*\br@step}
\colorInfo{\br@mcolor}
\ifx\colorValue\br@white
\else
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) arc(-90+\br@angle:-90:\br@outr) arc(\br@dir * 90:0:\br@r);
\begin{pgfonlayer}{back}
\draw[knot,double=\br@mcolor] (\br@x,\br@y) to[out=180+\br@angle,in=0] (0,-\br@outr - \br@dir * 2*\br@r) arc(-\br@dir * 90:0:\br@r);
\end{pgfonlayer}
\draw[knot,double=\br@mcolor] (\br@x,\br@y) arc(-90+\br@angle:-90+\br@innerangle:\br@inr);
\draw[knot,double=\br@mcolor] (\br@xx,\br@yy) arc(-90+\br@angle:-90+\br@innerangle:\br@outr);
\fi
}
\end{scope}
}
\newcommand{\brunnian}[3][1]{%
\pgfmathsetmacro{\br@n}{#3}
\pgfmathsetmacro{\br@phi}{360/\br@n}
\pgfmathsetmacro{\br@psi}{180/\br@n}
\foreach \br@k in {1,...,\br@n} {
\pgfmathparse{int(\br@k == 1 ? \br@n : \br@k - 1)}
\edef\br@m{\pgfmathresult}
\begin{scope}[rotate=\br@m * \br@phi]
  \colorlet{outer}{ring\br@m}
  \colorlet{inner}{ring\br@k}
  \junction{#1}{#2}{1}{\br@psi}{\br@psi}
\end{scope}
}
}
\newcommand{\outbrunnian}[3][1]{%
\pgfmathsetmacro{\br@n}{#3}
\pgfmathsetmacro{\br@phi}{360/\br@n}
\pgfmathsetmacro{\br@psi}{180/\br@n}
\foreach \br@k in {1,...,\br@n} {
\pgfmathparse{int(\br@k == 1 ? \br@n : \br@k - 1)}
\edef\br@m{\pgfmathresult}
\begin{scope}[rotate=\br@m * \br@phi]
  \colorlet{inner}{ring\br@m}
  \colorlet{outer}{ring\br@k}
  \junction{#1}{#2}{-1}{\br@psi}{\br@psi}
\end{scope}
}
}
\newcommand{\midbrunnian}[3][1]{%
\pgfmathsetmacro{\br@n}{#3}
\pgfmathsetmacro{\br@phi}{360/\br@n}
\pgfmathsetmacro{\br@psi}{180/\br@n}
\foreach \br@k in {1,...,\br@n} {
\pgfmathparse{int(\br@k == 1 ? \br@n : \br@k - 1)}
\edef\br@m{\pgfmathresult}
\begin{scope}[rotate=\br@m * \br@phi]
  \colorlet{outer}{ring\br@m}
  \colorlet{inner}{ring\br@k}
  \junction{#1}{#2}{0}{\br@psi}{\br@psi}
\end{scope}
}
}
\newcommand{\brunniantwo}[3]{%
 \edef\br@p{#3}
 \edef\br@q{#2}
 \pgfmathsetmacro{\br@radius}{#1}
 \pgfmathparse{int(mod(\br@q,2))}
    \edef\br@qodd{\pgfmathresult}
 \pgfmathparse{int(\br@q - 1 + \br@qodd)}
 \edef\br@qmo{\pgfmathresult}
 \pgfmathparse{int(\br@q == 1 ? 1 : 2)}
 \edef\br@qtwo{\pgfmathresult}
 \pgfmathsetmacro{\br@phi}{360/\br@p}
 \pgfmathsetmacro{\br@psi}{180/(\br@p * (ceil(\br@q/2)+1))}
 \foreach \br@k in {1,...,\br@p} {
  \pgfmathparse{int(\br@k == 1 ? \br@p : \br@k - 1)}
  \edef\br@m{\pgfmathresult}
  \begin{scope}[rotate=\br@m * \br@phi]
   \colorlet{outer}{ring\br@k\br@qtwo}
   \colorlet{outer5}{ring\br@k\br@qmo}
   \colorlet{inner}{ring\br@m\br@qmo}
   \junction{2}{\br@radius}{-1}{\br@psi}{\br@psi}
   \begin{scope}[rotate=\br@phi/2]
    \foreach \br@i in {1,...,\br@q} {
     \pgfmathsetmacro{\br@rho}{(\br@i - (1 - mod(\br@i,2))*(1 - \br@qodd) - ceil(\br@q/2)) * \br@psi}
     \begin{scope}[rotate=\br@rho]
      \pgfmathsetmacro{\br@mi}{mod(\br@i,2)}
      \pgfmathsetmacro{\br@modi}{(-1)^\br@mi}
      \pgfmathparse{int(\br@i == 1 || \br@i == \br@q - \br@qodd ? \br@i + \br@qtwo - 1 - 2*(1 - \br@qodd)*(1 - \br@mi) : \br@i + \br@modi * 2)}
      \edef\br@j{\pgfmathresult}
      \colorlet{outer}{ring\br@k\br@i}
      \colorlet{inner}{ring\br@k\br@j}
      \junction{1}{\br@radius+12 * \br@mi * \br@step}{\br@modi}{\br@psi}{\br@psi}
     \end{scope}
    }
   \end{scope}
\ifx\br@qodd\br@one
   \fillin{\br@radius}{1}{4}{\br@psi}{(1.5 + \br@qodd/2)*\br@psi}{ring\br@k\br@qtwo}
   \fillin{\br@radius}{1}{4}{\br@phi -\br@psi}{\br@phi - (1.5 + \br@qodd/2)*\br@psi}{ring\br@k\br@qmo}
\fi
   \fillin{\br@radius}{5}{12}{\br@psi}{\br@phi - \br@psi}{ring\br@k\br@qmo}
  \end{scope}
 }
}
\newcommand{\fillin}[6]{%
\colorInfo{#6}
\ifx\colorValue\br@white
\else
\pgfmathsetmacro{\br@sin}{sin(#4)};
\pgfmathsetmacro{\br@cos}{cos(#4)}
\foreach \br@fk in {#2,...,#3} {
\pgfmathsetmacro{\br@r}{#1 + (\br@fk - 1) * \br@step}
\draw[knot,double=#6] (\br@r * \br@sin, -\br@r * \br@cos) arc(-90+#4:-90+#5:\br@r);
}
\fi
}
\newcommand{\hopfring}[2]{%
\pgfmathsetmacro{\br@n}{#2}
\pgfmathsetmacro{\br@phi}{360/\br@n}
\gethopfangle{1}{#1}{1}{}{}
\pgfmathsetmacro{\br@psi}{360/\br@n - \clockangle}
\foreach \br@k in {1,...,\br@n} {
\pgfmathparse{int(\br@k == 1 ? \br@n : \br@k - 1)}
\edef\br@m{\pgfmathresult}
\begin{scope}[rotate=\br@m * \br@phi]
  \colorlet{outer}{ring\br@m}
  \colorlet{inner}{ring\br@k}
  \hopfjunction{1}{#1}{1}{}{}
\pgfmathparse{Mod(\br@k,2) == 0 ? "\noexpand\fillin{#1}{1}{2}{\clockangle}{\br@psi}{inner}" : ""}
\begin{pgfonlayer}{back}
    \pgfmathresult
\end{pgfonlayer}
\pgfmathparse{Mod(\br@k,2) == 0 ? "" : "\noexpand\fillin{#1}{1}{2}{\clockangle}{\br@psi}{inner}"}
    \pgfmathresult
\end{scope}
}
}
\newcommand{\hopftwo}[3]{%
 \edef\br@p{#3}
 \edef\br@q{#2}
 \pgfmathsetmacro{\br@radius}{#1}
 \pgfmathsetmacro{\br@qodd}{mod(\br@q,2)}
 \pgfmathparse{int(\br@q - 1 + \br@qodd)}
 \edef\br@qmo{\pgfmathresult}
 \pgfmathparse{int(\br@q == 1 ? 1 : 2)}
 \edef\br@qtwo{\pgfmathresult}
 \pgfmathsetmacro{\br@phi}{360/\br@p}
 \pgfmathsetmacro{\br@psi}{180/(\br@p * (ceil(\br@q/2)+1))}
 \foreach \br@k in {1,...,\br@p} {
  \pgfmathparse{int(\br@k == 1 ? \br@p : \br@k - 1)}
  \edef\br@m{\pgfmathresult}
  \begin{scope}[rotate=\br@m * \br@phi]
   \colorlet{outer}{ring\br@k\br@qtwo}
   \colorlet{outer5}{ring\br@k\br@qmo}
   \colorlet{inner}{ring\br@m\br@qmo}
   \hopfjunction{2}{\br@radius}{-1}{\br@psi}{\br@psi}
   \begin{scope}[rotate=\br@phi/2]
    \foreach \br@i in {1,...,\br@q} {
     \pgfmathsetmacro{\br@rho}{(\br@i - (1 - mod(\br@i,2))*(1 - \br@qodd) - ceil(\br@q/2)) * \br@psi}
     \begin{scope}[rotate=\br@rho]
      \pgfmathsetmacro{\br@mi}{mod(\br@i,2)}
      \pgfmathsetmacro{\br@modi}{(-1)^\br@mi}
      \pgfmathparse{int(\br@i == 1 || \br@i == \br@q - \br@qodd ? \br@i + \br@qtwo - 1 - 2*(1 - \br@qodd)*(1 - \br@mi) : \br@i + \br@modi * 2)}
      \edef\br@j{\pgfmathresult}
      \colorlet{outer}{ring\br@k\br@i}
      \colorlet{inner}{ring\br@k\br@j}
      \hopfjunction{1}{\br@radius+2 * \br@mi * \br@step}{\br@modi}{\br@psi}{\br@psi}
     \end{scope}
    }
   \end{scope}
   \fillin{\br@radius}{1}{2}{\br@psi}{(1.5 + \br@qodd/2)*\br@psi}{ring\br@k\br@qtwo}
   \fillin{\br@radius}{1}{2}{\br@phi -\br@psi}{\br@phi - (1.5 + \br@qodd/2)*\br@psi}{ring\br@k\br@qmo}
  \end{scope}
 }
}
\newcommand{\chain}{%
\begin{scope}
\begin{pgfonlayer}{back}
\draw[knot,double=chain] (-1.1,0.7) -- ++(0,-1.8) -- ++(.3,0);
\draw[knot,double=chain] (1.1,0.7) -- ++(0,-1.8) -- ++(-.3,0);
\draw[knot,double=chain] (-.9,0.7) -- ++(0,-1.6) -- ++(.1,0);
\draw[knot,double=chain] (.9,0.7) -- ++(0,-1.6) -- ++(-.1,0);
\end{pgfonlayer}
\begin{pgfonlayer}{front}
\draw[knot,double=chain] (-.8,-.9) -- ++(1.6,0);
\draw[knot,double=chain] (-.8,-1.1) -- ++(1.6,0);
\end{pgfonlayer}
\draw[knot,double=chain] (-1,1) circle (.4);
\draw[background,line width=1.8mm] (-1,0.5) -- ++(0,.2);
\draw[knot,double=chain] (-1.1,0.5) -- ++(0,.1);
\draw[knot,double=chain] (-.9,0.5) -- ++(0,.1);
\draw[knot,double=chain] (1,1) circle (.4);
\draw[background,line width=1.8mm] (1,0.5) -- ++(0,.2);
\draw[knot,double=chain] (1.1,0.5) -- ++(0,.1);
\draw[knot,double=chain] (.9,0.5) -- ++(0,.1);
\end{scope}
}
\newcommand{\leftchain}{%
\begin{scope}
\begin{pgfonlayer}{back}
\draw[knot,double=chain] (-1.1,2.7) -- ++(0,-3.8) -- ++(.3,0);
\draw[knot,double=chain] (1.1,0.7) -- ++(0,-1.8) -- ++(-.3,0);
\draw[knot,double=chain] (-.9,2.7) -- ++(0,-3.6) -- ++(.1,0);
\draw[knot,double=chain] (.9,0.7) -- ++(0,-1.6) -- ++(-.1,0);
\end{pgfonlayer}
\begin{pgfonlayer}{front}
\draw[knot,double=chain] (-.8,-.9) -- ++(1.6,0);
\draw[knot,double=chain] (-.8,-1.1) -- ++(1.6,0);
\end{pgfonlayer}
\draw[knot,double=chain] (-1,3) circle (.4);
\draw[background,line width=1.8mm] (-1,2.5) -- ++(0,.2);
\draw[knot,double=chain] (-1.1,2.5) -- ++(0,.1);
\draw[knot,double=chain] (-.9,2.5) -- ++(0,.1);
\draw[knot,double=chain] (1,1) circle (.4);
\draw[background,line width=1.8mm] (1,0.5) -- ++(0,.2);
\draw[knot,double=chain] (1.1,0.5) -- ++(0,.1);
\draw[knot,double=chain] (.9,0.5) -- ++(0,.1);
\end{scope}
}
\newcommand{\rightchain}{%
\begin{scope}
\begin{pgfonlayer}{back}
\draw[knot,double=chain] (1.1,2.7) -- ++(0,-3.8) -- ++(-.3,0);
\draw[knot,double=chain] (-1.1,0.7) -- ++(0,-1.8) -- ++(.3,0);
\draw[knot,double=chain] (.9,2.7) -- ++(0,-3.6) -- ++(-.1,0);
\draw[knot,double=chain] (-.9,0.7) -- ++(0,-1.6) -- ++(.1,0);
\end{pgfonlayer}
\begin{pgfonlayer}{front}
\draw[knot,double=chain] (-.8,-.9) -- ++(1.6,0);
\draw[knot,double=chain] (-.8,-1.1) -- ++(1.6,0);
\end{pgfonlayer}
\draw[knot,double=chain] (1,3) circle (.4);
\draw[background,line width=1.8mm] (1,2.5) -- ++(0,.2);
\draw[knot,double=chain] (1.1,2.5) -- ++(0,.1);
\draw[knot,double=chain] (.9,2.5) -- ++(0,.1);
\draw[knot,double=chain] (-1,1) circle (.4);
\draw[background,line width=1.8mm] (-1,0.5) -- ++(0,.2);
\draw[knot,double=chain] (-1.1,0.5) -- ++(0,.1);
\draw[knot,double=chain] (-.9,0.5) -- ++(0,.1);
\end{scope}
}
\newcommand{\leftcornerchain}{%
\begin{scope}
\begin{pgfonlayer}{back}
\draw[knot,double=chain] (.5,3.1) -- ++(-1.6,0) -- ++(0,-4.2) -- ++(.3,0);
\draw[knot,double=chain] (1.1,0.7) -- ++(0,-1.8) -- ++(-.3,0);
\draw[knot,double=chain] (.5,2.9) -- ++(-1.4,0) -- ++(0,-3.8) -- ++(.1,0);
\draw[knot,double=chain] (.9,0.7) -- ++(0,-1.6) -- ++(-.1,0);
\end{pgfonlayer}
\begin{pgfonlayer}{front}
\draw[knot,double=chain] (-.8,-.9) -- ++(1.6,0);
\draw[knot,double=chain] (-.8,-1.1) -- ++(1.6,0);
\end{pgfonlayer}
\draw[knot,double=chain] (1,3) circle (.4);
\draw[background,line width=1.8mm] (.5,3) -- ++(.2,0);
\draw[knot,double=chain] (.5,3.1) -- ++(.1,0);
\draw[knot,double=chain] (.5,2.9) -- ++(.1,0);
\draw[knot,double=chain] (1,1) circle (.4);
\draw[background,line width=1.8mm] (1,0.5) -- ++(0,.2);
\draw[knot,double=chain] (1.1,0.5) -- ++(0,.1);
\draw[knot,double=chain] (.9,0.5) -- ++(0,.1);
\end{scope}
}
\newcommand{\rightcornerchain}{%
\begin{scope}
\begin{pgfonlayer}{back}
\draw[knot,double=chain] (-.5,3.1) -- ++(1.6,0) -- ++(0,-4.2) -- ++(-.3,0);
\draw[knot,double=chain] (-1.1,0.7) -- ++(0,-1.8) -- ++(.3,0);
\draw[knot,double=chain] (-.5,2.9) -- ++(1.4,0) -- ++(0,-3.8) -- ++(-.1,0);
\draw[knot,double=chain] (-.9,0.7) -- ++(0,-1.6) -- ++(.1,0);
\end{pgfonlayer}
\begin{pgfonlayer}{front}
\draw[knot,double=chain] (-.8,-.9) -- ++(1.6,0);
\draw[knot,double=chain] (-.8,-1.1) -- ++(1.6,0);
\end{pgfonlayer}
\draw[knot,double=chain] (-1,3) circle (.4);
\draw[background,line width=1.8mm] (-.5,3) -- ++(-.2,0);
\draw[knot,double=chain] (-.5,3.1) -- ++(-.1,0);
\draw[knot,double=chain] (-.5,2.9) -- ++(-.1,0);
\draw[knot,double=chain] (-1,1) circle (.4);
\draw[background,line width=1.8mm] (-1,0.5) -- ++(0,.2);
\draw[knot,double=chain] (-1.1,0.5) -- ++(0,.1);
\draw[knot,double=chain] (-.9,0.5) -- ++(0,.1);
\end{scope}
}
\newcommand{\brunnianhopf}[3]{%
 \edef\br@p{#3}
 \edef\br@q{#2}
 \pgfmathsetmacro{\br@radius}{#1}
 \pgfmathparse{int(mod(\br@q,2))}
    \edef\br@qodd{\pgfmathresult}
 \pgfmathparse{int(\br@q - 1 + \br@qodd)}
 \edef\br@qmo{\pgfmathresult}
 \pgfmathparse{int(\br@q == 1 ? 1 : 2)}
 \edef\br@qtwo{\pgfmathresult}
 \pgfmathsetmacro{\br@phi}{360/\br@p}
 \pgfmathsetmacro{\br@psi}{180/(\br@p * (ceil(\br@q/2)+1))}
 \foreach \br@k in {1,...,\br@p} {
  \pgfmathparse{int(\br@k == 1 ? \br@p : \br@k - 1)}
  \edef\br@m{\pgfmathresult}
  \begin{scope}[rotate=\br@m * \br@phi]
   \colorlet{outer}{ring\br@k\br@qtwo}
   \colorlet{outer3}{ring\br@k\br@qmo}
   \colorlet{inner}{ring\br@m\br@qmo}
   \junction{1.5}{\br@radius}{-1}{\br@psi}{\br@psi}
   \begin{scope}[rotate=\br@phi/2]
    \foreach \br@i in {1,...,\br@q} {
     \pgfmathsetmacro{\br@rho}{(\br@i - (1 - mod(\br@i,2))*(1 - \br@qodd) - ceil(\br@q/2)) * \br@psi}
     \begin{scope}[rotate=\br@rho]
      \pgfmathsetmacro{\br@mi}{mod(\br@i,2)}
      \pgfmathsetmacro{\br@modi}{(-1)^\br@mi}
      \pgfmathparse{int(\br@i == 1 || \br@i == \br@q - \br@qodd ? \br@i + \br@qtwo - 1 - 2*(1 - \br@qodd)*(1 - \br@mi) : \br@i + \br@modi * 2)}
      \edef\br@j{\pgfmathresult}
      \colorlet{outer}{ring\br@k\br@i}
      \colorlet{inner}{ring\br@k\br@j}
      \hopfjunction{1}{\br@radius+6 * \br@mi * \br@step}{\br@modi}{\br@psi}{\br@psi}
     \end{scope}
    }
   \end{scope}
\ifx\br@qodd\br@one
   \fillin{\br@radius}{1}{2}{\br@psi}{(1.5 + \br@qodd/2)*\br@psi}{ring\br@k\br@qtwo}
   \fillin{\br@radius}{1}{2}{\br@phi -\br@psi}{\br@phi - (1.5 + \br@qodd/2)*\br@psi}{ring\br@k\br@qmo}
\fi
   \fillin{\br@radius}{3}{6}{\br@psi}{\br@phi - \br@psi}{ring\br@k\br@qmo}
  \end{scope}
 }
}
\newcommand{\hopfbrunnian}[3]{%
 \edef\br@p{#3}
 \edef\br@q{#2}
 \pgfmathsetmacro{\br@radius}{#1}
 \pgfmathparse{int(mod(\br@q,2))}
    \edef\br@qodd{\pgfmathresult}
 \pgfmathparse{int(\br@q - 1 + \br@qodd)}
 \edef\br@qmo{\pgfmathresult}
 \pgfmathparse{int(\br@q == 1 ? 1 : 2)}
 \edef\br@qtwo{\pgfmathresult}
 \pgfmathsetmacro{\br@phi}{360/\br@p}
 \pgfmathsetmacro{\br@psi}{180/(\br@p * (ceil(\br@q/2)+1))}
 \foreach \br@k in {1,...,\br@p} {
  \pgfmathparse{int(\br@k == 1 ? \br@p : \br@k - 1)}
  \edef\br@m{\pgfmathresult}
  \begin{scope}[rotate=\br@m * \br@phi]
   \colorlet{outer}{ring\br@k\br@qtwo}
   \colorlet{inner}{ring\br@m\br@qmo}
   \hopfjunction{3}{\br@radius}{-1}{\br@psi}{\br@psi}
   \begin{scope}[rotate=\br@phi/2]
    \foreach \br@i in {1,...,\br@q} {
     \pgfmathsetmacro{\br@rho}{(\br@i - (1 - mod(\br@i,2))*(1 - \br@qodd) - ceil(\br@q/2)) * \br@psi}
     \begin{scope}[rotate=\br@rho]
      \pgfmathsetmacro{\br@mi}{mod(\br@i,2)}
      \pgfmathsetmacro{\br@modi}{(-1)^\br@mi}
      \pgfmathparse{int(\br@i == 1 || \br@i == \br@q - \br@qodd ? \br@i + \br@qtwo - 1 - 2*(1 - \br@qodd)*(1 - \br@mi) : \br@i + \br@modi * 2)}
      \edef\br@j{\pgfmathresult}
      \colorlet{outer}{ring\br@k\br@i}
      \colorlet{inner}{ring\br@k\br@j}
      \junction{1}{\br@radius+4 * \br@mi * \br@step}{\br@modi}{\br@psi}{\br@psi}
     \end{scope}
    }
   \end{scope}
\ifx\br@qodd\br@one
   \fillin{\br@radius}{1}{4}{\br@psi}{(1.5 + \br@qodd/2)*\br@psi}{ring\br@k\br@qtwo}
   \fillin{\br@radius}{1}{4}{\br@phi -\br@psi}{\br@phi - (1.5 + \br@qodd/2)*\br@psi}{ring\br@k\br@qmo}
\fi
  \end{scope}
 }
}
\newcommand{\outerhopftwo}[3]{%
 \edef\br@p{#3}
 \edef\br@q{#2}
 \pgfmathsetmacro{\br@radius}{#1}
 \pgfmathsetmacro{\br@qodd}{mod(\br@q,2)}
 \pgfmathparse{int(\br@q - 1 + \br@qodd)}
 \edef\br@qmo{\pgfmathresult}
 \pgfmathparse{int(\br@q == 1 ? 1 : 2)}
 \edef\br@qtwo{\pgfmathresult}
 \pgfmathsetmacro{\br@phi}{360/\br@p}
 \pgfmathsetmacro{\br@psi}{180/(\br@p * (\br@q+1))}
 \foreach \br@k in {1,...,\br@p} {
  \pgfmathparse{int(\br@k == 1 ? \br@p : \br@k - 1)}
  \edef\br@m{\pgfmathresult}
  \begin{scope}[rotate=\br@m * \br@phi]
   \colorlet{outer}{ring\br@k\br@qtwo}
   \colorlet{outer5}{ring\br@k\br@qmo}
   \colorlet{inner}{ring\br@m\br@qtwo}
   \hopfjunction{2}{\br@radius}{-1}{\br@psi}{\br@psi}
   \begin{scope}[rotate=\br@phi/2]
    \foreach \br@i in {1,...,\br@q} {
     \pgfmathsetmacro{\br@rho}{2*(\br@i -  (\br@q+1)/2 ) * \br@psi}
     \begin{scope}[rotate=\br@rho]
      \pgfmathsetmacro{\br@mi}{mod(\br@i,2)}
      \pgfmathsetmacro{\br@modi}{(-1)^\br@mi}
      \pgfmathparse{int(\br@i == 1 || \br@i == \br@q - \br@qodd ? \br@i + \br@qtwo - 1 - 2*(1 - \br@qodd)*(1 - \br@mi) : \br@i + \br@modi * 2)}
      \edef\br@j{\pgfmathresult}
      \colorlet{outer}{ring\br@k\br@i}
      \colorlet{inner}{ring\br@k\br@j}
      \hopfjunction{1}{\br@radius+2 * \br@step}{-1}{\br@psi}{\br@psi}
     \end{scope}
    }
   \end{scope}
   \fillin{\br@radius}{1}{2}{\br@psi}{180 - \br@psi}{ring\br@k\br@qtwo}
  \end{scope}
 }
}
\newcommand{\outerbrunniantwo}[3]{%
 \edef\br@p{#3}
 \edef\br@q{#2}
 \pgfmathsetmacro{\br@radius}{#1}
 \pgfmathsetmacro{\br@qodd}{mod(\br@q,2)}
 \pgfmathparse{int(\br@q - 1 + \br@qodd)}
 \edef\br@qmo{\pgfmathresult}
 \pgfmathparse{int(\br@q == 1 ? 1 : 2)}
 \edef\br@qtwo{\pgfmathresult}
 \pgfmathsetmacro{\br@phi}{360/\br@p}
 \pgfmathsetmacro{\br@psi}{180/(\br@p * (\br@q+1))}
 \foreach \br@k in {1,...,\br@p} {
  \pgfmathparse{int(\br@k == 1 ? \br@p : \br@k - 1)}
  \edef\br@m{\pgfmathresult}
  \begin{scope}[rotate=\br@m * \br@phi]
   \colorlet{outer}{ring\br@k\br@qtwo}
   \colorlet{inner}{ring\br@m\br@qtwo}
   \junction{2}{\br@radius}{-1}{\br@psi}{\br@psi}
   \begin{scope}[rotate=\br@phi/2]
    \foreach \br@i in {1,...,\br@q} {
     \pgfmathsetmacro{\br@rho}{2*(\br@i -  (\br@q+1)/2 ) * \br@psi}
     \begin{scope}[rotate=\br@rho]
      \pgfmathsetmacro{\br@mi}{mod(\br@i,2)}
      \pgfmathsetmacro{\br@modi}{(-1)^\br@mi}
      \pgfmathparse{int(\br@i == 1 || \br@i == \br@q - \br@qodd ? \br@i + \br@qtwo - 1 - 2*(1 - \br@qodd)*(1 - \br@mi) : \br@i + \br@modi * 2)}
      \edef\br@j{\pgfmathresult}
      \colorlet{outer}{ring\br@k\br@i}
      \colorlet{inner}{ring\br@k\br@j}
      \junction{1}{\br@radius+12 * \br@step}{-1}{\br@psi}{\br@psi}
     \end{scope}
    }
   \end{scope}
   \fillin{\br@radius}{1}{12}{\br@psi}{180 - \br@psi}{ring\br@k\br@qtwo}
  \end{scope}
 }
}
\def\pgf@sh@@knotanchor#1#2{%
  \anchor{#2 north west}{%
    \csname pgf@anchor@knot #1@north west\endcsname%
    \pgf@x=#2\pgf@x%
    \pgf@y=#2\pgf@y%
  }%
  \anchor{#2 north east}{%
    \csname pgf@anchor@knot #1@north east\endcsname%
    \pgf@x=#2\pgf@x%
    \pgf@y=#2\pgf@y%
  }%
  \anchor{#2 south west}{%
    \csname pgf@anchor@knot #1@south west\endcsname%
    \pgf@x=#2\pgf@x%
    \pgf@y=#2\pgf@y%
  }%
  \anchor{#2 south east}{%
    \csname pgf@anchor@knot #1@south east\endcsname%
    \pgf@x=#2\pgf@x%
    \pgf@y=#2\pgf@y%
  }%
  \anchor{#2 north}{%
    \csname pgf@anchor@knot #1@north\endcsname%
    \pgf@x=#2\pgf@x%
    \pgf@y=#2\pgf@y%
  }%
  \anchor{#2 east}{%
    \csname pgf@anchor@knot #1@east\endcsname%
    \pgf@x=#2\pgf@x%
    \pgf@y=#2\pgf@y%
  }%
  \anchor{#2 west}{%
    \csname pgf@anchor@knot #1@west\endcsname%
    \pgf@x=#2\pgf@x%
    \pgf@y=#2\pgf@y%
  }%
  \anchor{#2 south}{%
    \csname pgf@anchor@knot #1@south\endcsname%
    \pgf@x=#2\pgf@x%
    \pgf@y=#2\pgf@y%
  }%
}
\pgfdeclareshape{knot crossing}
{
  \inheritsavedanchors[from=circle] % this is nearly a circle
  \inheritanchorborder[from=circle]
  \inheritanchor[from=circle]{north}
  \inheritanchor[from=circle]{north west}
  \inheritanchor[from=circle]{north east}
  \inheritanchor[from=circle]{center}
  \inheritanchor[from=circle]{west}
  \inheritanchor[from=circle]{east}
  \inheritanchor[from=circle]{mid}
  \inheritanchor[from=circle]{mid west}
  \inheritanchor[from=circle]{mid east}
  \inheritanchor[from=circle]{base}
  \inheritanchor[from=circle]{base west}
  \inheritanchor[from=circle]{base east}
  \inheritanchor[from=circle]{south}
  \inheritanchor[from=circle]{south west}
  \inheritanchor[from=circle]{south east}
  \inheritanchorborder[from=circle]
  \pgf@sh@@knotanchor{crossing}{2}
  \pgf@sh@@knotanchor{crossing}{3}
  \pgf@sh@@knotanchor{crossing}{4}
  \pgf@sh@@knotanchor{crossing}{8}
  \pgf@sh@@knotanchor{crossing}{16}
  \pgf@sh@@knotanchor{crossing}{32}
  \backgroundpath{
    \pgfutil@tempdima=\radius%
    \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
    \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
    \ifdim\pgf@xb<\pgf@yb%
      \advance\pgfutil@tempdima by-\pgf@yb%
    \else%
      \advance\pgfutil@tempdima by-\pgf@xb%
    \fi%
  }
}
\pgfdeclareshape{knot over cross}
{
  \inheritsavedanchors[from=rectangle] % this is nearly a circle
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north west}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{east}
  \inheritanchor[from=rectangle]{mid}
  \inheritanchor[from=rectangle]{mid west}
  \inheritanchor[from=rectangle]{mid east}
  \inheritanchor[from=rectangle]{base}
  \inheritanchor[from=rectangle]{base west}
  \inheritanchor[from=rectangle]{base east}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{south east}
  \inheritanchorborder[from=rectangle]
  \backgroundpath{
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
  }
  \foregroundpath{
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
 }
}
\pgfdeclareshape{knot under cross}
{
  \inheritsavedanchors[from=rectangle] % this is nearly a circle
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north west}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{east}
  \inheritanchor[from=rectangle]{mid}
  \inheritanchor[from=rectangle]{mid west}
  \inheritanchor[from=rectangle]{mid east}
  \inheritanchor[from=rectangle]{base}
  \inheritanchor[from=rectangle]{base west}
  \inheritanchor[from=rectangle]{base east}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{south east}
  \inheritanchorborder[from=rectangle]
  \backgroundpath{
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
  }
  \foregroundpath{
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
 }
}
\pgfdeclareshape{knot vert}
{
  \inheritsavedanchors[from=rectangle] % this is nearly a circle
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north west}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{east}
  \inheritanchor[from=rectangle]{mid}
  \inheritanchor[from=rectangle]{mid west}
  \inheritanchor[from=rectangle]{mid east}
  \inheritanchor[from=rectangle]{base}
  \inheritanchor[from=rectangle]{base west}
  \inheritanchor[from=rectangle]{base east}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{south east}
  \inheritanchorborder[from=rectangle]
  \backgroundpath{
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
 }
}
\pgfdeclareshape{knot horiz}
{
  \inheritsavedanchors[from=rectangle] % this is nearly a circle
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north west}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{east}
  \inheritanchor[from=rectangle]{mid}
  \inheritanchor[from=rectangle]{mid west}
  \inheritanchor[from=rectangle]{mid east}
  \inheritanchor[from=rectangle]{base}
  \inheritanchor[from=rectangle]{base west}
  \inheritanchor[from=rectangle]{base east}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{south east}
  \inheritanchorborder[from=rectangle]
  \foregroundpath{
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
 }
}
\newcommand{\flatbrunnianlink}[1]{%
\pgfmathsetmacro{\br@scale}{#1}%
\pgfmathsetmacro{\br@ctwenty}{cos(20)}
\pgfmathsetmacro{\br@stwenty}{sin(20)}
\draw[knot,double=chain] (-.5*\br@scale,0) arc(180:270:.5*\br@scale) node[coordinate] (a) {};
\draw[knot,double=chain] (-.6*\br@scale,0) arc(180:270:.6*\br@scale) node[coordinate] (c) {};
\begin{pgfonlayer}{front}
\draw[knot,double=chain] (1.6*\br@scale,0) ++(-.9*\br@scale *\br@ctwenty,-.9*\br@scale *\br@stwenty) arc(0:-90:.2*\br@scale) to[out=180,in=0] (c);
\end{pgfonlayer}
\begin{pgfonlayer}{back}
\draw[knot,double=chain] (-.5*\br@scale,0) arc(180:90:.5*\br@scale) node[coordinate] (b) {};
\draw[knot,double=chain] (-.6*\br@scale,0) arc(180:90:.6*\br@scale) node[coordinate] (d) {};
\draw[knot,double=chain] (1.6*\br@scale,0) ++(-.9*\br@scale *\br@ctwenty,-.9*\br@scale *\br@stwenty) arc(0:135:.2*\br@scale) to[out=-135,in=0] (a);
\draw[knot,double=chain] (1.6*\br@scale,0) ++(-.9*\br@scale *\br@ctwenty,.9*\br@scale *\br@stwenty) arc(0:-135:.2*\br@scale) to[out=135,in=0] (b);
\end{pgfonlayer}
\begin{pgfonlayer}{front}
\draw[knot,double=chain] (1.6*\br@scale,0) ++(-.9*\br@scale *\br@ctwenty,.9*\br@scale *\br@stwenty) arc(0:90:.2*\br@scale) to[out=180,in=0] (d);
\end{pgfonlayer}
}
\newcommand{\brunnianlink}[2]{%
\pgfmathsetmacro{\br@scale}{#1}
\pgfmathsetmacro{\br@angle}{#2}
\begin{scope}[every path/.style={knot,double=chain}]
\begin{scope}[rotate=-\br@angle + 5]
\draw (0,-\br@scale) arc (90:270:2.5*\br@step);
\draw (0,-\br@scale-\br@step) arc (90:270:1.5*\br@step);
\draw (0,-\br@scale) arc (-90:-85:\br@scale) coordinate (a);
\draw (0,-\br@scale-\br@step) arc (-90:-85:\br@scale+\br@step) coordinate (b);
\draw (0,-\br@scale-4*\br@step) arc (-90:-85:\br@scale+3*\br@step) coordinate (c);
\draw (0,-\br@scale-5*\br@step) arc (-90:-85:\br@scale+4*\br@step) coordinate (d);
\end{scope}
\begin{pgfonlayer}{back}
\draw (0,-\br@scale-2*\br@step) arc(-90:-100:\br@scale+2*\br@step) coordinate (B);
\draw (0,-\br@scale-3*\br@step) arc(-90:-100:\br@scale+3*\br@step) coordinate (C);
\end{pgfonlayer}
\begin{pgfonlayer}{front}
\draw (0,-\br@scale) arc (90:-90:\br@step);
\draw (0,-\br@scale) arc (-90:-100:\br@scale) coordinate (A);
\draw (0,-\br@scale-3*\br@step) arc (90:-90:\br@step);
\draw (0,-\br@scale-5*\br@step) arc (-90:-100:\br@scale+5*\br@step)coordinate (D);
\end{pgfonlayer}
\pgfmathsetmacro{\br@loose}{\br@angle == 180 ? 1.5 : 1}
\draw (a) to[out=-\br@angle+10,in=170,looseness=\br@loose] (A);
\draw (b) to[out=-\br@angle+10,in=170,looseness=\br@loose] (B);
\draw (c) to[out=-\br@angle+10,in=170,looseness=\br@loose] (C);
\draw (d) to[out=-\br@angle+10,in=170,looseness=\br@loose] (D);
\end{scope}
}
\newcommand{\brunniantwocpt}[4]{%
 \edef\br@p{#3}
 \edef\br@q{#2}
  \edef\br@colour{#4}
 \pgfmathsetmacro{\br@radius}{#1}
 \pgfmathparse{int(mod(\br@q,2))}
    \edef\br@qodd{\pgfmathresult}
 \pgfmathparse{int(\br@q - 1 + \br@qodd)}
 \edef\br@qmo{\pgfmathresult}
 \pgfmathparse{int(\br@q == 1 ? 1 : 2)}
 \edef\br@qtwo{\pgfmathresult}
 \pgfmathsetmacro{\br@phi}{360/\br@p}
 \pgfmathsetmacro{\br@psi}{180/(\br@p * (ceil(\br@q/2)+1))}
  \begin{scope}%[rotate=\br@m * \br@phi]
   \colorlet{outer}{\br@colour\br@qtwo}
   \colorlet{outer5}{\br@colour\br@qmo}
   \colorlet{inner}{background}
   \junction{2}{\br@radius}{-1}{\br@psi}{\br@psi}
  \begin{scope}[rotate=\br@phi]
   \colorlet{outer}{background}
   \colorlet{outer5}{background}
   \colorlet{inner}{\br@colour\br@qmo}
   \junction{2}{\br@radius}{-1}{\br@psi}{\br@psi}
  \end{scope}
   \begin{scope}[rotate=\br@phi/2]
    \foreach \br@i in {1,...,\br@q} {
     \pgfmathsetmacro{\br@rho}{(\br@i - (1 - mod(\br@i,2))*(1 - \br@qodd) - ceil(\br@q/2)) * \br@psi}
     \begin{scope}[rotate=\br@rho]
      \pgfmathsetmacro{\br@mi}{mod(\br@i,2)}
      \pgfmathsetmacro{\br@modi}{(-1)^\br@mi}
      \pgfmathparse{int(\br@i == 1 || \br@i == \br@q - \br@qodd ? \br@i + \br@qtwo - 1 - 2*(1 - \br@qodd)*(1 - \br@mi) : \br@i + \br@modi * 2)}
      \edef\br@j{\pgfmathresult}
      \colorlet{outer}{\br@colour\br@i}
      \colorlet{inner}{\br@colour\br@j}
      \junction{1}{\br@radius+12 * \br@mi * \br@step}{\br@modi}{\br@psi}{\br@psi}
     \end{scope}
    }
   \end{scope}
\ifx\br@qodd\br@one
   \fillin{\br@radius}{1}{4}{\br@psi}{(1.5 + \br@qodd/2)*\br@psi}{\br@colour\br@qtwo}
   \fillin{\br@radius}{1}{4}{\br@phi -\br@psi}{\br@phi - (1.5 + \br@qodd/2)*\br@psi}{\br@colour\br@qmo}
\fi
   \fillin{\br@radius}{5}{12}{\br@psi}{\br@phi - \br@psi}{\br@colour\br@qmo}
  \end{scope}
 }
\newcommand{\brunniancpt}[3][1]{%
\pgfmathsetmacro{\br@n}{#3}
\pgfmathsetmacro{\br@phi}{360/\br@n}
\pgfmathsetmacro{\br@psi}{180/\br@n}
  \colorlet{outer}{brunnian}
  \colorlet{inner}{background}
  \junction{#1}{#2}{1}{\br@psi}{\br@psi}
\begin{scope}[rotate=-\br@phi]
  \colorlet{inner}{brunnian}
  \colorlet{outer}{background}
  \junction{#1}{#2}{1}{\br@psi}{\br@psi}
\end{scope}
}
\newcommand{\brunniancptouter}[3][1]{%
\pgfmathsetmacro{\br@n}{#3}
\pgfmathsetmacro{\br@phi}{360/\br@n}
\pgfmathsetmacro{\br@psi}{180/\br@n}
  \colorlet{outer}{brunnian}
  \colorlet{inner}{background}
  \junction{#1}{#2}{-1}{\br@psi}{\br@psi}
\begin{scope}[rotate=\br@phi]
  \colorlet{inner}{brunnian}
  \colorlet{outer}{background}
  \junction{#1}{#2}{-1}{\br@psi}{\br@psi}
\end{scope}
}
\newcommand{\brunnianlinkage}{%
\node (0) at (0,-\brlen) {};
\foreach \bri/\brdir/\brnud/\brv in {
  1/1/1/-1,
  2/-1/2/-1,
  3/-1/1/-1,
  4/1/1/1,
  5/1/1/-1,
  6/-1/1/1,
  7/-1/2/1,
  8/1/1/1
} {
  \coordinate (\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0);
}
\draw (1) -- (4);
\draw (2) -- (7);
\draw (3) -- (6);
\draw (5) -- (8);
}
\newcommand{\brunniantwoside}{%
\foreach \bri/\brdir/\brnud/\brv in {
  1/1/1/-1,
  2/-1/2/-1,
  3/-1/1/-1,
  4/1/1/1,
  5/1/1/-1,
  6/-1/1/1,
  7/-1/2/1,
  8/1/1/1
} {
  \coordinate (l\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (l\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0) coordinate (le\bri);
}
\draw (l1) -- (l4);
\draw (l2) -- (l7);
\draw (l3) -- (l6);
\draw (l5) -- (l8);
\begin{scope}[xshift=4cm]
\foreach \bri/\brdir/\brnud/\brv in {
  1/1/1/-1,
  2/-1/2/-1,
  3/-1/1/-1,
  4/1/1/1,
  5/1/1/-1,
  6/-1/1/1,
  7/-1/2/1,
  8/1/1/1
} {
  \coordinate (r\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (r\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0) coordinate (re\bri);
}
\draw (r1) -- (r4);
\draw (r2) -- (r7);
\draw (r3) -- (r6);
\draw (r5) -- (r8);
\end{scope}
\draw
 (le2) -- ++(\brsep,0) coordinate (1)
 (le7) -- ++(\brsep,0) coordinate (4)
 (re1) -- ++(-\brsep,0) coordinate (5)
 (re8) -- ++(-\brsep,0) coordinate (8)
;
\path
coordinate (2) at (le3)
coordinate (3) at (le6)
coordinate (6) at (re4)
coordinate (7) at (re5)
coordinate (lb) at ($(4)!.5!(8)+(0,-1)$)
;
}
\newcommand{\dblhopftwoside}{%
\foreach \bri/\brdir/\brnud/\brv in {
  1/-1/2/-1,
  2/-1/1/-1,
  3/1/2/-1,
  4/1/1/-1,
  5/-1/1/1,
  6/-1/2/1,
  7/1/1/1,
  8/1/2/1
} {
  \coordinate (l\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (l\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0) coordinate (le\bri);
}
\draw (l1) -- (l6);
\draw (l2) -- (l5);
\draw (l3) -- (l8);
\draw (l4) -- (l7);
\begin{scope}[xshift=4cm]
\foreach \bri/\brdir/\brnud/\brv in {
  1/-1/2/-1,
  2/-1/1/-1,
  3/1/2/-1,
  4/1/1/-1,
  5/-1/1/1,
  6/-1/2/1,
  7/1/1/1,
  8/1/2/1
} {
  \coordinate (r\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (r\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0) coordinate (re\bri);
}
\draw (r1) -- (r6);
\draw (r2) -- (r5);
\draw (r3) -- (r8);
\draw (r4) -- (r7);
\end{scope}
\draw
 (le1) -- ++(\brsep,0) coordinate (1)
 (le6) -- ++(\brsep,0) coordinate (4)
 (re3) -- ++(-\brsep,0) coordinate (5)
 (re8) -- ++(-\brsep,0) coordinate (8)
;
\path
coordinate (2) at (le2)
coordinate (3) at (le5)
coordinate (6) at (re4)
coordinate (7) at (re7)
coordinate (lb) at ($(4)!.5!(8)+(0,-1)$)
;
}
\newcommand{\dblhopfrctwoside}{%
\foreach \bri/\brdir/\brnud/\brv in {
  1/-1/2/-1,
  2/-1/1/-1,
  3/1/2/-1,
  4/1/1/-1,
  5/-1/1/1,
  6/-1/2/1,
  7/1/1/1,
  8/1/2/1
} {
  \coordinate (l\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (l\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0) coordinate (le\bri);
}
\draw (l1) -- (l6);
\draw (l2) -- (l5);
\draw (l3) -- (l8);
\draw (l4) -- (l7);
\begin{scope}[xshift=4cm]
\foreach \bri/\brdir/\brnud/\brv in {
  1/-1/2/-1,
  2/-1/1/-1,
  3/1/2/-1,
  4/1/1/-1,
  5/-1/1/1,
  6/-1/2/1,
  7/1/1/1,
  8/1/2/1
} {
  \coordinate (r\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (r\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0) coordinate (re\bri);
}
\draw (r1) -- (r6);
\draw (r2) -- (r5);
\draw (r3) -- (r8);
\draw (r4) -- (r7);
\end{scope}
\draw
 (le1) -- ++(\brsep,0) coordinate (1)
 (le6) -- ++(\brsep,0) coordinate (4)
 (re3) -- ++(-\brsep,0) coordinate (5)
 (re8) -- ++(-\brsep,0) coordinate (8)
;
\path
coordinate (2) at (le2)
coordinate (3) at (le5)
coordinate (6) at (re4)
coordinate (7) at (re7)
coordinate (lb) at ($(4)!.5!(8)+(0,-1)$)
;
\draw[double=none,Red,line width=2pt] (2) -- (3);
}
\newcommand{\brunnianhalftwoside}{%
\foreach \bri/\brdir/\brnud/\brv in {
  1/1/1/-1,
  2/-1/2/-1,
  3/-1/1/-1,
  4/1/1/1,
  5/1/1/-1,
  6/-1/1/1,
  7/-1/2/1,
  8/1/1/1
} {
  \coordinate (l\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (l\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0) coordinate (le\bri);
}
\draw (l1) -- (l4);
\draw (l2) -- (l7);
\draw (l3) -- (l6);
\draw (l5) -- (l8);
\begin{scope}[xshift=4cm]
\foreach \bri/\brdir/\brnud/\brv in {
  1/1/1/-1,
  2/-1/2/-1,
  3/-1/1/-1,
  4/1/1/1,
  5/1/1/-1,
  6/-1/1/1,
  7/-1/2/1,
  8/1/1/1
} {
  \coordinate (r\bri) at (\brover * \brdir * \brnud,-\bri * \brsep + \brv * \bradj);
  \draw (r\bri) -- ++(0,-\brv * \bradj) -- +(-\brdir * \brlen - \brover * \brdir * \brnud,0) coordinate (re\bri);
}
\draw (r1) -- (r4);
\draw (r2) -- (r7);
\draw (r3) -- (r6);
\draw (r5) -- (r8);
\end{scope}
\draw
 (le2) -- ++(\brsep,0) coordinate (1)
 (le7) -- ++(\brsep,0) coordinate (4)
 (re1) -- ++(-\brsep,0) coordinate (5)
 (re8) coordinate (6)
;
\path
coordinate (2) at (le3)
coordinate (3) at (le6)
coordinate (8) at (re4)
coordinate (7) at (re5)
coordinate (lb) at ($(4)!.5!(8)+(0,-1)$)
;
\draw[double=none,Red,line width=2pt] (6) -- (7);
}
\newcommand{\brunnianringonetwoside}{
\fill[gray] (-\brlen,-.5*\brsep) rectangle (\brlen, .5*\brsep);
\draw[double=none,Red,line width=2pt]
 (-\brlen,-.5*\brsep)
 ++(-\brsep,-\brsep) coordinate (1)
 ++(-\brsep,-\brsep) coordinate (2)
 ++(-\brsep,-\brsep) coordinate (c3) -- +(\brsep,0) coordinate (3)
 ++(-\brsep,-\brsep) coordinate (c4) -- +(4*\brsep,0) coordinate (4)
 (\brlen,-.5*\brsep)
 ++(\brsep,-\brsep) coordinate (5)
 ++(\brsep,-\brsep) coordinate (6)
 ++(\brsep,-\brsep) coordinate (c7) -- +(-\brsep,0) coordinate (7)
 ++(\brsep,-\brsep) coordinate (c8) -- +(-4*\brsep,0) coordinate (8)
;
\draw[double=none,Red,line width=2pt]
 (1) -- ++(0,3*\brsep) -| (5)
 (2) -- ++(0,5*\brsep) -| (6)
 (c3) -- ++(0,7*\brsep) -| (c7)
 (c4) -- ++(0,9*\brsep) -| (c8)
;
}
%% 
%% 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 file  brunnian.dtx
%% and the derived files           brunnian.ins,
%%                                 brunnain.pdf, and
%%                                 brunnian.sty.
%% 
%%
%% End of file `brunnian.sty'.
