\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{braids}
\usetikzlibrary{snakes} % if we want a wiggly
\usetikzlibrary {decorations.markings}
 \setlength\parindent{0pt}
\usepackage{fullpage}
\begin{document}

\begin{minipage}{0.4\linewidth}
   this braid is annular, but has no colouring as we don't want to
   hint about the number of strands...
   it should be 4 strand\\
    \begin{tikzpicture}
      \pic[braid/.cd, strand 2/.style={red},
      annular = 1,
    %  gap = 0.6,
      ]{braid={s_2^{1} s_3^{-1}
          s_4 | 1|1 s_3 s_4^{-1}
        }};
    \end{tikzpicture}\\
  

  \end{minipage}\ldots
\begin{minipage}{0.4\linewidth}
  this has the same braid word, and is also specified as annular,
  but we specify 5 strands, so there should be no ``over the
  cylinder'' crossings.
    \begin{tikzpicture}
      \pic[braid/.cd, strand 2/.style={red},
      annular = 1,
      number of strands = 5,
    %  gap = 0.6,
      ]{braid={s_2^{1} s_3^{-1}
          s_4 | 1|1 s_3 s_4^{-1}
        }};
    \end{tikzpicture}
  

  \end{minipage}

  \ldots


  \begin{minipage}{0.4\linewidth}
  

    A new picture:
    this braid is not annular and has 5 strands.
We are checking that the s\_\{1, 3\} and s\_\{1-4\} functionality have
not been affected.
    \\
   \begin{tikzpicture}
     \pic[rotate=90,braid/.cd, strand 1/.style={orange},
     strand 2/.style={red},
     strand 3/.style={blue},
     ]
     {braid={s_1^{1}-s_4 s_2^{-1}
         s_3 | s_2 s_3^{-1}
         s_{1,3}
            s_{1-4}
          }};
      \end{tikzpicture}
