\documentclass{article}
\usepackage[a4paper, textwidth=150mm]{geometry}

\usepackage{qworld}

\usepackage{bookmark}
\usepackage{fontspec}
\usepackage{pdfpages}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{mathtools}

\usepackage{ascmac}
\usepackage{fancybox}
\usepackage{float}

\usepackage{bbm}
\usepackage{mathrsfs}

\usepackage{changelog}

\usepackage{framed}
\newenvironment{longshadowbox}{%
  \def\FrameCommand{\fboxsep=\FrameSep \shadowbox}%
  \MakeFramed {\FrameRestore}}%
{\endMakeFramed}

\usepackage{url}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue}

\usepackage{iitem}

\usepackage{xspace}
\newcommand{\qworldname}{\texttt{QWorld}\xspace}
\newcommand{\tikzname}{Ti\emph{k}Z\xspace}
\newcommand{\texlivename}{\TeX{} \textsf{Live}\xspace}

\setcounter{tocdepth}{3}

\usepackage[most]{tcolorbox}
\newtcblisting{mybox}[2][]{
  colback=red!5!white,
  colframe=red!75!black,
  fonttitle=\bfseries,
  title=#2,
  #1
}

\tcbset
{
  codeinfo/.style=
  { 
    colframe=cyan!90,
    coltitle=cyan!60,
    colbacktitle=black,
    fonttitle=\small\sffamily\bfseries, 
    fontupper=\small, 
    fontlower=\small
  },
  exampletitleinfo/.style 2 args=
  {
    codeinfo,
    title={Example \thetcbcounter : #1},
    label={#2}
  },
  failurecodeinfo/.style=
  {
    colframe=red!90,
    coltitle=red!60, 
    colbacktitle=black,
    fonttitle=\small\sffamily\bfseries, 
    fontupper=\small, 
    fontlower=\small
  },
  failureexampletitleinfo/.style 2 args=
  {
    failurecodeinfo,
    title={Failure Example \thetcbcounter : #1},
    label={#2}
  }
}
\newtcblisting{texexp}[1]
{
  codeinfo,
  #1
}
\newtcblisting[auto counter,number within=section]{codebox}[3][center lower,listing side text,righthand width=3.5cm,bicolor,colbacklower=white]
{
  exampletitleinfo={#2}{#3},
  breakable,
  #1
}

\newtcblisting[use counter from=codebox,number within=section]{CODEBOX}[3][center lower,bicolor,colbacklower=white]
{
  exampletitleinfo={#2}{#3},
  breakable,
  #1
}
\newtcolorbox[use counter from=codebox]{codeboxspec}[3][]
{
  exampletitleinfo={#2}{#3},
  breakable,
  #1
}

\newtcblisting{texfexp}[1]
{
  failurecodeinfo,
  #1
}
\newtcblisting[auto counter,number within=section]{fcodebox}[3][center lower,listing side text,righthand width=3.5cm,bicolor,colbacklower=white]
{
  failureexampletitleinfo={#2}{#3},
  breakable,
  #1
}

\newtcblisting[use counter from=fcodebox,number within=section]{FCODEBOX}[3][center lower,bicolor,colbacklower=white]
{
  failureexampletitleinfo={#2}{#3},
  breakable,
  #1
}
\newtcolorbox[use counter from=fcodebox]{fcodeboxspec}[3][]
{
  failureexampletitleinfo={#2}{#3},
  breakable,
  #1
}
\usepackage{xcolor}
\NewDocumentCommand{\showcmd}{O{\textbackslash} m O{black}}{%
    \leavevmode%
    \ifthenelse{\equal{#3}{new}}{%
        \textcolor{green!50!black}{\texttt{#1#2}}%
    }{%
        \ifthenelse{\equal{#3}{old}}{%
            \textcolor{red}{\texttt{#1#2}}%
        }{%
            \textcolor{#3}{\texttt{#1#2}}%
        }%
    }%
}

\begin{document}

% \title{
%     \Huge\textbf{The QWorld Package}\\[4pt]
%     \scriptsize\texttt{Version 1.1.1} \\[4pt]
% }
% \author{
%     \textbf{Niina Ryota} \\[4pt]
% }
% \date{\today}
% \maketitle

\begin{titlepage}
  \centering
\vspace*{2.5cm}

% パッケージ名とバージョン
{\Huge\bfseries The QWorld Package\par}
\vspace{1ex}

% {\large A \LaTeX{} package for diagrammatic reasoning\\
% in monoidal categories and categorical quantum mechanics\par}

{\large A \LaTeX{} package for drawing string diagrams\par in monoidal categories and quantum theory\par}
\vspace{2ex}

{\normalsize\ttfamily v1.1.2\par}

\vspace{3cm}

% 著者情報
{\large\bfseries Niina Ryota\par}
\vspace{1ex}
\href{qworld-package@googlegroups.com}
   {\normalsize\ttfamily qworld-package@googlegroups.com}

\vfill

% 日付
{\today}
\end{titlepage}

\begin{abstract}
  \qworldname is a \LaTeX\ package designed for efficiently rendering complex graphical calculus in monoidal categories.
  In particular, it supports the typesetting of diagrammatic languages in category theory, quantum theory, and related fields, where diagrammatic reasoning plays a crucial role.
\end{abstract}

\tableofcontents
\section{Introduction}
This document aims to provide a step-by-step guide to installing and using the \qworldname package, from basic commands to advanced applications. 
\qworldname is a \LaTeX\ package specifically designed for the typesetting of diagrammatic languages, offering an intuitive command set for describing diagrams related to monoidal categories, Frobenius structures, braiding, Hopf algebras, symmetries, dualities, pivotal structures, and dagger categories using \tikzname\cite{tikz-manual}.
\section{Basic Usage}
\subsection{Fundamental Elements}
The following are the most fundamental commands in the \qworldname package, forming the basis for drawing diagrams:
\begin{itemize}
  \item \showcmd{q}: A canvas for placing diagram elements.
  \item \showcmd{qbox}: Draws a box\(\q[scale=0.5]{\qbox}\).
  \item \showcmd{qwire}: Draws a wire\(\q[scale=0.5]{\qwire}\).
  \item \showcmd{qcirc}: Compositon.
\end{itemize}
These commands are used within the canvas environment, denoted by \verb|\q{...}|. 
For example, writing \verb|\q{\qbox}| results in the rendering of a box\(\q[scale=0.5]{\qbox}\).\par
To compose \(\q[scale=0.5]{\qbox}\)and\(\q[scale=0.5]{\qbox}\), use \verb|\qcirc|. 
This is analogous to function composition in mathematics, such as \(g\circ f\) (\verb|\(g\circ f\)|). 
\begin{codebox}{}{Ex:78129738917}
  \q{ \qbox \qcirc \qbox }
\end{codebox}
Additionally, placing multiple \verb|\qbox| commands in sequence results in boxes\(\q[scale=0.5]{\qbox}\)being arranged horizontally:
\begin{codebox}{}{boxs2}
  \q{ \qbox \qbox \qbox }
\end{codebox}
It is also possible to compose multiple boxes using\verb|\qcirc|:
\begin{codebox}{}{boxsbr}
    \q
    {
      \qbox \qbox \qbox
        \qcirc
      \qbox \qbox \qbox
    }
\end{codebox}
Note that \verb|\n| is synonymous with\verb|\qcirc|
\begin{codebox}{}{boxsn}
  \q
  {
    \qbox \qbox \qbox \n
    \qbox \qbox \qbox
  }
\end{codebox}
\begin{codebox}{}{ex:hopflink}
  \q{
    \qcaprev         \qcap  \n
    \qwire   \qbraid \qwire \n
    \qwire   \qbraid \qwire \n
    \qcup            \qcuprev
  }
\end{codebox}
\begin{itemize}
  \item \verb|\qcaprev| draws \(\q[scale=0.6]{\qcaprev}\).
  \item \verb|\qcap| draws \(\q[scale=0.6]{\qcap}\).
  \item \verb|\qwire| draws \(\q[scale=0.5]{\qwire}\).
  \item \verb|\qbraid| draws \(\q[scale=0.5]{\qbraid}\).
  \item \verb|\qcup| draws\(\q[scale=0.6]{\qcup}\).
  \item \verb|\qcuprev| draws \(\q[scale=0.6]{\qcuprev}\).
\end{itemize}
As a whole, the elements are arranged in the diagram according to the order in which the commands are written.\par
\subsection{Mathematical Mode}
When writing equations that include diagrammatic language, use the mathematical mode.
\begin{CODEBOX}{}{IntroEx}
  \[
    \operatorname{Tr}\left(\q{\qbraid\qcirc\qbraid}\right)
    =\q{
      \qcap               \qcap    \n
      \qwire   \qbraidinv \qwire   \n
      \qwire   \qbraidinv \qwire   \n
      \qcuprev            \qcuprev
    }
  \]
\end{CODEBOX}

\subsection{Installation}
The style file for the \qworldname package, \showcmd[]{qworld.sty}, is available for download from the following \href{https://ctan.org/pkg/qworld}{CTAN} page:
\begin{center}
  \url{https://ctan.org/pkg/qworld}
\end{center}
To use it, place the file in your \TeX\ package directory and include the following line in the preamble:
\begin{verbatim}
  \usepackage{qworld}
\end{verbatim}
If your \TeX\ distribution includes \qworldname, you may also install it using a package manager such as \showcmd[]{tlmgr} or \showcmd[]{MiKTeX Console}.

\paragraph{Dependencies} 
The package depends on the following:
\begin{itemize}
  \item \tikzname, with the following libraries:
    \iitem \showcmd[]{cd}
    \iitem \showcmd[]{positioning}
    \iitem \showcmd[]{arrows}
    \iitem \showcmd[]{arrows.meta}
    \iitem \showcmd[]{calc}
    \iitem \showcmd[]{intersections}
    \iitem \showcmd[]{shapes.symbols}
    \iitem \showcmd[]{shapes.geometric}
    \iitem \showcmd[]{shapes.misc}
    \iitem \showcmd[]{decorations.pathreplacing}
    \iitem \showcmd[]{decorations.markings}
    \iitem \showcmd[]{decorations.pathmorphing}
  \item \showcmd[]{pgffor}
  \item \showcmd[]{ifthen}
  \item \showcmd[]{xparse}
  \item \showcmd[]{xfp}
  \item \showcmd[]{xstring}
\end{itemize}
These dependencies are included by default in the \texlivename distribution, so no additional setup is required.
\section{Basic Customization}
This section explains how to customize commands in the \qworldname package.

\subsection{Identification Number}
All commands placed within \verb|\q{...}| are automatically assigned unique identification numbers based on their execution order. 
For example, in the previous example \ref{boxsn}, each \verb|\qbox| is numbered as follows:
\[\q{\qloop[2]{\qloop[3]{\qbox[show id={true}]}\n}}\]
For more details, see Section \ref{subsec:show id} on page \pageref{subsec:show id}.
\subsection{Bounding Box}
\[
  \q{
  \qcaprev         \qcap  \n
  \qwire   \qbraid \qwire \n
  \qwire   \qbraid \qwire \n
  \qcup            \qcuprev
  \qbb[red][1,2]
    \bbsymbol{Measure}
    \bbsymbol[W]{Output}[left]
    \bbsymbol[NW]{Computation}[above left]
    \bbsymbol[NE]{Physics}[above right]
  \qbb[yellow][3,5,6,8]
    \bbsymbol{Braid}
    \bbsymbol[W]{Compute}[left]
  \qbb[cyan][9,10]
    \bbsymbol{Create}
    \bbsymbol[W]{Initialize}[left]
  }
\]

Each element has an associated bounding box. The following are examples:
\begin{itemize}
  \item The bounding box of\q{\qcaprev}is visualized as\q{\qcaprev\qbball}.
  \item The bounding box of\q{\qbraid}is visualized as\q{\qbraid\qbball}.
  \item The bounding box of\q{\qwire}is visualized as\q{\qwire\qbball}.
  \item The bounding box of\q{\qcuprev}is visualized as\q{\qcuprev\qbball}.
\end{itemize}
The following commands are available for visualizing bounding boxes and placing text near them:
\begin{itemize}
  \item Visualization
    \iitem \showcmd{qbb}: Displays the bounding box of a specific element.
    \iitem \showcmd{qbball}: Displays the bounding boxes of all elements at once.
    \iitem \showcmd{qBBall}: Displays the bounding box surrounding the entire canvas.
  \item Placing text
    \iitem \showcmd{bbsymbol}: Places text within a bounding box.
\end{itemize}
\begin{verbatim}
  \qbb[<color>][<ID list>]
\end{verbatim}
\begin{itemize}
  \item First argument (optional): Specifies the color. If omitted, no color is applied.
  \item Second argument: Specifies a list of element IDs to display their bounding boxes.
\end{itemize}
\begin{codebox}{}{Ex:78129738920}
  \q{\qbox\qbb[1]}
\end{codebox}
\begin{codebox}{}{ex:781297389270454}
  \q{
    \qcaprev         \qcap  \n
    \qwire   \qbraid \qwire \n
    \qwire   \qbraid \qwire \n
    \qcup            \qcuprev
    \qbb[4,7]
  }
\end{codebox}
\begin{CODEBOX}{}{Ex:78129738921}
  \q{\qbox\qbox\qbox\qbox\qbox\qbox\qbb[yellow][2,...,5]}
\end{CODEBOX}
\begin{codebox}{}{Ex:74839722}
  \q
  {
    \qbox\qbox\qbox\n
    \qbox\qbox\qbox
    \qbb[green][2,5]
  }
\end{codebox}
\begin{codebox}{}{Ex:78129738918}
  \q{
    \qcaprev \qcap          \n
    \qwire   \qbraid \qwire \n
    \qwire   \qbraid \qwire \n
    \qcup    \qcuprev
    \qbb[blue][4,7]
  }
\end{codebox}
\begin{verbatim}
  \qbball[<color>]
\end{verbatim}
\begin{itemize}
  \item Displays multiple bounding boxes at once (even for a single element).
  \item Ensures that the bounding boxes of different elements are properly aligned without overlap.
  \item The \qworldname package \textbf{minimizes the need for tedious manual coordinate adjustments} in diagram drawing.
\end{itemize}
\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{}{Ex:781297389270511}
  \q{
    \qcaprev         \qcap    \n
    \qwire   \qbraid \qwire   \n
    \qwire   \qbraid \qwire   \n
    \qcup            \qcuprev
    \qbball
  }
\end{codebox}

\begin{verbatim}
  \qBBall[<color>]
\end{verbatim}
\begin{itemize}
  \item Displays the bounding box surrounding all elements within the canvas.
\end{itemize}
\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{}{Ex:78129738916}
  \q{
    \qcaprev         \qcap    \n
    \qwire   \qbraid \qwire   \n
    \qwire   \qbraid \qwire   \n
    \qcup            \qcuprev
    \qBBall
  }
\end{codebox}
\begin{verbatim}
  \bbsymbol[<direction>]{<text>}[<options>]
\end{verbatim}
\begin{itemize}
  \item First argument (optional): Specifies placement direction. Options:
    \iitem \showcmd[]{N} (North), \showcmd[]{S} (South), \showcmd[]{E} (East), \showcmd[]{W} (West),
    \iitem \showcmd[]{NW} (Northwest), \showcmd[]{NE} (Northeast), \showcmd[]{SE} (Southeast), \showcmd[]{SW} (Southwest),
    \iitem \showcmd[]{C} (Center).
    \iitem Default: \showcmd[]{E} (East).
  \item Second argument: Specifies the text to be placed.
  \item Third argument (optional): Adjusts position (e.g., \showcmd[]{above}, \showcmd[]{below}, \showcmd[]{left}, \showcmd[]{right}).
    \iitem Default: \showcmd[]{right}.
\end{itemize}
\begin{CODEBOX}{}{Ex:bbsymbol}
  \q[scale=5]{
    \qbox
    \qbb[1]
    \bbsymbol{East (Default)}
    \bbsymbol[W]{West}[left]
    \bbsymbol[N]{North}[above]
    \bbsymbol[S]{South}[below]
    \bbsymbol[NE]{NorthEast}[above right]
    \bbsymbol[NW]{NorthWest}[above left]
    \bbsymbol[SE]{SouthWest}[below right]
    \bbsymbol[SW]{SouthEast}[below left]
    \bbsymbol[C]{Center}[]
  }
\end{CODEBOX}
\begin{CODEBOX}{}{Ex:78129738915}
  \q
  {
    \qcaprev         \qcap    \n
    \qwire   \qbraid \qwire   \n
    \qwire   \qbraid \qwire   \n
    \qcup            \qcuprev
    \qbb[red][1,2]
    \bbsymbol{Measure}
    \bbsymbol[W]{Output}[left]
    \bbsymbol[NW]{Computation}[above left]
    \bbsymbol[NE]{Physics}[above right]
    \qbb[yellow][3,5,6,8]
    \bbsymbol{Braid}
    \bbsymbol[W]{Compute}[left]
    \qbb[cyan][9,10]
    \bbsymbol{Create}
    \bbsymbol[W]{Initialize}[left]
  }
\end{CODEBOX}

\subsection{Box Customization}
\label{subsec:boxcustomization}
Keys can be used to adjust the number and arrangement of the box’s boundary lines.
For example, the following boxes can be drawn:
\begin{itemize}
  \item \(\q[scale=0.5]{\qbox[p=20,hlen=3]}\)
  \item \(\q[scale=0.5]{\qbox[p=10,N={1,2,3,8,9,10},S={4,5,6,7},hlen=3]}\)
\end{itemize}
These keys are applicable to many elements other than wires.
The main keys are as follows: 
\begin{itemize}
  \item \showcmd[]{n}
    \iitem The number of points on the north edge of the box\(\q[scale=0.5]{\qbox[p=2, P={}]}\)where wires\(\q[scale=0.31]{\qwire}\)can be generated (these points will be referred to as \showcmd[]{n} terminals).
    \iitem For example, if \showcmd[]{n=3}, three points can be placed at equal intervals on the north edge of the box.
    \iitem The default value is \showcmd[]{n=1}.
    \iitem The point obtained by vertically moving an \showcmd[]{n} terminal to the northernmost position is called an \showcmd[]{N} terminal.
    \iitem Both \showcmd[]{n} terminals and \showcmd[]{N} terminals are indexed as \(1,2,...\) from the west (left).   
    \iitem Generating a wire from the \(i\)-th \showcmd[]{n} terminal means connecting the \(i\)-th \showcmd[]{n} terminal and the \(i\)-th \showcmd[]{N} terminal with a line segment.
  \item \showcmd[]{N}
    \iitem The set of indices of the \showcmd[]{n} terminals from which wires are actually generated.
    \iitem For example, if \showcmd[]{n=3} and \showcmd[]{N=\{2\}}, a wire can be generated from the \(2\)nd of the three \showcmd[]{n} terminals.
    \iitem If \showcmd[]{n} is unspecified and \showcmd[]{N} is specified, \showcmd[]{n} is automatically set to \(\showcmd[]{n}\coloneq\max\showcmd[]{N}\).
    \iitem If \showcmd[]{N} is unspecified and \showcmd[]{n} is specified, \showcmd[]{N} is automatically set to \(\showcmd[]{N}\coloneq\{1,...,\showcmd[]{n}\}\).
    \iitem The northernmost end of a wire actually generated from an \showcmd[]{n} terminal is called the output point, or \showcmd[]{O} terminal.
  \item \showcmd[]{s}
    \iitem The number of points on the south edge of the box where wires can be generated (these points will be referred to as \showcmd[]{s} terminals).
    \iitem For example, if \showcmd[]{s=4}, four points can be placed at equal intervals on the south edge of the box. 
    \iitem The default value is \showcmd[]{s=1}.
    \iitem The point obtained by vertically moving an \showcmd[]{s} terminal to the southernmost position is called an \showcmd[]{S} terminal.
    \iitem Both \showcmd[]{s} terminals and \showcmd[]{S} terminals are indexed as \(1,2,...\) from the west (left).     
    \iitem Generating a wire from the \(i\)-th \showcmd[]{s} terminal means connecting the \(i\)-th \showcmd[]{s} terminal and the \(i\)-th \showcmd[]{S} terminal with a line segment.
  \item \showcmd[]{S}
    \iitem The set of indices of the \showcmd[]{s} terminals from which wires are actually generated.
    \iitem For example, if \showcmd[]{s=4} and \showcmd[]{S=\{1,4\}}, wires can be generated from the 1st and 4th of the four \showcmd[]{s} terminals.
    \iitem If \showcmd[]{s} is unspecified and \showcmd[]{S} is specified, \showcmd[]{s} is automatically set to \(\showcmd[]{s}\coloneq\max\showcmd[]{S}\).
    \iitem If \showcmd[]{S} is unspecified and \showcmd[]{s} is specified, \showcmd[]{S} is automatically set to \(\showcmd[]{S}\coloneq\{1,...,\showcmd[]{s}\}\).
    \iitem The southernmost end of a wire actually generated from an \showcmd[]{s} terminal is called the input point, or \showcmd[]{I} terminal.
  \item \showcmd[]{hlen}
    \iitem The horizontal length of the bounding box.
    \iitem For example, if \showcmd[]{hlen=2}, the horizontal length of the bounding box becomes \showcmd[]{2}.
    \iitem With one exception, the distance between the westernmost wire and the bounding box's boundary, and the distance between the easternmost wire and the bounding box's boundary, are both \(\fpeval{0.5}\).
    \iitem When \showcmd[]{hlen} is unspecified, the \showcmd[]{n} terminals and \showcmd[]{s} terminals are arranged with an interval of \(1\).
    \iitem When \showcmd[]{hlen} is specified, the \showcmd[]{n} terminals and \showcmd[]{s} terminals are arranged at equal intervals in a section of length \(\showcmd[]{hlen}-1\). The spacing depends on \showcmd[]{hlen} and the number of terminals.
      \iiitem If there is only one terminal, it is placed at the center of the section. In this case, if \(\showcmd[]{hlen}>1\), the distance between the westernmost wire and the bounding box's boundary, and the distance between the easternmost wire and the bounding box's boundary, are both \(\frac{\showcmd[]{hlen}}{2}>\fpeval{0.5}\).
  \item \showcmd[]{vlen}
    \iitem The vertical length (height) of the bounding box.
    \iitem The default value is \showcmd[]{vlen=1}.
  \item \showcmd[]{id}
    \iitem The identifier of the box.
    \iitem For example, if \showcmd[]{id=ID}, the following names are automatically assigned to the various points:
      \iiitem The \(i\)-th \showcmd[]{n} terminal (counting from the west): (n-\(i\)-ID).
      \iiitem The \(i\)-th \showcmd[]{s} terminal: (s-\(i\)-ID).
      \iiitem The point obtained by vertically moving the \(i\)-th \showcmd[]{n} terminal to the north edge of the box: (N-\(i\)-ID).
      \iiitem The point obtained by vertically moving the \(i\)-th \showcmd[]{s} terminal to the south edge of the box: (S-\(i\)-ID).
      \iiitem The northwest corner of the bounding box: (NW-ID)
      \iiitem The northeast corner of the bounding box: (NE-ID)
      \iiitem The southwest corner of the bounding box: (SW-ID)
      \iiitem The southeast corner of the bounding box: (SE-ID)
      \iiitem The northernmost point of the bounding box: (N-ID)
      \iiitem The southernmost point of the bounding box: (S-ID)
      \iiitem The westernmost point of the bounding box: (W-ID)
      \iiitem The easternmost point of the bounding box: (E-ID)
      \iiitem The center of the bounding box: (C-ID)
      \iiitem The northwest corner of the box: (nw-ID)
      \iiitem The northeast corner of the box: (ne-ID)
      \iiitem The southwest corner of the box: (sw-ID)
      \iiitem The southeast corner of the box: (se-ID)
      \iiitem The northernmost point of the box: (n-ID)          
      \iiitem The southernmost point of the box: (s-ID)
      \iiitem The westernmost point of the box: (w-ID)
      \iiitem The easternmost point of the box: (e-ID)          
      \iiitem The \(i\)-th output point: (O-\(i\)-ID)
      \iiitem The \(i\)-th input point: (I-\(i\)-ID)          
    \iitem Regardless of whether it is specified, each command placed inside \showcmd{q\{...\}} is assigned an identification number. Replacing the ID part with that number refers to the same point. See section \ref{subsec:show id} for details.
  \item \showcmd[]{p}, \showcmd[]{P}
    \iitem For a positive integer \showcmd[]{k}, \showcmd[]{p=k} means \showcmd[]{n=k} and \showcmd[]{s=k}.
    \iitem For a finite set of positive integers \showcmd[]{K}, \showcmd[]{P=K} means \showcmd[]{N=K} and \showcmd[]{S=K}.
  \item \showcmd[]{name}
    \iitem With \showcmd[]{name=<text>}, \text{<text>} is placed at the center of the box.
\end{itemize}
\begin{CODEBOX}{}{ex:boxpoints}
  \def\pradius{0.4pt}
  \q[scale=4]
  {
    \qbox
    [
      n=3,N={2},
      s=4,S={1,4},
      hlen=2,
      vlen=2,
      id={ID},
      name={C-ID}
    ]\n
    \qbb[ID]
    \node [above] at (NE-ID) {NE-ID};
    \node [above] at (NW-ID) {NW-ID};
    \node [below] at (SE-ID) {SE-ID};
    \node [below] at (SW-ID) {SW-ID};
    \fill (NE-ID) circle (\pradius);
    \fill (NW-ID) circle (\pradius);
    \fill (SE-ID) circle (\pradius);
    \fill (SW-ID) circle (\pradius);
    \node [above] at (ne-ID) {ne-ID};
    \node [above] at (nw-ID) {nw-ID};
    \node [below] at (se-ID) {se-ID};
    \node [below] at (sw-ID) {sw-ID};
    \fill (ne-ID) circle (\pradius);
    \fill (nw-ID) circle (\pradius);
    \fill (se-ID) circle (\pradius);
    \fill (sw-ID) circle (\pradius);
    \foreach\i in {1,...,3}
    {
      \symboln[\i]{n-\i-ID}[below]
      \fill (n-\i-ID) circle (\pradius);
      \symbolN[\i]{N-\i-ID}
      \fill (N-\i-ID) circle (\pradius);
    }
    \foreach\i in {1,...,4}
    {
      \symbols[\i]{s-\i-ID}[above]
      \fill (s-\i-ID) circle (\pradius);
      \symbolS[\i]{S-\i-ID}[below]
      \fill (S-\i-ID) circle (\pradius);
    }
    \draw[line width=0.2pt] (NW-ID) 
      to [bend left=60] node [fill=white, midway] {hlen} (NE-ID);
    \draw[line width=0.2pt] (NW-ID) 
      to [bend right=60] node [fill=white, midway] {vlen} (SW-ID);
    \draw [red, <->] (C-ID -| W-ID)
      -- node [midway, auto, font=\footnotesize] {0.5} (C-ID -| S-1-ID);
    \draw [red, <->] (C-ID -| S-4-ID)
      -- node [midway, auto, font=\footnotesize] {0.5} (C-ID -| E-ID);
    \qwire[arrowtype={loosely dotted}, dom={s-1-ID}, cod={n-1-ID}]
    \qwire[arrowtype={loosely dotted}, dom={s-4-ID}, cod={n-3-ID}]
    \node (O1prime) at ([shift={(0.25,0.25)}]O-1-ID){O-1-ID};
    \draw[->,red] (O1prime) to ([shift={(0.05,0.05)}]O-1-ID);
    \node (I1prime) at ([shift={(0.5,-0.5)}]I-1-ID){I-1-ID};
    \node (I2prime) at ([shift={(0.5,-0.5)}]I-2-ID) {I-2-ID};
    \draw[->,red](I1prime) to ([shift={(0.05,-0.05)}]I-1-ID);
    \draw[->,red](I2prime) to ([shift={(0.05,-0.05)}]I-2-ID);
  }
\end{CODEBOX}
The \verb|\qwire| \verb|arrowtype| key, as well as the \verb|dom| and \verb|cod| keys, are explained in section \ref{subsec:wirecustomization} on page \pageref{subsec:wirecustomization}.

\paragraph{Label (\showcmd{symbol})}
\begin{verbatim}
  \symbolI[<number>]{<label>}[<options>]
\end{verbatim}
For example, \verb|\symbolI[2]{text}[below right, id=ID]| places the label "text" at the bottom right of the second input point (I-2-ID) of \verb|\q{\qbox[p=3, id=ID]}| (\(\q[scale=0.5]{\qbox[p=3, id=ID]}\)). 
When no number or options are specified, the default values \(1\), below, and \verb|id=<previous>| are applied, respectively. 
Other label display commands include:
\begin{verbatim}
  \symbolS[<number>]{<label>}[<options>]
\end{verbatim}
\begin{verbatim}
  \symbols[<number>]{<label>}[<options>]
\end{verbatim}
\begin{verbatim}
  \symbolO[<number>]{<label>}[<options>]
\end{verbatim}
\begin{verbatim}
  \symbolN[<number>]{<label>}[<options>]
\end{verbatim}
\begin{verbatim}
  \symboln[<number>]{<label>}[<options>]
\end{verbatim}
\verb|\symbolS| and \verb|\symbols| place the label \textless label\textgreater at points (S-\(i\)-ID) and (s-\(i\)-ID), respectively. 
The default number \(i\) is \(1\), and the default option is below. 
\verb|\symbolO|, \verb|\symbolN|, and \verb|\symboln| place the label \textless label\textgreater at points (O-\(i\)-ID), (N-\(i\)-ID), and (n-\(i\)-ID), respectively. 
The default number \(i\) is \(1\), and the default option is above.
\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{}{Ex:78129738911}
  \q{
    \qbox[p=5, S={1,4,5}, id=ID]
    \symbolO{A}
    \symbolN[3]{B}
    \symboln[5]{C}[below left]
    \symbolS[2]{D}
    \symbols[3]{E}
    \symbolI[2]{F}
    \symbolI[3]{G}[below right]
  }
\end{codebox}
\begin{CODEBOX}{}{Ex:78129738910}
  \q{
    \qbox[p=10,N={1,2,5,6,9,10}, id=ID]
    \foreach\i in {1,...,10}
    {
      \symbolI[\i]{\(x_{\i}\)}
    }
    \foreach\j in {1,...,6}
    {
      \symbolO[\j]{\(y_{\j}\)}
    }
  }
\end{CODEBOX}

\subsection{Repetition}
\label{subsec:forloop}
\begin{verbatim}
  \qloop[<number of repetitions>]{<command>}
\end{verbatim}
By using the \verb|\qloop| command, you can repeat a command the specified number of times:
\begin{CODEBOX}{}{Ex:78129738905}
  \q{ \qloop[10]{\qbox} }
\end{CODEBOX}
The \verb|\qloop| command can also be used outside of \verb|\q|:
\begin{codebox}[listing side text,righthand width=5.5cm,bicolor,colbacklower=white]{}{Ex:781297389220930}
  \qloop[30]{I AM BOB}
\end{codebox}

\subsection{Displaying Identification Numbers}
\label{subsec:show id}
Commands inside \verb|\q{...}| are automatically assigned identification numbers. 
If \showcmd[]{show id=true} is specified, those identification numbers will be displayed.
\begin{CODEBOX}{}{Ex:78129738903}
  \q{
    \qbox[show id={true}] \qbox[show id={true}] \qbox[show id={true}]\n
    \qbox[show id={true}] \qbox[show id={true}] \qbox[show id={true}]
  }
\end{CODEBOX}
\begin{CODEBOX}{}{Ex:78129738902}
  \q{
    \qloop[10]
    {
      \qloop[10]
      {
        \qbox[show id={true}]
      }\n
    }\n
  }
\end{CODEBOX}

\subsection{Color}
You can specify colors for the boxes:
\begin{itemize}
  \item \showcmd[]{color}
    \iitem The color inside the box, for example, \showcmd[]{color=green} will produce \q[scale=0.75]{\qbox[color={green}]}.
  \item \showcmd[]{frame color}
    \iitem The color of the box's frame, for example, \showcmd[]{frame color=cyan} will produce \q[scale=0.75]{\qbox[frame color={cyan}]}.
  \item \showcmd[]{morphism color}
    \iitem The color of the morphisms inside the box, for example, \showcmd[]{morphism color=red} will produce \q[scale=0.75]{\qbox[morphism color={red}, name={\(f\)}]}.
\end{itemize}
\begin{CODEBOX}{}{Ex:74839759}
  \q[scale={\fpeval{pi}}]{
    \qbox
    [
      name={\textbf{Q-WORLD}},
      color=red,
      frame color={green!50!black},
      morphism color=yellow
    ]
  }
\end{CODEBOX}

\paragraph{\showcmd[]{N}, \showcmd[]{S}, Arithmetic Sequence}
\qworldname loads the \showcmd[]{pgffor} package, so the shorthand notation using \verb|...| can be used for lists:
\begin{itemize}
  \item \(1,...,10\): An arithmetic sequence with a common difference of \(1\)
  \item \(1,3,...,11\): An arithmetic sequence based on the first two terms with a common difference
\end{itemize}
\begin{CODEBOX}{}{Ex:74839758}
  \q{
    \qbox[N={1,...,10}, S={1,3,...,11}]
    }
\end{CODEBOX}
\begin{CODEBOX}{}{Ex:74839757}
  \q{
    \qbox[N={1,...,4,6,8,...,20}, S={1,...,20}, hlen=10]
  }
\end{CODEBOX}
\begin{CODEBOX}{}{Ex:74839756}
  \q{
    \qbox[N={1,...,4,7,10,...,19,20,21,...,25}, S={1,...,25}, hlen=10]
  }
\end{CODEBOX}
\subsection{Relative Coordinates}
This is a command for specifying the position of elements relative to a given point. 
Note that \(x\) and \(y\) do not have to be integers; expressions evaluable by \verb|\fpeval|, 
such as \verb|2^1.5|, \verb|cos(pi)|, and \verb|sprt(2)|, are valid.
\begin{itemize}
  \item \showcmd{qmv[\(x\),\(y\)]}
    \iitem Translates by (\(x\), \(y\)).
    \iitem The default is \(x=y=0\).
  \item \showcmd{n[\(y\)]}
    \iitem Moves vertically by \(y\) (\(Y\mapsto Y-y\)), and sets the X coordinate to \(0\).
    \iitem The default is \(y=1\) , which behaves like a line break.
  \item \showcmd{qspace[\(x\)]}
    \iitem Moves Horizontally by \(x\). 
    \iitem The default is \(x=1\), which behaves like the spacebar.
    \iitem This is equivalent to \showcmd{qmv[\(x\),0]}.
  \item \showcmd{qreset[\(x\),\(y\)]}
    \iitem Moves to the point (\(x\),\(y\)).
\end{itemize}
\[\q[scale=2.35]{
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (I) at (qworldat);
  \qbox
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (II) at (qworldat);
  \n
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (III) at (qworldat);
  \qspace
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (IV) at (qworldat);
  \qspace[0.5]
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (V) at (qworldat);
  \n[2]
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (VI) at (qworldat);
  \qmv[-2,-1]
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (VII) at (qworldat);
  \n
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (VIII) at (qworldat);
  \qspace[-3]
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (IX) at (qworldat);
  \qreset
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (X) at (qworldat);
  \qreset[-2,1]
  \fill[blue] (qworldat) circle (1pt);
  \coordinate (XI) at (qworldat); 
  \qbball
  \qwireup[dom={I}, cod={II},
          label={Auto-update}, label side={below},
          label at={midway}, color=cyan]
  \qwireup[dom={II},cod={III},
          label={\showcmd{n}},
          label side={below}, color=cyan]
  \qwireup[dom={III},cod={IV},
          label={\showcmd{qspace}},
          label side={below}, color=cyan]
  \qwireup[dom={IV},cod={V},
          label={\showcmd{qspace[0.5]}},
          label at={at end}, label side={above}, color=cyan]
  \qwireup[dom={V},cod={VI},
          label={\showcmd{n[2]}},color=cyan]
  \qwireup[dom={VI},cod={VII},
          label={\showcmd{qmv[-2,-1]}},color=cyan]
  \qwireup[dom={VII},cod={VIII},
          label={\showcmd{n}},color=cyan]
  \qwireup[dom={VIII},cod={IX},
          label={\showcmd{qspace[-3]}}, 
          label side={below},color=cyan]
  \qwireup[dom={IX},cod={X},
          label={\showcmd{qreset}},
          label side=left, color=cyan]
  \qwireup[dom={X},cod={XI},
          label={\showcmd{qreset[-2,1]}},
          label side=left, 
          label at={near start}, color=cyan]
  \draw[help lines] (-4,-6) grid (2,2);
}\]

\subsection{Absolute Coordinates}
By using the \showcmd[]{at} key, positions can be specified with absolute coordinates. 
\verb|\q{\qbox[at={2,3}]}| is equivalent to \verb|\q{\qreset[2,3]\qbox}|.
\begin{CODEBOX}{Absolute Coordinates}{Ex:74839754}
  \q{
    \coordinate (a) at (0,{\fpeval{2*sqrt(3)}});
    \qbox[at=a]
    \qbox[at={-2,0}]
    \qbox[at={2,0}]
    \fill[red] (a) circle (2pt);
    \fill[red] (-2,0) circle (2pt);
    \fill[red] (2,0) circle (2pt);
    \node[below left] at (a) {a};
    \node[below left] at (-2,0) {(-2,0)};
    \node[below left] at (2,0) {(2,0)};
  }
\end{CODEBOX}
The \TeX\ language is Turing complete\footnote{For example, the ability to simulate a Turing machine is demonstrated in the example from LiteratePrograms\cite{literateprograms}. Additionally, an article on Overleaf introduces a method to compute Fibonacci numbers using \TeX, illustrating the  practical utility of its Turing completeness \cite{overleaf}}. 
In other words, every algorithm that exists in the world can be expressed in \TeX. 
Physical simulations (such as weather forecasting or chemical reaction prediction), 
economic simulations (such as investment strategies), 
and even artificial intelligence learning algorithms (such as image recognition or natural language processing)------\par
all of these can be implemented in \TeX.\par
However, how many people would actually want to do that? 
I for one, wouldn't want to write even a sorting algorithm in \TeX. 
That's like trying to create Super Mario in spreadsheet.\par
However, there is a twist.\par
I had a ``revelation''\footnote{Original source: On January 20,  2011, an algorithm called "Sleep Sort" was posted on the anonymous message board 4chan \cite{geniussorting, gfxhatena}. This algorithm uses a \showcmd[]{Bash} script to execute each input value as a thread asynchronously, sorting the list by the timing of each thread’s completion (the specified "sleep" time).}.
And with the \showcmd[]{at} key, I created a sorting algorithm.
\begin{codebox}{}{Ex:genius}
  \newcommand{\AtSort}[1][1]{
    \q{
      \foreach \i in {#1}
      {
        \qbox[name={\i}, at={0, -\i}]\n
      }
    }
  }
  \AtSort[4,1,3,-1,6,2]
\end{codebox}
It works. Indeed, it works.\par
But there is one problem.
\textbf{If the list contains elements with large absolute values, the output will overflow the page}.
\subsection{Wire Customization}
\label{subsec:wirecustomization}
\[
  \q{
    \def\maxi{11}
    \foreach \i in {0,...,\maxi}
    {
        \qwireup[dom={0,0}, cod={{\fpeval{\i*360/(\maxi+1)}}:3}]
        \node at ({\fpeval{\i*360/(\maxi+1)}}:3.6) {\showcmd[]{cod}\i};
    }
  }
\]
Among the keys of the box \(\q[scale=0.5]{\qbox}\) introduced in section \ref{subsec:boxcustomization}, \showcmd[]{id} and \showcmd[]{vlen} are also valid for wires. 
The basic keys specific to wires are as follows:
\begin{itemize}
  \item \showcmd[]{dom}: input point. 
  \item \showcmd[]{cod}: output point.
    \iitem Default value is the position obtained by moving \showcmd[]{dom} \(1\) unit vertically to the north.
  \item \showcmd[]{label}: Label for the wire. 
  \item \showcmd[]{label at}: Position of the label on the wire.
    \iitem The default is midway.
  \item \showcmd[]{label side}: Relationship between the label and the wire.
    \iitem The default is right.
\end{itemize}
\begin{codebox}{}{ex:781297389260951}
  \q{
    \qbox[n=3,hlen=1.5]
    \qbox[at={1,2}, s=2, hlen=1.5]
    \qbox[at={-1,4}, s=2, hlen=1.5]
    \qwire[dom={N-1-1}, cod={S-1-3}]
    \qwire[dom={N-2-1}, cod={S-1-2}]
    \qwire[dom={N-3-1}, cod={S-2-2}]
    \qwire[dom={N-1-2}, cod={S-2-3}]
  }
\end{codebox}
\begin{CODEBOX}{}{ex:193477432894112213}
  \q{
    \def\maxi{11}
    \foreach \i in {0,...,\maxi}
    {
        \qwireup[dom={0,0}, cod={{\fpeval{\i*360/(\maxi+1)}}:2}]
        \node at ({\fpeval{\i*360/(\maxi+1)}}:2.5) {\texttt{cod} \i};
    }
  }
\end{CODEBOX}
The bounding box of the wire \q[scale=0.6]{\qwire} is the same as that of \q[scale=0.5]{\qbox}:
\begin{codebox}{}{ex:781297389220926}
  \q{
    \qwire\qbox\qwire\n
    \qbox\qwire\qbox
    \qbball
  }
\end{codebox}
The bounding box of the wire matches that of a box with \showcmd[]{dom} as the input point and \showcmd[]{cod} as the output point:
\begin{itemize}
  \item \(\q[scale=0.5]{\qwire}\) and \(\q[scale=0.5]{\qbox}\)
  \item \(\q[scale=0.5]{\qwire[dom={0,0},cod={1,1}]}\) and \(\q[scale=0.5]{\qbox[p=2,S={1},N={2}]}\)
\end{itemize}

\begin{CODEBOX}{}{Ex:78129738909}
  \q[scale=3]{
    \coordinate (A) at (0,0);
    \coordinate (B) at (2,3);
    \qwire[dom=A, cod={1,1}, label={wire1}, label side={left}]
    \qwire[dom={1,1}, cod=B, label={wire2}, label at={near end}]
    \node[fill=red, circle] at (A) {A};
    \node[fill=green, circle] at (B) {B};
    \node[fill=yellow, circle] at (1,1) {(1,1)};
    \qbball
  }
\end{CODEBOX}

\begin{CODEBOX}{}{Ex:78129738901}
  \q{
    \qloop[5]{
      \qloop[10]{
        \qbox[show id={true}]
      }\n
    }\n
    \qspace[3]\qbox[s=2,show id={true},id={ego1}]\n\n
    \qspace[6]\qbox[n=2,show id={true},id={ego2}]\n\n
    \qloop[5]{
      \qloop[10]{
        \qbox[show id={true}]
      }\n
    }
    \qwire[dom={O-1-55},cod={I-1-51}]
    \qwire[dom={O-1-60},cod={I-1-52}]
    \qwire[dom={O-1-51},cod={I-1-45}]
    \qwire[dom={O-1-52},cod={I-2-51}]
    \qwire[dom={O-2-52},cod={I-1-48}]
  }
\end{CODEBOX}

\paragraph{arrowtype}
The wire style is specified using the \showcmd[]{arrowtype} key.
\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{}{wirearrowtype}
  \q{
    \qwire[arrowtype=dotted]
    \qwire[arrowtype=dashed]
    \qwire[arrowtype={dash dot}]
    \qwire[arrowtype={dash dot dot}]
    \qwire[arrowtype={densely dotted}]
    \qwire[arrowtype={loosely dotted}]
  }
\end{codebox}

\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{}{boxarrowtype}
  \q{
    \qbox[dom arrowtype={dotted}]
    \qbox[cod arrowtype={dotted}]
    \qbox[arrowtype={dotted}]
  }
\end{codebox}

\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{}{spiderarrowtype}
  \q{
    \qspider[dom arrowtype={dotted}]
    \qspider[cod arrowtype={dotted}]
    \qspider[arrowtype={dotted}]
  }
\end{codebox}

\subsection{Canvas}
\begin{verbatim}
  \q[option]
  {
    command 1
    command 2
    ...
  }
\end{verbatim}
The entire diagram can be transformed useing canvas options.
\begin{codebox}{}{Ex:74839753}
  \q[scale=2,rotate=30]{\qbox}
\end{codebox}
It is also possible to \textbf{slant} the canvas.
\begin{CODEBOX}{}{Ex:74839752}
  \def\anglerot{-55}
  \tikzset
  {
    my slant style/.style={
      yslant=-cot(\anglerot), 
      xscale=sin(-\anglerot)
      }
  }
  \q[my slant style]
  {
    \qcaprev\qcap\n
    \qwire\qbraidinv\qwiredown\n
    \qwiredown\qbraidinv\qwire\n
    \qcup\qcuprev
    \qBBall
  }
\end{CODEBOX}
\begin{CODEBOX}{}{Ex:74839751}
  \def\anglerot{-60}
  \tikzset
  {
    my slant style/.style={
      yslant=-cot(\anglerot), 
      xscale=sin(-\anglerot)
    }
  }
  \[
    \q[my slant style]{
      \qbraid\qwire\n
      \qwire\qbraid\n
      \qbraid\qwire
    }=\q[my slant style]{
      \qbraid\qwire\n
      \qwire\qwire\qwire\n
      \qbraid[num R=2]
      \qbb[red][1]
      \qbb[cyan][6]
    }=\q[my slant style]{
      \qbraid[ num R=2]\n
      \qwire\qwire\qwire\n
      \qwire\qbraid
      \qbb[red][6]
      \qbb[cyan][1]
    }=\q[my slant style]{
      \qwire\qbraid\n
      \qbraid\qwire\n
      \qwire\qbraid
    }
  \]
\end{CODEBOX}

\section{Monoidal Categories and \qworldname}
In this section, we explore how to typeset graphical calculus using the \qworldname package, examining its different applications and practical usage.\par
While \qworldname can handle diagrams independently, it is often beneficial to combine it with packages like \showcmd[]{amsmath}, \showcmd[]{amssymb}, and \showcmd[]{mathtools} for more flexible mathematical expressions. 
This section demonstrates how to typeset actual graphical calculus in \TeX\ while introducing the functionalities of \qworldname.\par
To reproduce the examples in this section, please ensure that the following packages are loaded:
\begin{verbatim}
  \usepackage{amsmath, amssymb, mathtools}
  \usepackage{qworld}
\end{verbatim}
\subsection{Category}
\begin{codebox}{Domain}{ex:dom2}
  \[
    \operatorname{dom}\left(
      \q{
        \qbox[name={\(f\)}]
        \symbolI{\(x\)}
        \symbolO{\(y\)}
      }
    \right)=\q{\qwire[label={\(x\)}]}
  \]
\end{codebox}
\begin{codebox}{Codomain}{ex:cod2}
  \[
    \operatorname{cod}\left(
      \q{
        \qbox[name={\(f\)}]
        \symbolI{\(x\)}
        \symbolO{\(y\)}
      }
    \right)=\q{\qwire[label={\(y\)}]}
  \]
\end{codebox}

\begin{codebox}{(Vertical) Compositon}{def:composite}
  \[
    \q{
      \qbox[name={\(f\)}]\qcirc\qbox[name={\(g\)}]
    }=\q{\qbox[name={\(f\circ g\)}]}
  \]
\end{codebox}
\begin{CODEBOX}{Associativity}{Ex:74839750}
  \[
    \forall\q{\qbox[name={\(h\)}] \symbolI{\(z\)} \symbolO{\(w\)}}
    \forall\q{\qbox[name={\(g\)}] \symbolI{\(y\)} \symbolO{\(z\)}}
    \forall\q{\qbox[name={\(f\)}] \symbolI{\(x\)} \symbolO{\(y\)}}
    \q{
        \qbox[name={\(h\)}]\qcirc\qbox[name={\(g\)}]\qcirc\qbox[name={\(f\)}]
        \qbb[2,3]
    }
    =
    \q{
        \qbox[name={\(h\)}]\qcirc\qbox[name={\(g\)}]\qcirc\qbox[name={\(f\)}]
        \qbb[1,2]
    }
  \]
\end{CODEBOX}
\begin{CODEBOX}{Identity Law}{IdentityLaw}
  \begin{equation}
    \label{law:identity}
    \forall\q
    {
      \qbox[name={\(f\)}]
      \symbolS{\(x\)}
      \symbolN{\(y\)}
    }\colon
    \q{
      \qwire[label={\(y\)}]\n
      \qbox[name={\(f\)}]
    }=\q{
      \qbox[name={\(f\)}]
    }=\q{
      \qbox[name={\(f\)}]\n
      \qwire[label={\(x\)}]
    }
  \end{equation}
\end{CODEBOX}
\subsubsection{Object Information and Color}
\label{subsubsec:objectcolor}
In categorical string diagrammatics, identity morphism are typically represented as simple wires. 
To make it visually evident which object an identity morphism corresponds to, a method has been introduced that assigns a \textbf{distinct color to each object}. 
This allows object information to be encoded directly on the wire, providing intuitive visual cues for distinguishing between objects-especially in diagrams composed entirely of curved structures.
\par
The theoretical foundation of this approach lies in the categorical fact that \textbf{every morphism has a uniquely defined domain and codomain object}. 
Since this structure is intrinsic to any category, representing objects diagrammatically via the visual attribute of ``color'' is fully justified.
\par
In diagrams involving braidings (see Section \ref{subsubsec:braid:color}, page \pageref{subsubsec:braid:color}) or duality structures (see Section \ref{subsubsec:duality:color}, page \pageref{subsubsec:duality:color}), 
color serves as an effective aid in supporting accurate interpretation.
\par
From this perspective, an object may be regarded as something that manifests as a color decorating a wire. 
The following example illustrates how the domain and codomain colors of morphisms contribute to visually validating the composability of morphisms:
\begin{CODEBOX}[bicolor,colbacklower=white]{}{objectcolor}
  \(\operatorname{dom}\) is a function that identifies the domain color 
  \(\q{\qwire[color=red]}\) 
  of the morphism 
  \(\q{\qbox[name={\(f\)}, dom color=red, cod color=cyan]}\), 
  and \(\operatorname{cod}\) similarly identifies the codomain color 
  \(\q{\qwire[color=cyan]}\).\par
  On the page, the codomain color of 
  \(\q{\qbox[name={\(f\)}, dom color=purple, cod color=teal]}\) 
  and the domain color of 
  \(\q{\qbox[name={\(g\)}, dom color=teal, cod color=orange]}\) 
  are explicitly shown to be the same via color matching. 
  Only when this condition holds is the vertical composition
  \[
    \q{
      \qbox[name={\(g\)}, dom color=teal, cod color=orange]
      \n
      \qbox[name={\(f\)}, dom color=purple, cod color=teal]
    }
  \]
  accepted as a type-consistent operation.
\end{CODEBOX}
\subsection{Monoidal Category}
\begin{CODEBOX}{Tensor Product, Horizontal (Parallel) Compositon}{monoidalproduct}
  \[
    \q
    {
      \qbox[name={\(f\)}] \qbox[name={\(g\)}]
      \symbolO{\(Y_1\)}[id=1] \symbolO{\(Y_2\)}
      \symbolI{\(X_1\)}[id=1] \symbolI{\(X_2\)}
    }
    =\q
    {
      \qbox[name={\(f\otimes g\)}, p=2]
      \symbolO{\(Y_1\)} \symbolO[2]{\(Y_2\)}
      \symbolI{\(X_1\)} \symbolI[2]{\(X_2\)}
    }
    =\q
    {
      \qbox[name={\(f\otimes g\)}]
      \symbolO{\(Y_1\otimes Y_2\)}
      \symbolI{\(X_1\otimes X_2\)}
    }
  \]
\end{CODEBOX}
\subsubsection{Interchange Law}
\begin{CODEBOX}{Interchange Law (Covariant Functoriality of \(\bigotimes\))}{InterchangeLaw}
  \begin{equation}
    \label{law:interchange}
    \q
    {
      \qbox[name={\(f_2\)}]\qbox[name={\(g_2\)}]\n
      \qbox[name={\(f_1\)}]\qbox[name={\(g_1\)}]
      \qbb[1,2]
      \qbb[3,4]
    }
    =\q
    {
      \qbox[name={\(f_2\)}]\qbox[name={\(g_2\)}]\n
      \qbox[name={\(f_1\)}]\qbox[name={\(g_1\)}]
      \qbb[2,4]
      \qbb[1,3]
    }
  \end{equation}
\end{CODEBOX}

\begin{CODEBOX}{Unit Object}{Ex:74839744}
  \begin{gather}
    \q{ \qwire[arrowtype=dotted]}
    =\q{ \qunitob \qbball }\\
    \q{ \qunitob \qbox[name={\(f\)}] \qbball }
    =\q{ \qbox[name={\(f\)}] }
    =\q{ \qbox[name={\(f\)}] \qunitob \qbball }\label{cond:unitob}
  \end{gather}
\end{CODEBOX}
\begin{CODEBOX}{}{Ex:74839743}
  \[
    \q{\qunitob\qbball}
    =\q{\qloop[2]{\qunitob}\qbball}
    =\q{\qloop[3]{\qunitob}\qbball}
    =\cdots
  \]
\end{CODEBOX}

\subsection{Special Boxes}

\begin{itemize}
  \item \showcmd{qstate}: \(\q[scale=0.5]{\qstate}\) (Zero Input).
  \item \showcmd{qeffect}: \(\q[scale=0.5]{\qeffect}\) (Zero Output).
  \item \showcmd{qscalar}: \(\q[scale=0.5]{\qscalar}\) (Zero Input, Zero Output).
  \item \showcmd{qasym}: \(\q[scale=0.5]{\qasym}\) (Asymmetric Box). 
  \item \showcmd{qtrans}: \(\q[scale=0.5]{\qtrans}\) (Transpose Box). Section \ref{subsubsec:transpose} on page \pageref{subsubsec:transpose}.
  \item \showcmd{qadj}: \(\q[scale=0.5]{\qadj}\) (Adjoint Box). Section \ref{subsubsec:adjoint} on page \pageref{subsubsec:adjoint}.
  \item \showcmd{qconj}: \(\q[scale=0.5]{\qconj}\) (Conjugate Box). Section \ref{subsubsec:conj} on page \pageref{subsubsec:conj}.
\end{itemize}
\subsubsection{Zero Input}
\label{subsubsec:zeroinput}
\begin{codebox}{}{def:state}
  \q{\qstate}
\end{codebox}
\subsubsection{Zero Output}
\label{subsubsec:zerooutput}
\begin{codebox}{}{def:effect}
  \q{\qeffect}
\end{codebox}
\subsubsection{Zero Input, Zero Output}
\label{subsubsec:zeroinputoutput}
\begin{codebox}{}{def:scalar}
  \q{\qscalar}
\end{codebox}
\paragraph{\(\q[scale=0.4]{\qeffect\qstate\qwire[dom={O-1-2}, cod={1,2}]\qwire[dom={1,-1}, cod={I-1-1}]}=\q[scale=0.4]{\qwire[vlen=0.5]\n\qstate\n\qeffect\n[0.5]\qwire[vlen=0.5]}=\q[scale=0.4]{\qstate\qeffect\qwire[dom={O-1-1}, cod={1,2}]\qwire[dom={1,-1}, cod={I-1-2}]}\)}
\begin{CODEBOX}{}{coherence:unitor}
  \[
    \q{
      \qeffect\qstate
      \qwire[dom={O-1-2}, cod={1,2}]
      \qwire[dom={1,-1}, cod={I-1-1}]
    }=\q{
      \qwire[arrowtype=dotted]\qwire\n
      \qeffect\qstate\n
      \qwire\qwire[arrowtype=dotted]
    }\stackrel{\text{(\ref{law:interchange}, \ref{law:identity})}}{=}\q{
      \qwire[arrowtype=dotted]\qstate\n
      \qeffect\qwire[arrowtype=dotted]
    }\stackrel{\text{(\ref{law:interchange}, \ref{cond:unitob})}}{=}\q{\qstate\n\qeffect}
  \]
\end{CODEBOX}
\begin{CODEBOX}{Matrix Representation}{matrixrepre}
  \begin{align*}
    \q{\qbox[name={\(f\)}]}
    &=\sum\limits_{i,j}
    \left(
      \q{
        \qeffect[name={\(w_j^{\dagger}\)}]\n
        \qbox[name={\(f\)}]\n
        \qstate[name={\(v_i\)}]\n
      }\q{
        \qstate[name={\(w_j\)}]\n
        \qeffect[name={\(v_i^{\dagger}\)}]
      }
    \right)
    =\sum\limits_{i,j}\left(
      \q{
        \qscalar[name={\(w_j^{\dagger}\circ f\circ v_i\)}]
      }
      \q{
        \qstate[name={\(w_j\)}]\n
        \qeffect[name={\(v_i^{\dagger}\)}]
      }
    \right)\\
    &=\begin{pmatrix}
      \q{\qscalar[name={\(w_1^{\dagger}\circ f\circ v_1\)}]}&&\cdots&&\q{\qscalar[name={\(w_1^{\dagger}\circ f\circ v_{m}\)}]}\\
      &\ddots&&&\\        
      \vdots& &\q{\qscalar[name={\(w_j^{\dagger}\circ f\circ v_i\)}]}& &\vdots\\
      &&&\ddots&\\
      \q{\qscalar[name={\(w_n^{\dagger}\circ f\circ v_1\)}]}&&\cdots&&\q{\qscalar[name={\(w_n^{\dagger}\circ f\circ v_m\)}]}
    \end{pmatrix}
  \end{align*}
\end{CODEBOX}

\subsection{Monoid Object}
\label{subsec:monoid}
\begin{itemize}
  \item \showcmd{qmul}: \(\q[scale=0.5]{\qmul}\)
    \iitem \showcmd[]{hlen=2}: \(\q[scale=0.5]{\qmul[hlen=2]}\)
  \item \showcmd{qcomul}: \(\q[scale=0.5]{\qcomul}\)
    \iitem \showcmd[]{hlen=2}: \(\q[scale=0.5]{\qcomul[hlen=2]}\)
  \item \showcmd{qunit}: \(\q[scale=0.5]{\qunit}\)
  \item \showcmd{qcounit}: \(\q[scale=0.5]{\qcounit}\)
  \item \showcmd{qspider}: \(\q[scale=0.5]{\qspider}\)
\end{itemize}

\begin{CODEBOX}{Associativity}{AssociateLaw}
  \begin{equation}
    \label{law:associate}
    \q{
      \qspace[0.5]\qmul[hlen=2]\n
      \qmul[hlen=2]\qspace[-0.5]\qwire
    }=\q{
      \qmul[hlen=2]\n
      \qwire\qspace[-0.5]\qmul[hlen=2]
    }
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{Unitality}{UnitLaw}
  \begin{equation}
  \label{law:unit}
  \q{
    \qmul[hlen=2]\n
    \qwire\qunit
  }=\q{\qwire[vlen=2]}
  =\q{
    \qmul[hlen=2]\n
    \qunit\qwire
  }
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{Coassociativity}{CoassociateLaw}
  \begin{equation}
  \label{law:coassociate}
  \q{
    \qcomul[hlen=2]\qspace[-0.5]\qwire\n
    \qspace[0.5]\qcomul[hlen=2]
  }
  =\q{
    \qwire\qspace[-0.5]\qcomul[hlen=2]\n
    \qcomul[hlen=2]
  }
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{Counitality}{CounitLaw}
  \begin{equation}
  \label{law:counit}
  \q{
      \qcounit\qwire\n
      \qcomul[hlen=2]
      }
  =\q{\qwire[vlen=2]}
  =\q{
      \qwire\qcounit\n
      \qcomul[hlen=2]
  }
  \end{equation}
\end{CODEBOX}

\subsubsection{Frobenius Law}
\begin{FCODEBOX}{Frobenius Law}{FrobeniusLaw}
  \[
    \q{
      \qwire\qmul[color=black]\n
      \qcomul\qwire
    }=\q{
      \qcomul\n
      \qmul[color=black]
    }=\q{
      \qmul[color=black]\qwire\n
      \qwire\qcomul
    }
  \]
\end{FCODEBOX}
Although it is mentioned as a ``Failure Example'', in reality, the Frobenius law is accurately described. 
Rather, since the spacing between all the wires is maintained as integer values, adjustment during vertical composition becomes easier, and in some cases, no adjustment may be necessary. 
This is merely a matter of preference. 
The default drawing results of \verb|\qmul| and \verb|\qcomul|, which are \q[scale=0.5]{\qmul} and \q[scale=0.5]{\qcomul}, are remnants of the default drawing results of \verb|\qbox[s=2]| and \verb|\qbox[n=2]|, which are \q[scale=0.5]{\qbox[s=2]} and \q[scale=0.5]{\qbox[n=2]}. 
For adjustments in such cases, the adjustment key \verb|hlen| is available:
\begin{CODEBOX}{Frobenius Law}{FrobeniusLaw2}
  \[
    \q{
      \qwire\qmul[hlen=2,color=black]\n
      \qcomul[hlen=2]\qwire
    }=\q{
      \qcomul[hlen=2]\n
      \qmul[hlen=2,color=black]
    }=\q{
      \qmul[hlen=2,color=black]\qwire\n
      \qwire\qcomul[hlen=2]
    }
  \]
\end{CODEBOX}
The command \verb|\qspider| is the same as \verb|\qbox|, except that the nodes are circles rather than boxes.
\begin{codebox}{}{spider781297389240521}
  \[\q{\qspider}\]
  \[\q{\qspider[n=0]}\]
  \[\q{\qspider[n=0,s=4]}\]
  \[\q{\qspider[n=2,s=4]}\]
  \[\q{\qspider[N={1,4},s=4]}\]
  \[\q{\qspider[N={2,3},s=4]}\]
  \[\q{\qspider[p=3,N={2},S={1,3}]}\]
  \[\q{\qspider[p=3,N={2},S={1,3},hlen=2]}\]
  \[\q{\qspider[n=1,s=2,hlen=2]}\]
\end{codebox}

\begin{CODEBOX}{}{spider781297389270738}
  \[
    \q{
      \qspider[n=2, s=4, hlen=4]\qwire\qwire\n
      \qwire\qwire\qspider[n=4, s=2, hlen=4]
    }=\q{\qspider[p=4]}\]
\end{CODEBOX}

\subsection{Braiding}
\label{subsec:braidedcategory}
\begin{itemize}
  \item \showcmd{qbraid}: \(\q[scale=0.5]{\qbraid}\)
  \item \showcmd{qbraidinv}: \(\q[scale=0.5]{\qbraidinv}\)
  \item \showcmd{qsym}: \(\q[scale=0.5]{\qsym}\)
\end{itemize}

\paragraph{\showcmd[]{num L} and \showcmd[]{num R}}

For the commands \verb|\qbraid|, \verb|\qbraidinv|, and \verb|\qsym|, \showcmd[]{num L} specifies the number of wires on the left side, and \showcmd[]{num R} specifies the number of wires on the right side. 
For example, specifies \showcmd[]{num L=3} and \showcmd[]{num R=2} will result in the diagram \q{\qbraid[num L=3, num R=2]}. 
The default value for both is \(1\).

\begin{CODEBOX}{Hexagon Equations}{hexagon}
  \begin{equation}
  \label{eq:hexagon}
  \q
  {
    \qbraid[num R=2,,hlen=2,vlen=2]
  }=\q
  {
    \qwire\qbraid\n
    \qbraid\qwire
  }
  \qquad
  \q
  {
    \qbraid[num L=2,,hlen=2,vlen=2]
  }
  =\q
  {
    \qbraid\qwire\n
    \qwire\qbraid
  }
  \end{equation}
\end{CODEBOX}
\paragraph{\({\q[scale=0.5]{\qbraid}}^{-1}=\q[scale=0.5]{\qbraidinv}\)}
\begin{CODEBOX}{}{braidisom2}
  \begin{equation}
  \label{eq:inverse:braid}
  \q
  {
    \qbraidinv\n
    \qbraid
  }
  =\q
  {
    \qwire[vlen=2]\qwire[vlen=2]
  }
  \qquad
  \q
  {
    \qbraid\n
    \qbraidinv
  }
  =\q
  {
    \qwire[vlen=2]\qwire[vlen=2]
  }
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{Naturality of the Braid (Being a Natural Transformation)}{braidnatural}
  \begin{equation}
  \label{cond:naturality:braid}
  \q
  {
    \qbraid\n
    \qbox[name={\(f\)}]\qbox[name={\(g\)}]
  }
  =\q
  {
    \qbox[name={\(g\)}]\qbox[name={\(f\)}]\n
    \qbraid
  }
  \qquad
  \q
  {
    \qbraidinv\n
    \qbox[name={\(f\)}]\qbox[name={\(g\)}]
  }
  =\q
  {
    \qbox[name={\(g\)}]\qbox[name={\(f\)}]\n
    \qbraidinv
  }
  \end{equation}
\end{CODEBOX}

For the commands \verb|\qbraid|, \verb|\qbraidinv|, and \verb|\qasym|, specifying \showcmd[]{num R=0} results in a dashed line for the right wire, as shown in \q[scale=0.65]{\qbraid[num R=0]}. 
Similarly, specifying \showcmd[]{num L=0} results in a dashed line for the left wire, as shown in \q[scale=0.65]{\qbraid[num L=0]}. 
This is due to representing the unit object as an empty diagrams, i.e., a diagram with \(0\) wires.
\begin{CODEBOX}{}{stateeffect3dimbraid}
  \begin{gather}
  \q{
    \qwire\qstate\n
    \qwire
  }
  =\q{
    \qwire\qstate\n
    \qbraid[num L=0]
  }\stackrel{\text{(\ref{cond:naturality:braid})}}{=}\q{
    \qbraid\n
    \qstate\qwire
  }\label{iso:u:state}\\
  \q{
    \qunitob\qwire\n
    \qeffect\qwire
  }
  =\q{
    \qbraid[num L=0]\n
    \qeffect\qwire
  }\stackrel{\text{(\ref{cond:naturality:braid})}}{=}\q{
    \qwire\qeffect\n
    \qbraid
  }\label{iso:u:effect}
  \end{gather}
\end{CODEBOX}
\begin{CODEBOX}{}{iso:spatial:scalar}
  \begin{equation}
  \label{iso:spatial}
  \q{\qscalar\qmv[0,-1]\qwire[vlen=3]}
  =\q{\qbraid[num L=0]\n\qscalar\qmv[0,-1]\qwire[vlen=2]}
  \stackrel{\text{(\ref{cond:naturality:braid})}}{=}
  \q{\qwire[vlen=2]\qscalar\n\qbraid[num L=0]}
  =\q{\qscalar\qmv[-2,-1]\qwire[vlen=3]}
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{}{iso:spatial:state.effect}
  \[
    \q{\qscalar\qmv[0,-1]\qwire[vlen=3]}
    =\q{\qeffect\n\qstate\qmv[0,-0.5]\qwire[vlen=3]}
    \stackrel{\text{(\ref{iso:u:effect})}}{=}
    \q{\qwire\qeffect\n\qbraid\n\qstate\qwire}
    \stackrel{\text{(\ref{iso:u:state})}}{=}
    \q{\qeffect\n\qstate\qmv[-2,-0.5]\qwire[vlen=3]}
    =\q{\qscalar\qmv[-2,-1]\qwire[vlen=3]}
  \]
\end{CODEBOX}
\paragraph{\(\q[scale=0.5]{\qbraid\qwire\n\qwire\qstate[n=2]}=\q[scale=0.5]{\qwire\qbraidinv\n\qstate[n=2]\qwire}\)}
\begin{CODEBOX}{}{dashedbraid}
  \begin{align}
  \q
  {
    \qbraid\qwire\n
    \qwire\qstate[n=2]
  }&=\q
  {
    \qbraid\qwire\n
    \qwire\qstate[n=2]\n\n
    \qbraidinv[num L=0,vlen=2,hlen=2.5]
  }
  \stackrel{\text{(\ref{cond:naturality:braid})}}{=}\q
  {
    \qbraid\qwire\n\n
    \qbraidinv[num L=2,vlen=2]\n
    \qstate[n=2]\qwire\n
    \qspace[0.5]\qwire[arrowtype={densely dotted}]\qspace[0.5]\qwire
  }\\
  &=\q
  {
    \qbraid\qwire\n\n
    \qbraidinv[num L=2,vlen=2]\n
    \qstate[n=2]\qwire\n
    \qspace[2]\qwire
    \qbb[green][3]
  }\stackrel{\text{(\ref{eq:hexagon})}}{=}\q
  {
    \qbraid\qwire\n
    \qbraidinv\qwire\n
    \qwire\qbraidinv\n
    \qstate[n=2]\qwire\n
    \qspace[2]\qwire
    \qbb[green][3,...,6]
  }\\
  &=\q
  {
    \qbraid\qwire\n
    \qbraidinv\qwire\n
    \qwire\qbraidinv\n
    \qstate[n=2]\qwire\n
    \qspace[2]\qwire
    \qbb[orange][1,3]
  }
  \stackrel{\text{(\ref{eq:inverse:braid})}}{=}\q
  {
    \qloop[2]{\qloop[3]{\qwire}\n}
    \qwire\qbraidinv\n
    \qstate[n=2]\qwire\n
    \qspace[2]\qwire
    \qbb[orange][1,2,4,5]
  }
  \end{align}
\end{CODEBOX}

\begin{CODEBOX}{Yang-Baxer Equation}{YangBaxer}
  \[
    \q{
      \qbraid\qwire\n
      \qwire\qbraid\n
      \qbraid\qwire
    }=\q{
      \qwire\qbraid\n
      \qbraid\qwire\n
      \qwire\qbraid
    }
  \]
\end{CODEBOX}

\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{Commutativity}{def:cmt}
  \begin{equation}
  \label{cond:cmt}
  \q{\qmul[hlen=2]}=\q{\qmul[hlen=2]\n\qbraid}
  \end{equation}
\end{codebox}
\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{Cocommutativity}{def:ccmt}
  \begin{equation}
  \label{cond:ccmt}
  \q{\qcomul[hlen=2]}=\q{\qbraid\n\qcomul[hlen=2]}
  \end{equation}
\end{codebox}
\subsubsection{Bialgebra}
\begin{CODEBOX}{Bialgebra Law}{law:bialgebra}
  \begin{gather}
  \q{\qcomul[hlen=2]\qcirc\qmul[hlen=2, color=black]}
  =\q{
  \qmul[hlen=2, color=black]\qmul[hlen=2, color=black]\n
  \qwire\qbraid\qwire\n\qcomul[hlen=2]\qcomul[hlen=2]
  }\\
  \q{\qspace[0.5]\qcounit\qcirc\qmul[hlen=2, color=black]}
  =\q{\qcounit\qcounit}\\
  \q{\qcomul[hlen=2]\qcirc\qspace[0.5]\qunit[color=black]}
  =\q{\qunit[color=black]\qunit[color=black]}\\
  \q{\qcounit\n\qunit[color=black]}
  =\q{\qunitob}
  \end{gather}
\end{CODEBOX}
\subsubsection{Hopf Algebra}
\begin{CODEBOX}{Antipode and Hopf Algebra}{law:hopf}
  \begin{equation}
  \q{
    \qmul[hlen=2, color=black]\n
    \qwire\qbox[name={\(s\)}]\n
    \qcomul[hlen=2]
  }
  =\q{\qunit[color=black]\qcirc\qcounit}
  =\q{
    \qmul[hlen=2, color=black]\n
    \qbox[name={\(s\)}]\qwire\n
    \qcomul[hlen=2]
  }
  \end{equation}
\end{CODEBOX}
\subsubsection{Balanced Structure}
\label{subsubsec:balancedcategory}
\begin{CODEBOX}{Twist}{def:twist}
  \begin{gather}
  \q{
    \qbox[name={\(\theta_{X\otimes Y}\)}, p=2]
    \symbolI{\(X\)}\symbolI[2]{\(Y\)}
    \symbolO{\(X\)}\symbolO[2]{\(Y\)}
  }
  =\q{
    \qbox[name={\(\theta_X\)}]\qbox[name={\(\theta_Y\)}]\n
    \qbraid\n\qbraid
  }\label{cond:twist}\\
  \q{\qbox[name={\(\theta_I\)}]}=\q{\qunitob}\label{cond:i:twist}\\
  \forall\q{\qbox[name={\(f\)}]}\colon
  \q{
    \qbox[name={\(\theta_{\operatorname{cod}(f)}\)}, hlen=1.5]\n
    \qbox[name={\(f\)}, hlen=1.5]
  }=\q{
    \qbox[name={\(f\)}, hlen=1.5]\n
    \qbox[name={\(\theta_{\operatorname{dom}(f)}\)}, hlen=1.5]
  }\label{cond:naturality:twist}
  \end{gather}
\end{CODEBOX}
\subsubsection{Color}
\label{subsubsec:braid:color}
\begin{codebox}[center lower,listing side text,righthand width=5cm,bicolor,colbacklower=white]{Symmetry}{defeq:sym}
  \begin{equation}
    \label{cond:symmetry}
    \q
    {
      \qbraid[L color=cyan, R color=red]\n
      \qbraid[L color=red, R color=cyan]
    }
    =\q{\qwire[color=red, vlen=2]\qwire[color=cyan, vlen=2]}
  \end{equation}
\end{codebox}

\begin{CODEBOX}{}{wowsym}
  \[\q{\qbraid[L color=red, R color=cyan]}
  =\left(\q{\qbraid[L color=cyan, R color=red]}\right)^{-1}
  =\q{\qbraidinv[L color=red, R color=cyan]}\]
\end{CODEBOX}
\begin{codebox}{Symmetry}{def:sym}
  \q{\qsym}
\end{codebox}

\subsection{Duality}
\label{subsubsec:duality}
\begin{itemize}
  \item \showcmd{qcap}: \(\q[scale=0.6]{\qcap}\)
  \item \showcmd{qcup}: \(\q[scale=0.6]{\qcup}\)
  \item \showcmd{qcaprev}: \(\q[scale=0.6]{\qcaprev}\)
  \item \showcmd{qcuprev}: \(\q[scale=0.6]{\qcuprev}\)
\end{itemize}

\begin{CODEBOX}{Snake Equations}{Snake}
  \begin{equation}
  \label{eq:snake}
  \q{
    \qcap\qwireup\n
    \qwireup\qcup
  }
  =\q{
    \qwireup[vlen=2]
  }
  \qquad\land\qquad
  \q{
    \qwiredown\qcap\n
    \qcup\qwiredown
  }
  =\q{
    \qwiredown[vlen=2]
  }
  \end{equation}        
\end{CODEBOX}

\subsubsection{Transpose Box}
\label{subsubsec:transpose}
\begin{CODEBOX}{Transpose}{Transpose}
  \[
    \left(\q{\qwire\n\qasym[name={\(f\)}]\n\qwire}\right)^T
    =\q{
      \qwire\n
      \qtrans[name={\(f\)}]\n
      \qwire
    }\coloneq\q{
      \qwire\qcap\n
      \qwire\qasym[name={\(f\)}]\qwire\n
      \qcup\qwire
    }
  \]
\end{CODEBOX}

\begin{CODEBOX}{}{ex:193477432894021826}
  \begin{equation}
  \label{eq:wirerev}
  \left(\q{\qwireup}\right)^T=\q{\qwiredown}
  \end{equation}
\end{CODEBOX}

\begin{CODEBOX}{Sliding}{Sliding}
  \begin{equation}
  \label{eq:sliding}
  \q{
    \qcap \n
    \qasym \qwire
  }
  =\q
  {
    \qcap \n
    \qwire \qtrans
  }\qquad
  \q
  {
    \qwire\qasym \n
    \qcup
  }
  =\q
  {
    \qtrans \qwire \n
    \qcup
  }
  \end{equation}
\end{CODEBOX}

\begin{CODEBOX}{}{MapStateDuality}
  \begin{equation}
    \begin{array}{rccc}
      \operatorname{NAME}\colon & \operatorname{Hom}(X,Y)
      & \to & \operatorname{Hom}(I,X^T\otimes Y)\\
      & \rotatebox{90}{\(\in\)} && \rotatebox{90}{\(\in\)}\\
      & \q{
        \qasym
        \symbolI{\(X\)}
        \symbolO{\(Y\)}
      } & \mapsto 
      & \q{
        \qwire[label={\(X^T\)}, label at={at end}, label side={above}] \qasym \n
        \qcup
        \symbolO{\(Y\)}[id=2]
      }
    \end{array}
  \end{equation}
\end{CODEBOX}

\begin{CODEBOX}{}{MapEffectDuality}
  \begin{equation}
    \begin{array}{rccc}
      \operatorname{CONAME}\colon & \operatorname{Hom}(X,Y) 
      & \to & \operatorname{Hom}(X\otimes Y^T,I)\\
      & \rotatebox{90}{\(\in\)}&&\rotatebox{90}{\(\in\)}\\
      & \q{
        \qasym
        \symbolI{\(X\)}
        \symbolO{\(Y\)}
      } & \mapsto 
      & \q{
        \qcap \n
        \qasym \qwire[label={\(Y^T\)}, label at={at start}, label side={below}]
        \symbolI{\(X\)}[id=2]
      }
    \end{array}
  \end{equation}
\end{CODEBOX}

\subsubsection{No Cloning Theorem}
\label{subsubsec:nocopy}
\begin{CODEBOX}{Uniform Copying}{def:copy}
  \begin{gather}
    \q{
      \qwire\qbraid\qwire\n
      \qcomul[hlen=2, name={\(\operatorname{copy}_X\)}]\qcomul[hlen=2, name={\(\operatorname{copy}_Y\)}]
      \symbolI{\(X\)}[id=4]\symbolI{\(Y\)}[id=5]
      \symbolO{\(X\)}[id=1]\symbolO{\(Y\)}[id=2]
      \symbolO[2]{\(X\)}[id=2]\symbolO{\(Y\)}[id=3]
    }=\q{
      \qcomul[hlen=3, vlen=2, name={\(\operatorname{copy}_{X\otimes Y}\)}]\symbolI{\(X\otimes Y\)}
      \symbolO{\(X\otimes Y\)}\symbolO[2]{\(X\otimes Y\)}
    }\label{cond:copy}\\
    \forall\q{\qbox[name={\(f\)}]\symbolI{\(X\)}\symbolO{\(Y\)}}\colon
    \q{
      \qbox[name={\(f\)}]\qbox[name={\(f\)}]\n
      \qcomul[hlen=2, name={\(\operatorname{copy}_X\)}]
    }=\q{
      \qcomul[hlen=2, name={\(\operatorname{copy}_Y\)}]\n
      \qspace[0.5]\qbox[name={\(f\)}]
    }\label{cond:morcopy}\\
    \q{
      \qcomul[hlen=2, name={\(\operatorname{copy}_I\)}]\symbolI{\(I\)}
      \symbolO{\(I\)}\symbolO[2]{\(I\)}
    }=\q{\qunitob}\label{cond:i:copy}
  \end{gather}
\end{CODEBOX}

\begin{CODEBOX}{Copyable State}{def:copyablestate}
  \[
    \q{
      \qcomul[hlen=2, name={\(\operatorname{copy}\)}]\n
      \qspace[0.5]\qstate[name={\(a\)}]
    }=\q{
      \qstate[name={\(a\)}]\qstate[name={\(a\)}]
    }
  \]
\end{CODEBOX}
\begin{CODEBOX}{}{len:copycupcup}
  \begin{align*}
    \q{\qcup\qcup}&\stackrel{\text{(\ref{cond:i:copy})}}{=}
    \q{
      \qcup\qcup\n\qmv[0.5,0.4]
      \qcomul[
        dom arrowtype=dotted, 
        cod arrowtype=dotted, 
        hlen=3, 
        name={\(\operatorname{copy}\)}
      ]
    }\stackrel{\text{(\ref{cond:morcopy})}}{=}
    \q{
      \qspider[
        name={\(\operatorname{copy}\)}, 
        N={1,2,4,5}, 
        s=2, 
        hlen=2
      ]\n\qcup
    }\\
    &\stackrel{\text{(\ref{cond:copy})}}{=}\q[scale=0.6]{
      \qwire\qbraid\qwire\n
      \qloop[4]{\qwire}\n
      \qcomul[hlen=2, name={\(\operatorname{copy}\)}]\qcomul[hlen=2]\n
      \qspace[0.5]\qcup[hlen=3]
      \qbb[red][4,8]
    }\stackrel{\text{(\ref{cond:ccmt})}}{=}\q[scale=0.6]{
      \qwire\qbraid\qwire\n
      \qbraidinv\qwire\qwire\n
      \qcomul[hlen=2]\qcomul[hlen=2]\n
      \qspace[0.5]\qcup[hlen=3]
      \qbb[red][4,7]
    }\\
    &=\q[scale=0.6]{
      \qwire\qbraid\qwire\n
      \qbraidinv\qwire\qwire\n[2]
      \qloop[4]{\qwire[vlen=2]}\n
      \qloop[2]{\qcomul[hlen=2, name={\(\operatorname{copy}\)}]}\n
      \qspace[0.5]\qcup[hlen=3]
      \qbb[blue][8,9]
    }
    \stackrel{\text{(\ref{eq:inverse:braid})}}{=}
    \q[scale=0.6]{
      \qwire\qbraid\qwire\n
      \qbraidinv\qwire\qwire\n
      \qwire\qbraidinv\qwire\n
      \qwire\qbraid\qwire\n
      \qloop[2]{\qcomul[hlen=2, name={\(\operatorname{copy}\)}]}\n
      \qspace[0.5]\qcup[hlen=3]
      \qbb[blue][8,11]
    }\\
    &=\q[xscale=0.6, yscale=0.5]{
      \qwire\qbraid\qwire\n
      \qbraidinv\qwire\qwire\n
      \qwire\qbraidinv\qwire\n
      \qwire\qbraid\qwire\n
      \qloop[2]{\qcomul[hlen=2, name={\(\operatorname{copy}\)}]}\n
      \qspace[0.5]\qcup[hlen=3]
      \qbb[yellow][10,14,15]
    }\stackrel{\text{(\ref{cond:copy}, \ref{cond:morcopy}, \ref{cond:i:copy})}}{=}
    \q[scale=0.6]{
      \qwire\qbraid\qwire\n
      \qbraidinv\qwire\qwire\n
      \qwire\qbraidinv\qwire\n
      \qcup\qcup
      \qbb[yellow][10,11]
    }\\
    &=\q{
      \qwire\qbraid\qwire\n
      \qcup[n=4]
    }
  \end{align*}
\end{CODEBOX}
\begin{CODEBOX}{}{len:copybraid}
  \begin{align*}
    \q{
      \qbraid
      \symbolI{\(X\)}\symbolO{\(X\)}
      \symbolI[2]{\(X\)}\symbolO[2]{\(X\)}
    }&\stackrel{\text{(\ref{eq:snake})}}{=}\q[scale=0.5]{
      \qwire\qspace[2]\qcap\qwire\n
      \qbraid[hlen=4]\qwire\qwire\n
      \qwire\qcap\qwire\qcup\n
      \qwire\qwire\qcup
      \qbb[blue][1,5]
    }=\q[scale=0.5]{
      \qcap[hlen=4]\qwire\n
      \qwire\qspace[2]\qbraidinv\n
      \qwire\qcap\qwire\qwire\qwire[vlen=3]\n
      \qwire\qwire\qcup\qcup
      \qbb[blue][1,4]
      \qbb[yellow][12,13]
    }\\
    &\stackrel{\text{Example \ref{len:copycupcup}}}{=}\q[scale=0.5]{
      \qcap[hlen=4]\qwire\n
      \qwire\qspace[2]\qbraidinv\n
      \qwire\qcap\qwire\qwire\qwire[vlen=3]\n
      \qwire\qwire\qwire\qbraid\qwire\n
      \qwire\qwire\qcup[n=4]
      \qbb[yellow][12,14,17]
    }=\q[scale=0.5]{
      \qcap[s=4]\qwire\n
      \qloop[3]{\qwire}\qbraidinv\n
      \qloop[3]{\qwire}\qbraid\qwire[vlen=3]\n
      \qwire\qwire\qcup[n=4]
      \qbb[green][6,10]
    }\\
    &\stackrel{\text{(\ref{eq:inverse:braid})}}{=}\q[scale=0.5]{
      \qcap[s=4]\qwire\qwire\n[2]
      \qloop[6]{\qwire[vlen=2]}\n
      \qwire\qwire\qcup[n=4]
      \qbb[green][7,8]
    }\stackrel{\text{(\ref{eq:snake})}}{=}\q{
      \qwire\qwire
      \symbolI{\(X\)}[id=1]\symbolO{\(X\)}[id=1]
      \symbolI{\(X\)}\symbolO{\(X\)}
    }
  \end{align*}
\end{CODEBOX}

\begin{CODEBOX}{No Cloning Theorem}{thm:nocopy}
  \begin{align*}
    \q{
      \qasym[name={\(f\)}]
      \symbolI{\(X\)}\symbolO{\(X\)}
    }&\stackrel{\text{(\ref{eq:snake})}}{=}
    \q{
      \qcap\qasym[name={\(f\)}]\n
      \qwire\qcup
    }\stackrel{\text{(\ref{eq:inverse:braid})}}{=}\q{
      \qcap\qasym[name={\(f\)}]\n
      \qwire\qbraidinv\n
      \qwire\qbraid\n
      \qwire\qcup
    }\\
    &\stackrel{\text{(\ref{cond:naturality:braid})}}{=}\q{
      \qcap\qwire\n
      \qwire\qbraidinv\n
      \qwire\qasym[name={\(f\)}]\qwire\n
      \qwire\qbraid\n
      \qwire\qcup
      \qbb[red][1,4]
    }=\q{
      \qwire\qcap\n
      \qbraid\qwire\n
      \qwire\qasym[name={\(f\)}]\qwire\n
      \qwire\qbraid\n
      \qwire\qcup
      \qbb[red][1,4]
    }\\
    &=\q{
      \qwire\qcap\n
      \qbraid\qwire\n
      \qwire\qasym[name={\(f\)}]\qwire\n
      \qwire\qbraid\n
      \qwire\qcup
      \qbb[blue][3]
    }\stackrel{\text{Example \ref{len:copybraid}}}{=}\q{
      \qwire\qcap\n
      \qwire\qwire\qwire\n
      \qwire\qasym[name={\(f\)}]\qwire\n
      \qwire\qbraid\n
      \qwire\qcup
      \qbb[blue][3,4]
    }
  \end{align*}
\end{CODEBOX}
\subsection{Pivotal Category}
\label{subsec:pivotal}
\begin{CODEBOX}{}{struct:Pivotal}
  \begin{equation}
    \label{cond:naturality:pivotal}
    \forall\q{\qasym[name={\(f\)}]\symbolI{\(X\)}\symbolO{\(Y\)}}\colon
    \q[scale=0.5]{
      \qwire\qcap[s=4]\n
      \qwire\qwire\qasym[name={\(f\)}]\qwire\qwire\n
      \qcup[n=4]\qwire\qmv[-1,-1]\qasym[name={\(\pi_X\)}]
    }=\q{
        \qasym[name={\(\pi_Y\)}]\n
        \qasym[name={\(f\)}]
    }
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{}{dualrev}
  \begin{equation}
    \label{def:dualrev}
    \q{
      \qcaprev\n
      \symbolI{\(X^T\)}\symbolI[2]{\(X\)}
    }\coloneq\q
    {
      \qcap \n
      \qwire \qwireupup \n
      \qwire \qasym[name={\(\pi_x\)}] \n
    }\qquad\q{
      \qcuprev
      \symbolO{\(X\)}\symbolO[2]{\(X^T\)}
    }\coloneq\q
    {
      \qasym[name={\(\pi_X^{-1}\)}]\qwire\n
      \qwireupup\qwire\n
      \qcup
    }
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{}{revSliding}
  \begin{equation}
    \label{eq:sliding:rev}
    \q{
      \qcaprev\n
      \qtrans\qwire\n
    }=\q{
      \qcaprev\n
      \qwire\qasym
    }\qquad\q{
      \qwire\qtrans\n
      \qcuprev
    }=\q{
      \qasym\qwire\n
      \qcuprev
    }
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{}{corr:pivotal:twist}
  \begin{gather}
    \q{
      \qwireuu[label={\(X^{**}\)}]\n
      \qasym[name={\(\pi_X\)}]\n
      \qwireup[label={\(X\)}]
    }=\q{
      \qwireuu[label={\(X^{**}\)}]\qcap\n
      \qbraid\qwired[label={\(X^T\)}]\n
      \qasym[name={\(\theta_X^{-1}\)}]\qcuprev\n
      \qwireup[label={\(X\)}]
    }\label{twist:pivotal}\\
    \q{
      \qwireup[label={\(X\)}]\n
      \qasym[name={\(\theta_X\)}]\n
      \qwireup[label={\(X\)}]
    }=\q{
      \qwireup[label={\(X\)}]\n
      \qasym[name={\(\pi_X^{-1}\)}]\n
      \qwireuu[label={\(X^{**}\)}]\qcap\n
      \qbraid\qwired[label={\(X^T\)}]\n
      \qwire[label={\(X\)}]\qcuprev
    }\label{pivotal:twist}
  \end{gather}
\end{CODEBOX}
\begin{CODEBOX}{}{ex193477432894100303}
  \begin{align*}
    \q{\qasym[name={\(\theta_X\)}]}
    &=\q{
      \qwireu[label={\(X\)}]\qcap\n
      \qbraid\qwired\n
      \qwireu[label={\(X\)}]\qcuprev
    }&\q{\qasym[name={\(\theta_X^{-1}\)}]}
    &=\q{
      \qcaprev\qwireu[label={\(X\)}]\n
      \qwired\qbraidinv\n
      \qcup\qwireu[label={\(X\)}]
    }\\
    \q{\qtrans[name={\(\theta_X\)}]}
    &=\q{
      \qcap\qwired[label={\(X^T\)}]\n
      \qwireu\qbraid\n
      \qcuprev\qwired[label={\(X^T\)}]
    }&\q{\qtrans[name={\(\theta_X^{-1}\)}]}
    &=\q{
      \qwired[label={\(X^T\)}]\qcaprev\n
      \qbraidinv\qwireu\n
      \qwired[label={\(X^T\)}]\qcup
    }
  \end{align*}
\end{CODEBOX}
\begin{CODEBOX}{Ribbon Category}{code:def:ribboncategory}
  \begin{equation}
    \label{def:ribboncategory}
    \q{
      \qwired\qcaprev\n
      \qbraid\qwireu\n
      \qwired\qcup
    }=\q{
      \qcap\qwired\n
      \qwireu\qbraid\n
      \qcuprev\qwired
    }
  \end{equation}
\end{CODEBOX}

\subsubsection{Trace}
\label{subsubsec:trace}
\begin{CODEBOX}{Trace}{Trdef}
  \[
    \begin{array}{rccc}
      \operatorname{Tr}\colon & \operatorname{Hom}(X,X) & \to &\operatorname{Hom}(I,I)\\
      &\rotatebox{90}{\(\in\)}&&\rotatebox{90}{\(\in\)}\\
      &\q{
        \qasym[name={\(f\)}]
      } & \mapsto & \q{
        \qcap\n
        \qasym[name={\(f\)}]\qwire\n
        \qcuprev
      }
    \end{array}
  \]
\end{CODEBOX}
\begin{CODEBOX}{Commutativity of the Trace}{Cotr}
  \begin{equation}
    \label{cmt:trace}
    \operatorname{Tr}\left(\q{
      \qasym[name={\(g\)}]\n
      \qasym[name={\(f\)}]
      }\right)
    =\q{
      \qcap\n
      \qasym[name={\(g\)}]\qwire\n
      \qasym[name={\(f\)}]\qwire\n
      \qcuprev
      }
    \stackrel{\text{(\ref{eq:sliding})}}{=}\q{
      \qcap\n
      \qasym[name={\(f\)}]\qtrans[name={\(g\)}]\n
      \qcuprev
    }\stackrel{\text{(\ref{eq:sliding:rev})}}{=}\q{
      \qcap\n
      \qasym[name={\(f\)}]\qwire\n
      \qasym[name={\(g\)}]\qwire\n
      \qcuprev
    }=\operatorname{Tr}\left(\q{
      \qasym[name={\(f\)}]\n
      \qasym[name={\(g\)}]
      }\right)
  \end{equation}
\end{CODEBOX}
\begin{CODEBOX}{Dimension}{def:dim}
  \[
    \q{\qscalar[name={\(\operatorname{dim}(X)\)}]}
    \coloneq\q{\qscalar[name={\(\operatorname{Tr}(\operatorname{id}_X)\)}]}
    =\q{\qcap\n\qcuprev}
  \]
\end{CODEBOX}
\subsubsection{Compact Category}
\label{subsubsec:compact}
\begin{CODEBOX}{Compact Category}{Def:compact}
  \begin{equation}
    \label{def:compact}
    \q{\qasym[name={\(\pi_X\)}]}=\q{
      \qwireuu[label={\(X^{TT}\)}]\qcap\n
      \qsym\qwired[label={\(X^T\)}]\n
      \qwire[label={\(X\)}]\qcuprev
    }
  \end{equation}
\end{CODEBOX}

\subsubsection{Color}
\label{subsubsec:duality:color}
\begin{CODEBOX}{}{Ex:coloredhopflink}
  \begin{equation}
    \label{eq:tr:hopf}
    \operatorname{Tr}\left(
      \q{
        \qbraid[L color=blue, R color=orange]\n
        \qbraid[L color=orange, R color=blue]}
    \right)
    =\q{
      \qcap[hlen=4, frame color=orange]\n
      \qwire[color=orange]\qcap[frame color=blue]\n
      \qbraid[L color=blue, R color=orange]\n
      \qbraid[L color=orange, R color=blue
      ]\qwiredown[vlen=2, color=blue]\n
      \qwire[color=orange]
      \qcuprev[frame color=blue]
      \qwiredown[vlen=4, color=orange]\n
      \qcuprev[hlen=4, frame color=orange]
    }=\q{
      \qcap[frame color=blue]
      \qcap[frame color=orange]\n
      \qspace
      \qbraidinv[L color=orange, R color=blue]\n
      \qwireup[vlen=2, color=blue]
      \qbraidinv[L color=blue, R color=orange]
      \qwiredown[vlen=2, color=orange]\n
      \qcuprev[frame color=blue]
      \qcuprev[frame color=orange]
    }
  \end{equation}
\end{CODEBOX}

\subsection{Dagger}
\label{subsec:dagger}
\subsubsection{Adjoint Box}
\label{subsubsec:adjoint}
\begin{CODEBOX}{Adjoint}{def:adj}
  \begin{gather}
    \left(
      \q{
        \qasym[name={\(f\)}]
        \symbolI{\(X\)}\symbolO{\(Y\)}
      }
    \right)^{\dagger}
    \coloneq
    \q{
      \qadj[name={\(f\)}]
      \symbolI{\(Y\)}\symbolO{\(X\)}
    }\\
    \left(\q{\qasym[name={\(f\)}]}\right)^{\dagger\dagger}
    =\left(\q{\qadj[name={\(f\)}]}\right)^{\dagger}
    =\q{\qasym[name={\(f\)}]}\\
    \left(\q{\qwire}\right)^{\dagger}=\q{\qwire}\\
    \q{
      \qadj[name={\(f\)}]\n
      \qadj[name={\(g\)}]
    }=\q{
      \qadj[name={\(g\circ f\)}]
    }
\end{gather}
\end{CODEBOX}
\subsubsection{Conjugate Box}
\label{subsubsec:conj}
\begin{CODEBOX}{}{prep:conj}
  \begin{align*}
    \left(\q{\qadj}\right)^T
    &=\q{
      \qwire\qcap\n
      \qwire\qadj\qwire\n
      \qcup\qwire
    }=\q{
      \qcaprev\qwire\n
      \qwire\qadj\qwire\n
      \qwire\qcuprev
    }=\left(
      \q{
        \qwire\qcap\n
        \qwire\qasym\qwire\n
        \qcup\qwire
      }
    \right)^{\dagger}=\left(\q{\qtrans}\right)^{\dagger}
  \end{align*}
\end{CODEBOX}
\section{List of Primitive Diagrams}
\label{sec:fcommands}
      \begin{tcbraster}[raster columns=4,raster equal height=rows,fonttitle=\bfseries,
        colframe=cyan!90,coltitle=cyan!50,colbacktitle=black,
        subtitle style={boxrule=0.4pt,
        colback=black!70}
        ]
        \begin{tcolorbox}[adjusted title={\showcmd{qwire}[cyan]}]
          \[\q{\qwire}\]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qbox}[cyan]}]
          \[
            \q{
              \qbox
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qstate}[cyan]}]
          \[
            \q{
              \qstate
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qeffect}[cyan]}]
          \[
            \q{
              \qeffect
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qscalar}[cyan]}]
          \[
            \q{
              \qscalar
              }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qunitob}[cyan]}]
          \[
            \q{
              \qunitob
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qmul}[cyan]}]
          \[
            \q{
              \qmul[hlen=2]
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qcomul}[cyan]}]
          \[
            \q{
              \qcomul[hlen=2]
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qunit}[cyan]}]
          \[
            \q{
              \qunit
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qcounit}[cyan]}]
          \[
            \q{
              \qcounit
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qspider}[cyan]}]
          \[
            \q{
              \qspider[p=4,hlen=2]
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qbraid}[cyan]}]
          \[
            \q{
                \qbraid
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qbraidinv}[cyan]}]
          \[
            \q{
              \qbraidinv
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qsym}[cyan]}]
          \[
            \q{
              \qsym
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qcap}[cyan]}]
          \[
            \q{
              \qcap
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qcup}[cyan]}]
          \[
            \q{
              \qcup
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qwireu}[cyan]}]
          \[\q{\qwireup}\]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qwired}[cyan]}]
          \[\q{\qwiredown}\]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qwireuu}[cyan]}]
          \[\q{\qwireuu}\]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qwiredd}[cyan]}]
          \[\q{\qwiredd}\]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qasym}[cyan]}]
          \[
            \q{
              \qasym
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qtrans}[cyan]}]
          \[
            \q{
              \qtrans
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{adj}[cyan]}]
          \[
            \q{
              \qadj
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qconj}[cyan]}]
          \[
            \q{
              \qconj
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qcaprev}[cyan]}]
          \[
            \q{
              \qcaprev
            }
          \]
        \end{tcolorbox}
        \begin{tcolorbox}[adjusted title={\showcmd{qcuprev}[cyan]}]
          \[
            \q{
              \qcuprev
            }
          \]
        \end{tcolorbox}
      \end{tcbraster}
      \addcontentsline{toc}{section}{References}
      \begin{thebibliography}{99}
        \bibitem{tikz-manual}
        Till Tantau,
        \textit{The TikZ and PGF Packages Manual for Version 3.1.10},
        Institut für Theoretische Informatik, Universität zu Lübeck,
        n.d.,
        \url{https://github.com/pgf-tikz/pgf}
        (retrieved March 22, 2025).
        \bibitem{geniussorting}
        Anonymous,
        \textit{Genius Sorting Algorithm},
        4chan Programming Board,
        January 20, 2011,
        \url{https://dis.4chan.org/read/prog/1295544154}
        (accessed January 20, 2011; link currently inactive).
        \bibitem{gfxhatena}
        gfx,
        \textit{Joushiki wo kutsugaesu so-to arugorizumu! Sono na mo "sleep sort"!},
        Hatena Diary,
        May 19, 2011,
        \url{https://gfx.hatenadiary.org/entry/20110519/1305810786}.
        \bibitem{literateprograms}
        LiteratePrograms,
        \textit{Turing Machine Simulator in \LaTeX},
        \url{https://literateprograms.org/turing_machine_simulator__latex_.html},
        n.d.,
        retrieved March 22, 2025.
        \bibitem{overleaf}
        Overleaf,
        \textit{\LaTeX\ is More Powerful than You Think: Computing the Fibonacci Numbers and Turing Completeness},
        \url{https://www.overleaf.com/learn/latex/Articles/LaTeX_is_More_Powerful_than_you_Think_-_Computing_the_Fibonacci_Numbers_and_Turing_Completeness},
        n.d.,
        retrieved March 22, 2025.
      \end{thebibliography}

      \begin{changelog}[author=Ninna Ryota, sectioncmd=\section*]

        \shortversion{
          v=1.1.2, date=2025-07-28,
          changes={Fixed typos in the English documentation (qworld\_en.pdf) and the corresponding TeX source file (qworld\_en.tex). This change only affects the English documentation (qworld\_en.pdf) and the TeX source file (qworld\_en.tex), and does not impact the style file.}
        }

        \begin{version}[v=1.1.1, date=2025-04-14]
          \added
            \item Color annotation for wires and tangles\par The \showcmd[]{frame color} attribute is now supported for CAP and CUP structures, allowing wires to express object identity through color. Additionally, BRAIDING now supports separate \showcmd[]{L color} and \showcmd[]{R color} options for independently coloring the left and right wires.
          \fixed
            \item Improved wire rendering\par The rendering of curves has been refined to produce smoother and more aesthetically coherent diagrams.
        \end{version}

        \begin{version}[v=1.1.0, date=2025-04-03]
          \changed
            \item Argument structure revised for symbol commands\par The following commands were updated to support key-value-style optional arguments instead of mandatory positional arguments:
              \begin{itemize}
                \item \showcmd{symbolI}
                \item \showcmd{symbols}
                \item \showcmd{symbolS}
                \item \showcmd{symbolO}
                \item \showcmd{symboln}
                \item \showcmd{symbolN}
              \end{itemize}      
              \begin{description}
                \item[Previous syntax] \showcmd{symbolI[i]\{ID\}\{text\}[position options]}[old]
                \item[New syntax] \showcmd{symbolI[i]\{text\}[id=ID, position options]}[new]
              \end{description}
              With this revision, the \showcmd[]{ID} parameter is now optional. In simple cases, \showcmd{symbolI\{text\}}[new] suffices. This change enables more concise and readable definitions.
          \added
            \item English documentation\par An English version of the user guide has been added.
        \end{version}
      
        \shortversion{
          v=1.0.0,
          date=2025-04-01,
          changes={Initial release}
        }
      
      \end{changelog}

      \section*{License and Copyright}

      This package is distributed under the \textbf{LaTeX Project Public License (LPPL)}, version 1.3c or later.  
      For details, see \url{https://www.latex-project.org/lppl.txt}.
      
      Copyright \textcopyright 2025 Niina Ryota
      
      You are free to distribute and modify this package under the terms of LPPL.  
      However, any modified versions \textbf{must not} be distributed under the original name, and the original author must be credited.
\end{document}