# Drawing the rules for the bracket polynomial

I am trying to re-create the three rules for the bracket polynomial:

This is what I have tried so far:

\documentclass[executivepaper]{article}

\usepackage{mathtools}

\everymath{\displaystyle}

\usepackage{amssymb}

\usepackage{amsfonts}

\usepackage{commath}

\usepackage{kantlipsum,graphicx}

\usepackage{amsmath}

\usepackage[utf8]{inputenc}

\usepackage{sectsty}

\usepackage{tcolorbox}

\usepackage{geometry}

\usepackage{tikz}

\usetikzlibrary{shapes,snakes}

\usepackage{float}

\setlength\parindent{3pt} % Removes all indentation from paragraphs - comment this line for an assignment with lots of text

\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height

\newtheorem{definition}{Definition}

\newtheorem{theorem}{Theorem}

\newtheorem{corollary}{Corollary}[theorem]

\begin{document}

\begin{tcolorbox}

\textbf{Rules for the Bracket Polynominal} \textit{The Kauffman \textbf{Bracket Polynominal} of a regular projection of a link is a polynominal in integer powers of the variable A defined by the following three rules:}

\begin{center}

\begin{enumerate}

%the first rule
\item $\bigg \langle \begin{tikzpicture} \filldraw[color=gray, fill=none, thick] circle (0.3); \end{tikzpicture} \bigg \rangle=1$

%the second rule
\item $\bigg \langle L \cup \begin{tikzpicture} \filldraw[color=gray, fill=none, thick] circle (0.3); \end{tikzpicture} \bigg \rangle=(-A^{2}-A^{-2}) \big \langle L \big \rangle$

%the third rule
\item $\bigg \langle \begin{tikzpicture} \draw (-1,0) -- (90:0.1cm); \end{tikzpicture} \bigg \rangle=A\bigg \langle \begin{tikzpicture} \draw (-0.4,0.4) .. controls (0,0) .. (0.4,0.4); \draw (-0.4,-0.4) .. controls (0,0) .. (0.4,-0.4); \end{tikzpicture} \bigg \rangle + A^{-1} \bigg \langle \begin{tikzpicture} \path[thick,draw] (1,1) node[right]{} .. controls (-0.25,0) .. (1,-1); \path[thick,draw] (-1,1)node[right]{} .. controls (0.25,0) .. (-1,-1); \end{tikzpicture} \bigg \rangle$

\end{enumerate}

\end{center}

\end{tcolorbox}

\end{document}


I have the first and second rules mostly complete, I just can't seem to figure out how to shift the circle down so that it fits between the angle brackets. And, for the third rule, I am having trouble drawing the crossing lines as well as making sure that the other two pair of lines are the right size and aligned correctly within the brackets. Any help would be greatly appreciated!

• Welcome to TeX.SX! – egreg Apr 23 '16 at 23:06

You should define macros for the pictures; here's a possibility.

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes}

\newcommand{\KP}[1]{%
\begin{tikzpicture}[baseline=-\dimexpr\fontdimen22\textfont2\relax]
#1
\end{tikzpicture}%
}
\newcommand{\KPA}{%
\KP{\filldraw[color=gray, fill=none, thick] circle (0.3);}%
}
\newcommand{\KPB}{%
\KP{
\draw[color=gray,thick] (-0.3,0.3) -- (0.3,-0.3);
\draw[color=gray,thick] (-0.3,-0.3) -- (-0.05,-0.05);
\draw[color=gray,thick] (0.05,0.05) -- (0.3,0.3);
}%
}
\newcommand{\KPC}{%
\KP{%
\draw[color=gray,thick] (-0.3,0.3) .. controls (0,-0.05) .. (0.3,0.3);
\draw[color=gray,thick] (-0.3,-0.3) .. controls (0,0.05) .. (0.3,-0.3);
}%
}
\newcommand{\KPD}{%
\KP{%
\draw[color=gray,thick] (-0.3,-0.3) .. controls (0.05,0) .. (-0.3,0.3);
\draw[color=gray,thick] (0.3,-0.3) .. controls (-0.05,0) .. (0.3,0.3);
}%
}

