\documentclass{article}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{hyperref}
\usepackage{subcaption}
\usepackage{quantumcubemodel}
\usepackage[backend=biber, style=authortitle]{biblatex}
\addbibresource{quantumcubemodel-bib.bib}

\title{Quantum Cube Model LaTeX Package (v0.1.0)}
\author{Cedric Schacht \\ \texttt{cedric.schacht@mni.thm.de}}
\date{\today}

\begin{document}
\maketitle

\section*{Introduction}

The \textbf{Quantum Cube Model (QCM)} package provides commands that make it easy to create diagrams representing the quantum cube model for up to 3 qubits.
The package simplifies drawing complex quantum state diagrams inspired by Prof.~B.~Just's framework.

\section*{Requirements}
To use this package include \verb|\usepackage{quantumcubemodel}| in your documents preamble.
This package depends on the following LaTeX packages:
\begin{verbatim}
\RequirePackage{braket}
\RequirePackage{xcolor}
\RequirePackage{tikz}
\usetikzlibrary{3d, calc, arrows.meta}
\end{verbatim}

\section*{License}
\begin{verbatim}
MIT License
Copyright (c) 2025 Cedric Schacht

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\end{verbatim}

\section*{References}

\fullcite{justQuantumComputingCompact2022}

\section*{Provided Commands}

\begin{description}
    \item Draws a diagram for a \textbf{single qubit} with the specified quantum state.
    \begin{verbatim}
\qcmQ{<amplitude>:<phase>}{<amplitude>:<phase>}
    \end{verbatim}

    \item Draws a diagram for \textbf{two qubits} with the given specified quantum state.
    \begin{verbatim}
\qcmQQ{<amplitude>:<phase>}
    {<amplitude>:<phase>}
    {<amplitude>:<phase>}
    {<amplitude>:<phase>}
    \end{verbatim}

    \item  Draws a diagram for \textbf{three qubits} with the given specified quantum state.
    \begin{verbatim}
\qcmQQQ{<amplitude>:<phase>}
    {<amplitude>:<phase>}
    {<amplitude>:<phase>}
    {<amplitude>:<phase>}
    {<amplitude>:<phase>}
    {<amplitude>:<phase>}
    {<amplitude>:<phase>}
    {<amplitude>:<phase>}
    \end{verbatim}

  
    \item Changes the scale of the generated diagrams (e.g., \verb|\qcmScale{3}| is a good starting point).
  
    \item Draws the wireframe of the transition diagram used in the quantum cube model.
        To be used inside a tikz environment.
    \begin{verbatim}
\qcmWireframe{1} % for a single qubit
\qcmWireframe{2} % for two qubits
\qcmWireframe{3} % for three qubits
    \end{verbatim}

    \item Transitions for frequently used Gates
    \begin{verbatim}
\qcmTransitionHadamardQ{}
\qcmTransitionPauliXQ{}
\qcmTransitionPauliZQ{}


\qcmTransitionHadamardQQ{1 or 2}
\qcmTransitionPauliXQQ{1 or 2}
\qcmTransitionPauliZQQ{1 or 2}
\qcmTransitionCNOTQQ{1 or 2}{2 or 1}

\qcmTransitionHadamardQQQ{1 or 2 or 3}
\qcmTransitionPauliXQQQ{1 or 2 or 3}
\qcmTransitionPauliZQQQ{1 or 2 or 3}
\qcmTransitionCNOTQQQ{1 or 2 or 3}{2 or 3 or 1}
\qcmTransitionToffolieQQQ{1 or 2 or 3}{2 or 3 or 1}{3 or 1 or 2}
    \end{verbatim}
\end{description}

\clearpage
\section*{Usage Examples}
Please visit \href{https://github.com/CedricSchacht/quantumcubemodel}{https://github.com/CedricSchacht/quantumcubemodel}
for further example usages.
\subsection*{Single qubit system}
\begin{figure}[!ht]
    \begin{verbatim}
\qcmQ{1:0}{0:0}
    \end{verbatim}
    \centering
    \qcmQ{1:0}{0:0}
    \caption{The $\ket{0} = 1 \cdot \ket{0} + 0 \cdot \ket{1}$ state}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\def\qcmScale(5)
\qcmQ{1:0}{0:0}
    \end{verbatim}
    \centering
    \def\qcmScale{5}
    \qcmQ{1:0}{0:0}
    \caption{Make it bigger default is 3}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmQ{0:0}{1:0}
    \end{verbatim}
    \centering
    \qcmQ{0:0}{1:0}
    \caption{The $\ket{1} = 0 \cdot \ket{0} + 1 \cdot \ket{1}$ state}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmQ{0.5:0}{0.86:90}
    \end{verbatim}
    \centering
    \qcmQ{0.5:0}{0.86:90}
    \caption{Superposition state with phase on $\ket{1}$}
\end{figure}

\pagebreak

\noindent\begin{minipage}[t]{0.5\textwidth}
    \subsection*{Two qubit systems}
    \begin{verbatim}
\qcmQQ{0.5:12}{0.5:180}{0:0}{0.71:40}
    \end{verbatim}
    \centering
    \qcmQQ{0.5:12}{0.5:180}{0:0}{0.71:40}
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth}
    \subsection*{Three qubit systems}
    \begin{verbatim}