\end{minipage}   
 


  this braid is annular and has 5 strands; we've given 4 of them
  colours.
  We're checking that the multiple crossing specs still work on the
  annular braid, providing the crossings are ``within'' the braid.\\

  \begin{tikzpicture}
    \pic[rotate=90,braid/.cd, strand 1/.style={orange},
    strand 2/.style={red},
    strand 3/.style={blue},
    strand 4/.style={purple},
  %  strand 4/.style={black},
  %  strand 5/.style={orange},
    gap = 0.05,
    annular=1,
       cylinder/.style={densely dotted, decoration={ markings,% switch on markings
    mark=% actually add a mark
      between positions 0 and 1 step 5mm
      with
      {
        \draw (-2pt,-2pt) -- (2pt,2pt);
        \draw (2pt,-2pt) -- (-2pt,2pt);
      }
    },decorate, thick},
    height=-15mm,
    width=5mm
    ]
    {braid={s_1^{1}- s_4^{-1}
         s_{1-4}
        s_{1,3,4}
        s_3-s_5 | s_2^{-1}-s_4| s_1 s_5^{-1}
     }};
    % {braid={s_2 s_3^{-1}
    %     s_4-s_1 s_5 % = s_3 of original annular braid
    %     | 1 | 1 | s_3
    %     s_4^{-1}-s_1^{-1} s_5 % = s_3^{-1} of original annular braid
    %     }};
  \end{tikzpicture}\\


 The grand chain, and we try out another cylinder edge design, just
 for fun:\\
 \begin{tikzpicture}
   \pic[braid/.cd, strand 1/.style={orange, ultra thick},
   strand 7/.style={red},
   strand 2/.style={blue},
   strand 8/.style={purple, ultra thick},
       cylinder/.style={densely dotted, decoration={ markings,% switch on markings
    mark=% actually add a mark
      between positions 0 and 1 step 6mm
      with
      {
       \node (0,0) {\includegraphics[width=4mm]{dancer.png}};
      }
    },decorate, thick},
      %    cylinder/.style={densely dotted, decoration={snake,amplitude=1mm,segment length=8mm}, decorate,thick},
 %  strand 4/.style={black},
 %  strand 5/.style={orange},
   gap = 0.1,
   annular=1,
   ]
   {braid={
       s_1-s_3-s_5-s_7
       s_2^{-1}-s_4^{-1}-s_6^{-1}-s_8^{-1}
 s_1-s_3-s_5-s_7
       s_2^{-1}-s_4^{-1}-s_6^{-1}-s_8^{-1}
   s_1-s_3-s_5-s_7
       s_2^{-1}-s_4^{-1}-s_6^{-1}-s_8^{-1}
   s_1-s_3-s_5-s_7
       s_2^{-1}-s_4^{-1}-s_6^{-1}-s_8^{-1}
   s_1-s_3-s_5-s_7
       s_2^{-1}-s_4^{-1}-s_6^{-1}-s_8^{-1}
       }};
  \end{tikzpicture}\\

  \newpage
  \begin{minipage}{0.3\linewidth}
  A tau operator, with some extra decoration at the cylinder edges:\\

 \begin{tikzpicture}
   \pic[braid/.cd, strand 4/.style={orange, line width=3pt},
     every strand/.style={line width=2pt},
      strand 1/.style={red},
    strand 3/.style={blue},
    strand 2/.style={green},
   annular=1,
   number of strands=4,
    cylinder/.style={thick,dashed,purple},
   crossing height=10mm,
   width=10mm,
   control factor=0.1,
   ]
   {braid={
       s_1 | [] | s_2 | s_4 | [  | [ |  s_1-s_3
       }};
  \end{tikzpicture}
 \end{minipage}
 \ldots or \ldots \hspace{0.3em}
 \begin{minipage}{0.3\linewidth}
   Bendy tau with jagged cylinder:\\
 \begin{tikzpicture}
   \pic[braid/.cd,
   strand 4/.style={orange, line width=3pt},
     every strand/.style={line width=2pt},
      strand 1/.style={red},
    strand 3/.style={blue},
    strand 2/.style={green},
    annular=1,
    cylinder/.style={decoration={zigzag},decorate},
   number of strands=4,
   crossing height=10mm,
   width=10mm,
   control factor=0.4,
   ]
   {braid={
       s_1 | [ ] | s_2 | s_4 | [  | [ |  s_1-s_3
       }};
  \end{tikzpicture}
 \end{minipage}
 \ldots

 \begin{minipage}{0.23\linewidth}

  Some things that work a little differently\ldots\\
\usetikzlibrary {decorations.shapes} 
\begin{tikzpicture}
  \pic[draw,braid/.cd,
  strand 4/.style={orange, line width=3pt},
  every strand/.style={line width=1.2pt},
  every floor/.style={fill=yellow},
     strand 1/.style={red},
   strand 3/.style={blue},
   strand 2/.style={green},
   cylinder/.style={purple, decoration={crosses,segment length=2mm}, decorate},
%  number of strands=4,
  crossing height=20mm,
  width=10mm,
  control factor=0.2,
  gap=0.03,
  ] (b)
  {braid={
        s_{1-4} | s_{1,4}  s_{1,3} s_3      s_{4-1} | s_{4,1}
      }};
    \node[draw, at=(b)] {};
 \end{tikzpicture}
\end{minipage}
\ldots
\begin{minipage}{0.3\linewidth}

Same spec, annular on\\
\usetikzlibrary {decorations.shapes} 
\begin{tikzpicture}
  \pic[draw,braid/.cd,
  strand 4/.style={orange, line width=3pt},
  every strand/.style={line width=1.2pt},
    every floor/.style={fill=yellow},
     strand 1/.style={red},
   strand 3/.style={blue},
   strand 2/.style={green},
   annular=1,
   cylinder/.style={purple, decoration={crosses,segment length=2mm}, decorate},
  %number of strands=4,
  crossing height=20mm,
  width=10mm,
  control factor=0.2,
  gap=0.03,
  ](b)
  {braid={
      s_{1-4} |
      s_{1,4}
      s_{1,3} s_3
      s_{4-1} | s_{4,1}
      }};
     \node[draw, at=(b)] {};
 \end{tikzpicture}
\end{minipage}
\ldots
\begin{minipage}{0.3\linewidth}

Same spec, using [ as token (should be same as first pic)\\
\usetikzlibrary {decorations.shapes} 
\begin{tikzpicture}
  \pic[draw,braid/.cd,
  strand 4/.style={orange, line width=3pt},
  every strand/.style={line width=1.2pt},
    every floor/.style={fill=yellow},
     strand 1/.style={red},
   strand 3/.style={blue},
   strand 2/.style={green},
%   annular=1,
   cylinder/.style={purple, decoration={crosses,segment length=2mm}, decorate},
  %number of strands=4,
  crossing height=20mm,
  width=10mm,
  control factor=0.2,
  gap=0.03,
  ](b)
  {braid={
      [_{1-4} |
      [_{1,4}
      [_{1,3} [_3
      [_{4-1} | [_{4,1}
      }};
     \node[draw, at=(b)] {};
 \end{tikzpicture}
\end{minipage}

\begin{minipage}{0.3\linewidth}

Same spec, using no token\\
\usetikzlibrary {decorations.shapes} 
\begin{tikzpicture}
  \pic[draw,braid/.cd,
  strand 4/.style={orange, line width=3pt},
  every strand/.style={line width=1.2pt},
    every floor/.style={fill=yellow},
     strand 1/.style={red},
   strand 3/.style={blue},
   strand 2/.style={green},
%   annular=1,
   cylinder/.style={purple, decoration={crosses,segment length=2mm}, decorate},
  %number of strands=4,
  crossing height=20mm,
  width=10mm,
  control factor=0.2,
  gap=0.03,
  ](b)
  {braid={
      _{1-4} |
      _{1,4}
      _{1,3} _3
      _{4-1} | _{4,1}
      }};
     \node[draw, at=(b)] {};
 \end{tikzpicture}
\end{minipage}



% \end{macrocode}
%  Settings for annular braids:
%    \begin{macrocode}
%annular/.initial=0
%cylinder~ style/.initial=loosely~dotted,color={black}
% }
 
\end{document}