\begin{document}

\begin{enumerate}
%the first rule
\item
$\left\langle\KPA\right\rangle=1$

%the second rule
\item
$\left\langle L \cup \KPA\right\rangle=(-A^{2}-A^{-2})\langle L\rangle$

%the third rule
\item
$\left\langle\KPB\right\rangle= A\left\langle\KPC\right\rangle + A^{-1} \left\langle \KPD \right\rangle$

\end{enumerate}

\end{document}


Some notes.

1. Never issue \everymath{\displaystyle}. Ever.

2. The commath package provides scores of buggy commands. Avoid it.

• Thank you very much! It's exactly what I was looking for.! – busebd12 Apr 23 '16 at 23:11
• Why is \dimexpr necessary here? (If it is not too much a long story.) Minor remark: the loaded tikz libraries seem unrelated to the answer. – GuM Apr 24 '16 at 0:44
• @GustavoMezzetti Did you try without? ;-) It has to do with how PGF parses options; also \the instead of \dimexpr works (removing \relax, of course). I didn't dare removing any library, not knowing in the least what they do. ;-) – egreg Apr 24 '16 at 9:43
• Yes, I had tried without: that’s precisely the reason for which I asked. (:-) Btw, \dimexpr does not work with the version of tikz included in TeX Live 2013, but \the does. Perhaps, to stay safe, the best thing of all is to use a temporary \dimen register, something like: \newcommand{\KP}[1]{\@KP@axis@height \fontdimen 22 \textfont\tw@ \relax \begin{tikzpicture}[baseline=-\@KP@axis@height].... – GuM Apr 24 '16 at 11:17
• @GustavoMezzetti \dimexpr is perfectly equivalent: it's essentially implemented as an unnamed dimension register. – egreg Apr 24 '16 at 12:12

Here's how I did it:

\documentclass{article}
\usepackage{amssymb}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{knots}
\tikzset{knot/.style={double=#1,double distance=1pt,line width=2pt,white}}

\begin{document}
\begin{enumerate}
\item $$\langle \tikz[baseline=-.8ex] \draw[knot,double=Red] (0,0) circle (1ex); \rangle = 1$$
\item $$\langle \tikz[baseline=-.8ex] \node[knot under cross,knot,draw,double=Red] {}; \rangle = A \langle \tikz[baseline=-.8ex] \node[knot vert,knot,draw,double=Red] {}; \rangle + A^{-1} \langle \tikz[baseline=-.8ex] \node[knot horiz,knot,draw,double=Red] {}; \rangle$$
\item $$\langle \tikz[baseline=-.8ex] \draw[knot,double=Red] (0,0) circle (1ex); \cup L \rangle = (-A^2 - A^{-2}) \langle L \rangle$$
\end{enumerate}
\end{document}


It looks a little different in that I use straight lines instead of curved ones.

Both the answers that have already been given have an obvious refinement, that is, make the symbols scalable with the math style. Even @egreg’s answer, which is more flexible than @LoopSpaces’s, is defective in this, in that it statically refers to the “text size” (it uses \textfont2).

These enhancements are just routine, but since 24 hours have already passed by, I’ll assume that the two authors didn’t bother to submit them (they are also pretty boring!), and propose myself for the task.

Besides scaling down from \textfont to \scriptfont and to \scriptscriptfont size, I also decided to make the symbols appear in a “large” variant when used in display, like a “big” operator (\sum, \int, \bigoplus, …). Admittedly, this can be questionable.

This is the code:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.

\usepackage[T1]{fontenc}         % Not necessary, but recommended.

\usepackage[ascii]{inputenc}     % Just to check that the source is still pure,
% 7-bit-clean ASCII when you execute it, as it
% was when I wrote it.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath}

% Old uncle Gustavo prefers to stick to the "picture" environment:
\usepackage{pict2e}
% \usepackage{xcolor} % I'd leave it out

%--------------------------------------------------------------%
\makeatletter

% We define separate versions (large and small) for the frames:
\newcommand*\@KP@Large@frame[2]{%
\setlength\unitlength{\fontdimen 22 #1\tw@}%
\vrule \@width\z@ \@height 4\unitlength \@depth\tw@\unitlength
\begin{picture}(6,2)(-3,-1)%
\def\@KP@Diameter   {6}%
#2%
\end{picture}%
}
\newcommand*\@KP@Small@frame[2]{%
\setlength\unitlength{\fontdimen 22 #1\tw@}%
\vrule \@width\z@ \@height \thr@@\unitlength \@depth\@ne\unitlength
\begin{picture}(4,2)(-2,-1)%
\def\@KP@Hole@radius{.5}% ... but let it be customizable too.
\def\@KP@Diameter   {4}%
#2%
\end{picture}%
}

% On the other hand, for the commands that draw the four different shapes, it
% seems that all differences between the small variant and the large one can be
% confined in the following three macros (here, we just declare their name):
\newcommand*\@KP@Diameter   {}
%
% The four shapes:
\newcommand*\@KP@Shape@A{%
\put(0,0){\circle{\@KP@Diameter}}%
}
\newcommand*\@KP@Shape@B{%
}
\newcommand*\@KP@Shape@C{%
}
\newcommand*\@KP@Shape@D{%
}

\newcommand*\@KP@Atomic@mathpalette[1]{%
\mathinner{% or "\mathord"?
% Note that a new level of grouping has just been entered (p. 290).
% \color{gray}% not used, for now
\mathchoice{%
\linethickness{.6\p@}% Tip: use thicker lines if you decide to
% revert to using gray.
\@KP@Large@frame \textfont {#1}%
}{%
\@KP@Small@frame \textfont {#1}%
}{%
\@KP@Small@frame \scriptfont {#1}%
}{%
\@KP@Small@frame \scriptscriptfont {#1}%
}%
}%
}

% User-level commands:
\newcommand*\KPA{\@KP@Atomic@mathpalette \@KP@Shape@A}
\newcommand*\KPB{\@KP@Atomic@mathpalette \@KP@Shape@B}
\newcommand*\KPC{\@KP@Atomic@mathpalette \@KP@Shape@C}
\newcommand*\KPD{\@KP@Atomic@mathpalette \@KP@Shape@D}

\makeatother
%--------------------------------------------------------------%

\begin{document}

The Kauffmann Polynomial is defined by:
\begin{enumerate}
\item
Trivial link: $$\left<\KPA\right> = 1$$.

\item
Disjoint union etc.:
$$\left<L\cup\KPA\right> = (-A^{2}-A^{-2})\langle L\rangle$$.

\item
Skein relation:
$$\left<\KPB\right> = A\left<\KPC\right> + A^{-1}\left<\KPD\right>$$.
\end{enumerate}
Now the same three relations in display:
%
\begin{align}
\left<\KPA\right> &= 1
\left<L\cup\KPA\right> &= (-A^{2}-A^{-2})\langle L\rangle
&&\text{disjoint union} \label{eq:union} \\
\left<\KPB\right> &= A\left<\KPC\right> + A^{-1}\left<\KPD\right>
&&\text{skein relation} \label{eq:skein}
\end{align}
%
From \eqref{eq:trivial} and~\eqref{eq:skein} I infere that
$$\frac{\left<\KPB\right>}{A\left<\KPC\right> + A^{-1}\left<\KPD\right>} = \left<\KPA\right>$$;
let us repeat it once again:
%
\begin{equation*}
\frac{\left<\KPB\right>}{A\left<\KPC\right> + A^{-1}\left<\KPD\right>}
= \left<\KPA\right>
\end{equation*}
%

Also work: $$2^{\left<\KPB\right>}$$ and $$2^{2^{\left<\KPB\right>}}$$.

\end{document}


And here is the output it produces:

• I am sorry, I was not aware of your nice answer! May I suggest that you post a modified version of it to the "new" question. (+1 of course.) (In principle, there is also an alternative way to do the scaling, namely setting the units to the width/height of a control letter.) – user121799 Jul 30 '18 at 19:49