\qcmQQQ{0.5:12}{0.5:180}{0:0}{0.71:40}
    \end{verbatim}
    \centering
    \def\qcmScale{2.5}
    \qcmQQQ{0.5:12}{0.5:180}{0:0}{0:0}{0:0}{0:0}{0.71:40}{0:0}
\end{minipage}

\subsection*{Full Diagram}
\begin{figure}[htbp]
    \begin{verbatim}
\begin{figure}[htbp]
    \centering
    \begin{subfigure}[b]{0.4\textwidth}
        \def\qcmScale{2}
        \centering
        \qcmQQQ{1:0}{0:0}{0:0}{0:0}{0:0}{0:0}{0:0}{0:0}
        \caption{Initial state $\ket{000}$}
    \end{subfigure}%
    \begin{subfigure}[b]{0.2\textwidth}
        \centering
        \def\qcmScale{1}
        \qcmTransitionHadamardQQQ{1}
        \vspace*{1.5cm}
    \end{subfigure}%
    \begin{subfigure}[b]{0.4\textwidth}
        \def\qcmScale{2}
        \centering
        \qcmQQQ{0.71:0}{0:0}{0.71:0}{0:0}{0:0}{0:0}{0:0}{0:0}
        \caption{Terminal state $\frac{1}{\sqrt{2}}(\ket{000} + \ket{100})$ }
    \end{subfigure}
    \caption{Effect of Hadamard on the first bit in a system of three}
\end{figure}
    \end{verbatim}
    \centering
    \begin{subfigure}[b]{0.4\textwidth}
        \def\qcmScale{2}
        \centering
        \qcmQQQ{1:0}{0:0}{0:0}{0:0}{0:0}{0:0}{0:0}{0:0}
        \caption{Initial state $\ket{000}$}
    \end{subfigure}%
    \begin{subfigure}[b]{0.2\textwidth}
        \centering
        \def\qcmScale{1}
        \qcmTransitionHadamardQQQ{1}
        \vspace*{1.5cm}
    \end{subfigure}%
    \begin{subfigure}[b]{0.4\textwidth}
        \def\qcmScale{2}
        \centering
        \qcmQQQ{0.71:0}{0:0}{0.71:0}{0:0}{0:0}{0:0}{0:0}{0:0}
        \caption{Terminal state $\frac{1}{\sqrt{2}}(\ket{000} + \ket{100})$ }
    \end{subfigure}
    \caption{Effect of Hadamard on the first bit in a system of three}
\end{figure}

\subsection*{Transitions}
For one Qubit systems use the \verb|\qcmTransition<GateName>Q{}| commands

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionHadamardQ{}
    \end{verbatim}
    \centering
    \qcmTransitionHadamardQ{}
    \caption{Transition diagram for Hadamard on a single Qubit}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionPauliXQ{}
    \end{verbatim}
    \centering
    \qcmTransitionPauliXQ{}
    \caption{Transition diagram for PauliX on a single Qubit}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionPauliZQ{}
    \end{verbatim}
    \centering
    \qcmTransitionPauliZQ{}
    \caption{Transition diagram for PauliZ on a single Qubit}
\end{figure}

For two Qubit systems use the \verb|\qcmTransition<GateName>QQ{<1> or <2>}| commands
\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionHadamardQQ{1}
    \end{verbatim}
    \centering
    \qcmTransitionHadamardQQ{1}
    \caption{Transition diagram for Hadamard on the first of two Qubits}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionPauliXQQ{2}
    \end{verbatim}
    \centering
    \qcmTransitionPauliXQQ{2}
    \caption{Transition diagram for PauliX on the second of two Qubits}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionCNOTQQ{1}{2}
    \end{verbatim}
    \centering
    \qcmTransitionCNOTQQ{1}{2}
    \caption{Transition diagram for CNOT with Control=1 and Target=2}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionCNOTQQ{2}{1}
    \end{verbatim}
    \centering
    \qcmTransitionCNOTQQ{2}{1}
    \caption{Transition diagram for CNOT with Control=2 and Target=1}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionHadamardQQQ{2}
    \end{verbatim}
    \centering
    \qcmTransitionHadamardQQQ{2}
    \caption{Transition diagram for Hadamard on the second of three Qubits}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionPauliXQQQ{3}
    \end{verbatim}
    \centering
    \qcmTransitionPauliXQQQ{3}
    \caption{Transition diagram for PauliX on the third of three Qubits}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionCNOTQQQ{1}{2}
    \end{verbatim}
    \centering
    \qcmTransitionCNOTQQQ{1}{2}
    \caption{Transition diagram for CNOT with Control=1 and Target=2}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionCNOTQQQ{3}{1}
    \end{verbatim}
    \centering
    \qcmTransitionCNOTQQQ{3}{1}
    \caption{Transition diagram for CNOT with Control=3 and Target=1}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionToffolieQQQ{1}{2}{3}
    \end{verbatim}
    \centering
    \qcmTransitionToffolieQQQ{1}{2}{3}
    \caption{Transition diagram for CNOT with Control= 1 and 2 and Target=3}
\end{figure}

\begin{figure}[!ht]
    \begin{verbatim}
\qcmTransitionToffolieQQQ{1}{3}{2}
    \end{verbatim}
    \centering
    \qcmTransitionToffolieQQQ{1}{3}{2}
    \caption{Transition diagram for CNOT with Control= 1 and 3 and Target=2}
\end{figure}

\end{document}
