% testing graphical calculus for Frobenius algebras
% Clara L\"oh 12/2009
\documentclass[a4paper]{article}

\usepackage{frobeniusgraphcalc}
\usepackage{array}

\newcommand{\texcommand}[1]{\textsf{$\backslash$#1}}
\newcommand{\texcode}[1]{\textsf{#1}}
\newcommand{\texvariable}[1]{{\normalfont\textit{#1}}}
\newcommand{\TikZ}{{\normalfont Ti\textit{k}Z}}

\title{Graphical calculus for Frobenius algebras\\
       \textsf{frobeniusgraphcalc.sty}}
\author{Clara L\"oh, clara.loeh@uni-muenster.de}
\date{\today}

\begin{document}

\maketitle

% Basic documentation
\begin{center}
{\setlength{\extrarowheight}{2.1em}
\begin{tabular}{c@{\qquad}ll}
  \begin{graphcalc}
    \gvec{1}
    \gid
  \end{graphcalc}
  & \texcommand{gid}
  & identity
  \\
  \begin{graphcalc}
    \gvec{2}
    \gmu
  \end{graphcalc}
  & \texcommand{gmu}
  & multiplication
  \\
  \begin{graphcalc}
    \gvec{1}
    \gdelta
  \end{graphcalc}
  & \texcommand{gdelta}
  & comultiplication
  \\
  \begin{graphcalc}
    \gvec{1}
    \gepsilon
  \end{graphcalc}
  & \texcommand{gepsilon}
  & Frobenius form
  \\
  \begin{graphcalc}
    \gvec{0}
    \gunit
  \end{graphcalc}
  & \texcommand{gunit}
  & unit
  \\
  \begin{graphcalc}
    \gvec{2}
    \gbeta
  \end{graphcalc}
  & \texcommand{gbeta}
  & pairing
  \\
  \begin{graphcalc}
    \gvec{0}
    \ggamma
  \end{graphcalc}
  & \texcommand{ggamma}
  & copairing
  \\
  \begin{graphcalc}
    \gvec{2}
    \gtwist
  \end{graphcalc}
  & \texcommand{gtwist}
  & twist
  \\
\end{tabular}}

\vfill

\begin{tabular}{ll}
  \texcode{graphcalc}
& (environment) wrapper around all graphical calculations
\\
& [optional argument: \TikZ-style options]
\\
  \texcommand{gvec\{\texvariable{n}\}}
& number of tensor factors of the first domain space
\\
  \texcommand{gtensor}
& tensor product of maps
\\
  \texcommand{gcomp}
& (inverse) composition of maps 
\end{tabular}
\end{center}

\vfill

\clearpage

% Examples
\begin{center}
\begin{tabular}{cl}
\begin{graphcalc}
  \gvec{3}
  \gtwist
  \gtensor
  \gid
  \gcomp
  \gid
  \gtensor
  \gtwist
\end{graphcalc}
& 
\begin{tabular}{l}
  {\color{gray}\texcommand{begin\{graphcalc\}}}\\
  {\color{gray}\texcommand{gvec\{3\}}}\\
  \texcommand{gtwist}\\
  {\color{blue}\texcommand{gtensor}}\\
  \texcommand{gid}\\
  {\color{red}\texcommand{gcomp}}\\
  \texcommand{gid}\\
  {\color{blue}\texcommand{gtensor}}\\
  \texcommand{gtwist}\\
  {\color{gray}\texcommand{end\{graphcalc\}}}
\end{tabular}
\end{tabular}

\vfill

\begin{graphcalc}
  \gvec{7}
  \gmu
  \gtensor
  \gmu
  \gtensor
  \gid
  \gtensor
  \gmu
  %%
  \gcomp
  \gmu
  \gtensor
  \gmu
  %% 
  \gcomp
  \gmu
  %%
  \gcomp
  \gid
\end{graphcalc}

\vfill

\begin{align*}
  \begin{graphcalc}
    \gvec{3}
    \gmu
    \gtensor
    \gid
    %%
    \gcomp
    \gmu
  \end{graphcalc}
  =
  \begin{graphcalc}
    \gvec{3}
    \gid
    \gtensor
    \gmu
    %%
    \gcomp
    \gmu
  \end{graphcalc}
\end{align*}

\vfill

\begin{graphcalc}
  \gvec{4}
  \gid
  \gtensor
  \gbeta
  \gtensor
  \gid
  %%
  \gcomp
  \gmu
\end{graphcalc}
\begin{graphcalc}
  \gvec{1}
  \gdelta
  \gcomp
  \gid
  \gtensor
  \ggamma
  \gtensor
  \gid
\end{graphcalc}

\vfill

\begin{graphcalc}
  \gvec{0}
  \ggamma
  \gtensor
  \gunit
  \gcomp
  \gmu
  \gtensor
  \gdelta
  \gcomp
  \gbeta
  \gtensor
  \gepsilon
\end{graphcalc}

\vfill

\clearpage

% basic colour support

\begin{tabular}{ll}
    \texcommand{gfillcolour}
  & standard fill colour (for all maps)
  \\ 
    \texcommand{gcolour}
  & standard colour of the strokes
  \\
    \texcommand{gopacity} 
  & opacity of the fill colours
  \\
    \texcommand{gidcolour}
  & fill colour of \texcommand{gid}
  \\
    \texcommand{gmucolour}
  & fill colour of \texcommand{gmu}
  \\
    \texcommand{gdeltacolour}
  & fill colour of \texcommand{gdelta}
  \\
    \texcommand{gepsiloncolour}
  & fill colour of \texcommand{gepsilon}
  \\ 
    \texcommand{gunitcolour}
  & fill colour of \texcommand{gunit}
  \\
    \texcommand{gbetacolour}
  & fill colour of \texcommand{gbeta}
  \\
    \texcommand{ggammacolour}
  & fill colour of \texcommand{ggamma}
  \\
    \texcommand{gtwistcolour}
  & fill colour of \texcommand{gtiwst}
\end{tabular}

\vfill

\begin{graphcalc}
  \def\gmucolour{red!80!yellow}
  \def\gepsiloncolour{green!80!yellow}
  \gvec{0}
  \ggamma
  \gtensor
  \gunit
  \gcomp
  \gmu
  \gtensor
  \gdelta
  \gcomp
  \gbeta
  \gtensor
  \gepsilon
\end{graphcalc}

\vfill

\begin{graphcalc}
  \def\gopacity{0.8}
  \def\gmucolour{red!80!yellow}
  \def\gepsiloncolour{green!80!yellow}
  \def\gdeltacolour{white}
  \gvec{0}
  \ggamma
  \gtensor
  \gunit
  \gcomp
  \gmu
  \gtensor
  \gdelta
  \gcomp
  \gbeta
  \gtensor
  \gepsilon
\end{graphcalc}

\vfill

\begingroup
\def\gcolour{blue}
\begin{graphcalc}
  \def\gfillcolour{white}
  \gvec{0}
  \ggamma
  \gtensor
  \gunit
  \gcomp
  \gmu
  \gtensor
  \gdelta
  \gcomp
  \gbeta
  \gtensor
  \gepsilon
\end{graphcalc}
\endgroup

\vfill

\begin{graphcalc}
  \def\gfillcolour{white}
  \def\gopacity{0}
  \gvec{0}
  \ggamma
  \gtensor
  \gunit
  \gcomp
  \gmu
  \gtensor
  \gdelta
  \gcomp
  \gbeta
  \gtensor
  \gepsilon
\end{graphcalc}

\vfill


\end{center}

\end{document}