<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \iffalse meta-comment
%
% Copyright (C) 2016 by Christopher Granade &lt;cgranade@cgranade.com&gt;
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Christopher Granade (cgranade@cgranade.com).
%
% This work consists of the files revquantum.dtx and revquantum.ins
% and the derived filebase revquantum.sty.
%
% \fi
%
% \iffalse
%&lt;*driver&gt;
\ProvidesFile{revquantum.dtx}
%&lt;/driver&gt;
%&lt;package&gt;\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%&lt;package&gt;\ProvidesPackage{revquantum}
%&lt;*package&gt;
    [2017/03/15 v0.11 Misc. fixes and improved installer.]
%&lt;/package&gt;
%
%&lt;*driver&gt;
\documentclass{ltxdoc}
\usepackage[pretty]{revquantum}[2015/12/29]
\usepackage{xcolor}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{revquantum.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%&lt;/driver&gt;
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&amp;
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \&lt;
%   Equals        \=     Greater than  \&gt;     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v0.10}{2016/09/21}{Build script fixes for CTAN submission.}
% \changes{v0.09}{2016/09/20}{wlog fix, updates to affil database.}
% \changes{v0.08}{2016/04/11}{Significant reworking to robustly configure colors and fonts in listings.}
% \changes{v0.07}{2016/04/07}{Added citeneed macro, fixed TODO spacing.}
% \changes{v0.06}{2016/04/04}{Fix for hyperref bug.}
% \changes{v0.05}{2016/04/04}{BibTeX hack for missing babel languages.}
% \changes{v0.04}{2015/12/30}{Added Color Universal Design color names, checks for incompatible packages.}
% \changes{v0.03}{2015/11/26}{Integration of stmaryrd, better docs.}
% \changes{v0.02}{2015/11/04}{Initial public version.}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \providecommand*{\url}{\texttt}
% \newcommand{\DescribeColor}[1]{%
%     \DescribeMacro{#1}%
%     {\color{#1} \textbullet}
%
% }
%
% \GetFileInfo{revquantum.dtx}
% \title{The \textsf{revquantum} package}
% \author{Christopher Granade \\ \url{cgranade@cgranade.com}}
% \date{\fileversion~from \filedate}
%
% \maketitle
%
% \section{Introduction}
%
% The \textsf{revquantum} package provides a number of useful hacks to solve
% common annoyances with the \textsf{revtex4-1} package, and to define notation
% in common use within quantum information. In doing so, \textsf{revquantum}
% imports and configures a number of commonly-available and used packages, and
% where reasonable, provides fallbacks.
%
% The \textsf{revquantum} package also warns when users try to load packages which
% are known to be incompatible with \textsf{revtex4-1}. In particular, loading the following
% packages will cause warnings:
%
% \begin{itemize}
%     \item \textsf{subcaption}
% \end{itemize}
%
% Yes, this is a short list. It will get longer.
%
% \section{Usage}
%
% \textbf{NB:} \textsf{revquantum} must be loaded first unless |nobibtexhacks|
% is passed.
%
% \subsection{Package Options}
%
% The \textsf{revquantum} package provides several options to configure its behavior.
% These can be used in the traditional way, as optional arguments to |\usepackage|.
% For instance, this document was prepared using |\usepackage[pretty]{revquantum}|.
%
% \DescribeMacro{[final]}
%
% Removes support for TODO commands (see below), causing them to escalate from
% warnings to errors.
%
% \DescribeMacro{[pretty]}
%
% Uses the \textsf{mathpazo} package to typeset the document
% more nicely than the default for \textsf{revtex4-1} drafts.
%
% \DescribeMacro{[uselistings]}
%
% Includes the \textsf{listings} package and configures it for
% literate and math-escape notation in Python, Mathematica and MATLAB.
%
% \DescribeMacro{[nobibtexhacks]}
%
% Prevents \textsf{revquantum} from patching the \BibTeX support provided
% by \textsf{revtex4-1} to include titles.
%
% \DescribeMacro{[strict]}
%
% Causes package incompatibility warnings to become errors.
%
% \subsection{New Commands}
%
% \subsubsection{TODO Annotations}
%
% \DescribeMacro{\todo} \marg{annotation}
%
% Marks an incompleted task in a different color in the document, and raises
% a warning in the LaTeX log.
%
% \DescribeMacro{\TODO}
% \TODO
%
% \DescribeMacro{\todolist} \marg{contents}
%
% Typesets \emph{contents} as a TODO annotation, wrapped in an |{enumerate}|
% environment.
%
% \subsubsection{Mathematical Notation}
%
% This package also provides commands for notation common in quantum information.
%
% \DescribeMacro{\ii}
% \DescribeMacro{\dd}
%
% These commands typeset the imaginary unit $\ii$ and differential element $\dd$,
% respectively, in math roman.
%
% \DescribeMacro{\defeq}
%
% This command uses |\mathrel| to properly format the colon-equals operator
% as a relation operator.
%
% \DescribeMacro{\expect}
% Typesets the expectation operator $\expect$.
%
% \DescribeMacro{\id}
%
% \todo{The current implementation of id is to call openone, provided by revtex4-1,
% and thus not available when used from documentation.}
%
% \DescribeMacro{\llbracket}
% \DescribeMacro{\rrbracket}
%
% Typesets the double-square brackets commonly used to denote stabilizer code
% properties, as in $\llbracket n, k, d \rrbracket$. These commands are provided
% by |{stmaryrd}|, and are given a reasonable fallback if that package is not
% available.
%
%
%
% \subsubsection{Affiliation Database}
%
% The \textsf{revquantum} package provides commands for quickly typesetting
% affiliations, with an eye towards reducing copy-paste errors when authors have
% a nontrivial set of shared affiliations.
%
% \DescribeMacro{\newaffil} \marg{shorthand} \marg{description}
%
% The workhorse of the affiliation database is the |\newaffil| command,
% which defines a new command that expands to call the \textsf{revtex4-1}
% |\affiliation| command. For instance, |\newaffil{UFooBar}{Bar, UFoo}|
% defines a new command |\affilUFooBar| that expands to
% |\affiliation{Bar, UFoo}|.
%
% So far, the following affiliation commands are provided:
%
% \DescribeMacro{\affilTODO} Special, marks that an affiliation is not
% provided.
%
%
% \DescribeMacro{\affilEQuSUSyd} Centre for Engineered Quantum Systems, University of Sydney.
%
% \DescribeMacro{\affilEQuSMacq} Centre for Engineered Quantum Systems, Macquarie University.
%
% \DescribeMacro{\affilUSydPhys} School of Physics, University of Sydney.
%
% \DescribeMacro{\affilIQC} Institute for Quantum Computing, University of Waterloo.
%
% \DescribeMacro{\affilUWPhys} Department of Physics, University of Waterloo.
%
% \DescribeMacro{\affilUWAMath} Department of Applied Mathematics, University of Waterloo.
%
% \DescribeMacro{\affilUWChem} Department of Chemistry, University of Waterloo.
%
% \DescribeMacro{\affilPI} Perimeter Institute for Theoretical Physics.
%
% \DescribeMacro{\affilCIFAR} Canadian Institute for Advanced Research.
%
% \DescribeMacro{\affilCQuIC} Center for Quantum Information and Control, University of New Mexico.
%
% \DescribeMacro{\affilIBMTJW} IBM T. J. Watson Research Center.
%
%
% \subsubsection{Internal-Use Commands}
%
% \DescribeMacro{\booloption}
% \DescribeMacro{\newnew}
%
% These commands are used internally by \textsf{revquantum} to define
% new boolean package options, and to declare new kinds of |\newcommand|
% commands. For example, |\newnew| is used to define |\newoperator|,
% which in turn defines new commands for named mathematical operators (e.g. $\Tr$).
%
% \DescribeMacro{\sectionautorefname}
% \DescribeMacro{\algorithmautorefname}
% \DescribeMacro{\equationautorefname}
% \DescribeMacro{\lemmaautorefname}
%
% These commands configure \textsf{hyperref}'s \texttt{autoref} command
% for use with \textsf{revtex4-1}, so that \texttt{autoref} correctly
% describes Section, Algorithm, and Lemma, and also follows the standard
% notation for equation references.
%
% \DescribeMacro{\boolean{@xetex}}
%
% This boolean variable uses \textsf{iftex} to check if XeTeX is installed.
% If \textsf{iftex} is not available, then we assume plain LaTeX.
%
% \subsection{New Colors}
%
% The \textsf{revquantum} package also provides a color palette
% that is safe for colorblind readers and for printing, the
% \href{http://jfly.iam.u-tokyo.ac.jp/color/}{Color Universal
% Design} palette of Okabe and Ito.
%
% \DescribeColor{cud-black}         
% \DescribeColor{cud-orange}        
% \DescribeColor{cud-sky-blue}      
% \DescribeColor{cud-bluish-green}  
% \DescribeColor{cud-yellow}        
% \DescribeColor{cud-blue}          
% \DescribeColor{cud-vermillion}    
% \DescribeColor{cud-reddish-purple}
%
% These colors are defined as \textsf{xcolor} color names, such that they
% can be used in all packages which depend on \textsf{xcolor}. In particular,
% CUD colors can be directly used from \textsf{tikz}. To use with \textsf{tikz},
% however, \textsf{revquantum} must be loaded \emph{after} \textsf{tikz}.
%
% \StopEventually{}
%
% \section{Implementation}
%
% \iffalse
%&lt;*package&gt;
% \fi
%



%    \begin{macrocode}

\usepackage{ifthen}

%    \end{macrocode}

% \subsection{XeTeX Detection} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% We make a new boolean variable to track if XeTeX is being used.

%    \begin{macrocode}

\newboolean{@xetex}
\setboolean{@xetex}{false}
\IfFileExists{iftex.sty}{
    \wlog{[INFO] iftex loaded}
    \usepackage{iftex}
}{
    \newif\ifXeTeX
    \XeTeXfalse
}
\ifXeTeX
    \wlog{[INFO] Using XeTeX}
    \setboolean{@xetex}{true}
\else
    \setboolean{@xetex}{false}
\fi

%    \end{macrocode}


% \subsection{Notation} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% \begin{macro}{\newnew}
%    \begin{macrocode}
\newcommand{\newnew}[2]{
    \expandafter\newcommand\csname new#1\endcsname[1]{
      \expandafter\newcommand\csname ##1\endcsname{#2{##1}}
    }
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\newnew{operator}{\operatorname}
\newnew{rm}{\mathrm}

\newoperator{Tr}
\newoperator{Cov}
\newoperator{supp}
\newoperator{diag}
\newoperator{rank}

%    \end{macrocode}
%
% \begin{macro}{\ii}
%    \begin{macrocode}
\newcommand{\ii}{\mathrm{i}} % Outside what newnew currently supports.
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\dd}
%    \begin{macrocode}
\newcommand{\dd}{\mathrm{d}} % Outside what newnew currently supports.
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}

\newrm{e}
\newrm{TVD}
\newrm{T}

%    \end{macrocode}
%
% \begin{macro}{\defeq}
%    \begin{macrocode}
\newcommand{\defeq}{\mathrel{:=}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\expect}
%    \begin{macrocode}
\newcommand{\expect}{\mathbb{E}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\id}
%    \begin{macrocode}
\newcommand{\id}{\openone}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}

%    \end{macrocode}

% We want to only conditionally use |{stmaryrd}| if it's available, and
% otherwise, hack up a few commands from that package.
%
%    \begin{macrocode}
    \IfFileExists{stmaryrd.sty}{
        \RequirePackage{stmaryrd}
    }{
        \PackageWarning{revquantum}{
            The stmaryrd package is not available,
            so some commands (e.g.: double-brackets) will look wrong.
        }
        \newcommand{\llbracket}{[\!\!\hspace{1.5pt}[}
        \newcommand{\rrbracket}{]\!\!\hspace{1.5pt}]}
    }
%    \end{macrocode}


% \subsection{Options Handling} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% We will need to define a few options to make the package nicer to use. We do
% so by making a new command, |\booloption| \marg{boolname} \marg{optionname}
% \marg{default}.
% \begin{macro}{\booloption}
%    \begin{macrocode}
\newcommand{\booloption}[3]{
    \newboolean{#1}
    \setboolean{#1}{#3}
    \ifthenelse{\equal{#3}{true}}{
%    \end{macrocode}
% Default is true, so we need a "no" option to
% turn off the new boolean.
%    \begin{macrocode}
        \DeclareOption{no#2}{\setboolean{#1}{false}}
    }{
%    \end{macrocode}
% Default is false, so we need an option to turn
% on the new boolean.
%    \begin{macrocode}
        \DeclareOption{#2}{\setboolean{#1}{true}}
    }
}
%    \end{macrocode}
% \end{macro}

% We then use this new command to define the options for \textsf{revquantum},
% |final|, |pretty|, |uselistings|, |nobibtexhacks|, and |strict|.

%    \begin{macrocode}

\booloption{@final}{final}{false}
\booloption{@pretty}{pretty}{false}
\booloption{@uselistings}{uselistings}{false}
\booloption{@bibtexhacks}{bibtexhacks}{true}
\booloption{@strict}{strict}{false}

\ProcessOptions\relax

%    \end{macrocode}

% For the |strict| option, we do one last thing and define a new macro that
% either raises a warning or an option depending on whether |strict| has been
% set as an option.

% \begin{macro}{\rq@quasiwarn}
%    \begin{macrocode}
\ifthenelse{\boolean{@strict}}{
    \newcommand{\rq@quasiwarn}{
        \PackageError{revquantum}
    }
}{
    \newcommand{\rq@quasiwarn}{
        \PackageWarning{revquantum}
    }
}
%    \end{macrocode}
% \end{macro}

% \subsection{Unforgivable BibTeX Hacks} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% These hacks include the title of each reference in the BibTeX output by
% redefining the part of \textsf{revtex4-1} on the fly which is responsible
% for writing out the bibdata. Note that these hacks \emph{must} come before
% importing packages, or else \textsf{revtex4-1} will have already written out
% its control notes.

%    \begin{macrocode}

\ifthenelse{\boolean{@bibtexhacks}}{\def\@bibdataout@aps{%
 \immediate\write\@bibdataout{%
  @CONTROL{%
   apsrev41Control,author="08",editor="1",pages="0",title="0",year="1",eprint="1"%
  }%
 }%
 \if@filesw
  \immediate\write\@auxout{\string\citation{apsrev41Control}}%
 \fi
}}{}

%    \end{macrocode}

% \subsection{Imports} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Here, we import a few other useful packages and configure them according to
% the options passed by the user. In handling the fonts specified by
% |[pretty]|, we must be careful to do so in a way that is supported by
% XeTeX.
% Note that we only load \textsf{color} if
% neither \textsf{tikz} nor \textsf{xcolor} have already been imported, and if
% we are not using \textsf{listings}. In the latter case, we will load
% \textsf{xcolor} instead so that we can make \textsf{listings} play nicer with
% our own custom palette.
% Also of
% note is that we do not import \textsf{hyperref} yet, as it must go last to avoid duplicating
% reference names.

%    \begin{macrocode}

\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{amsthm}
\RequirePackage{amssymb}
\RequirePackage{amsbsy}
\@ifpackageloaded{tikz}{}{%
    \@ifpackageloaded{xcolor}{}{%
        \ifthenelse{\boolean{@uselistings}}{}{%
            \RequirePackage[usenames,dvipsnames]{color}%
        }%
    }%
    \AtBeginDocument{%
        \@ifpackageloaded{tikz}{%
            \rq@quasiwarn{tikz loaded, but after revquantum. This may not work.}%
        }%
    }%
}
\RequirePackage{braket}
\RequirePackage{graphicx}
\RequirePackage[english]{babel}
\ifthenelse{\boolean{@pretty}}{
    \ifthenelse{\boolean{@xetex}}{
        % http://tex.stackexchange.com/a/50593
        \usepackage{fontspec}
        \usepackage{mathpazo}
        \setmainfont
         [ BoldFont       = texgyrepagella-bold.otf ,
           ItalicFont     = texgyrepagella-italic.otf ,
           BoldItalicFont = texgyrepagella-bolditalic.otf ]
         {texgyrepagella-regular.otf}
    }{
        \RequirePackage{mathpazo}
    }
}{}
\ifthenelse{\boolean{@uselistings}}{
    \RequirePackage{xcolor}
    \RequirePackage{listings}
    \RequirePackage{textcomp} % Make sure we have a ` for writing Mathematica.
}{}
\ifthenelse{\boolean{@bibtexhacks}}{
    \RequirePackage{letltxmacro}
    \RequirePackage{etoolbox}
}{}
%    \end{macrocode}

% \subsubsection{Theorem Environments}

%    \begin{macrocode}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}

%    \end{macrocode}

% \subsubsection{\textsf{algorithm} and \textsf{algpseudocode} Setup}

%    \begin{macrocode}

\RequirePackage{algorithm}
\RequirePackage{algpseudocode}
    \renewcommand{\algorithmicrequire}{\textbf{Input:}}
    \renewcommand{\algorithmicensure}{\textbf{Output:}}
    \newcommand{\inlinecomment}[1]{\Comment {\footnotesize #1} \normalsize}
    \newcommand{\linecomment}[1]{\State \(\triangleright\) {\footnotesize #1} \normalsize}

%    \end{macrocode}

% \subsubsection{\textsf{listings} Setup}

% Here, we provide special support for scientific languages like Python and Mathematica,
% as well as for legacy environments. This support consists of configuring escapes,
% quoting, providing additional keywords, etc.

%    \begin{macrocode}

\ifthenelse{\boolean{@uselistings}}{
    \definecolor{comment-color}{gray}{0.5}

    \lstset{
        basicstyle=\footnotesize,
        commentstyle=\color{comment-color},
        frame=lines,
        gobble=4,
        numbers=left,
        numberstyle=\tiny, stepnumber=5,
        numbersep=5pt,
        keywordstyle=\color{cud-bluish-green!85!black}\bfseries,
        keywordstyle={[2]\color{cud-sky-blue!75!black}},
        emphstyle=\color{cud-vermillion}
    }

    \ifthenelse{\boolean{@xetex}}{
        \RequirePackage{sourcecodepro}
        \lstset{basicstyle=\footnotesize\sourcecodepro}
    }{}

    \lstdefinestyle{matlab}{
        language=MATLAB,
        mathescape=true
    }

    \lstdefinestyle{python}{
        language=Python,
        mathescape=true,
        showstringspaces=false,
        morekeywords={as,async,await}
    }

    \lstdefinestyle{mathematica}{
        language=Mathematica,
        upquote=true, % Needed to deal with the context symbol `.'
        literate=
            {-&gt;}{$\to$}1
            {!=}{$\neq$}1
            {\\[DoubleStruckOne]}{${\id}$}1
            {\\[Sigma]}{$\sigma$}1
            {(x)}{$\otimes$}1 % CG: I have the distinct impression this will break. Badly.
    }
}{}

%    \end{macrocode}

% \subsection{Import Warnings} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% The following command will cause a warning to be emitted if the package
% named by its argument is loaded. To make robust against the order in which
% packages are loaded, all such logic happens at |\begin{document}|. This
% code is adapted from the solution provided by Martin Scharrer at
% \url{http://tex.stackexchange.com/a/16200/615}.

% \begin{macro}{\rq@warnpackage}
%    \begin{macrocode}
\newcommand{\rq@warnpackage}[1]{
    \AtBeginDocument{%
        \@ifpackageloaded{#1}{%
            \rq@quasiwarn{The #1 package is known to be incompatible with revtex4-1. You may encounter problems using this package.}%
        }{}
    }
}
%    \end{macrocode}
% \end{macro}

% With this command in place, we can now issue specific warnings for individual
% ``bad'' packages.

%    \begin{macrocode}
\rq@warnpackage{subcaption}
%    \end{macrocode}


% \subsection{Slightly More Forgivable BibTeX Hacks} %%%%%%%%%%%%%%%%%%%%%%%%%

% Next, we include \href{http://tex.stackexchange.com/a/199299/615}{a solution
% suggested by egreg} for a rather annoying |{revtex4-1}| bug. In particular,
% we will set up |language={en}| as an alias for |language={english}|, so that
% |{revtex4-1}| will no longer raise |{babel}| errors for the undefined language.
% As with our unforgivable hacks, we will guard the forgivable hacks with
% the |[nobibtexhacks]| option.

% \begin{macro}{\ORIGselectlanguage}
%    \begin{macrocode}

\ifthenelse{\boolean{@bibtexhacks}}{
    \LetLtxMacro{\ORIGselectlanguage}{\selectlanguage}
    \DeclareRobustCommand{\selectlanguage}[1]{%
      \@ifundefined{alias@\string#1}
        {\ORIGselectlanguage{#1}}
        {\begingroup\edef\x{\endgroup
           \noexpand\ORIGselectlanguage{\@nameuse{alias@#1}}}\x}%
    }
}{}

%    \end{macrocode}
% \end{macro}

% \begin{macro}{\definelanguagealias}
%    \begin{macrocode}

\newcommand{\definelanguagealias}[2]{%
  \@namedef{alias@#1}{#2}%
}

%    \end{macrocode}
% \end{macro}

%    \begin{macrocode}

\definelanguagealias{en}{english}
\definelanguagealias{EN}{english}
\definelanguagealias{English}{english}

%    \end{macrocode}

% We will also redefine |\doibase| to eat any newlines following it, and to
% prefer HTTPS to HTTP. This will fix a rather annoying bug where line breaks
% in the *.bbl source can introduce extraneous spaces into the target of
% each citation's |\href|.

% \begin{macro}{\doibase}
%     \begin{macrocode}

\ifthenelse{\boolean{@bibtexhacks}}{
    % Ensure that the \doibase command is defined, just in case.
    \providecommand{\doibase}{}
    \renewcommand{\doibase}[1]{https://dx.doi.org/\ifdefempty{#1}{}{#1}} 
}{}

%     \end{macrocode}
% \end{macro}


% \subsection{TODO Support} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% These commands provide a way of marking items as needing to be done before
% the final version (denoted by the |final| package option).

% \begin{macro}{\todo}
%    \begin{macrocode}

\ifthenelse{\boolean{@final}}{
    \newcommand{\todo}[1]{%
        \PackageError{revquantum}{Unaddressed TODO}%
        \rq@todo{#1}%
    }
}{
    \newcommand{\todo}[1]{%
        \PackageWarning{revquantum}{Unaddressed TODO}%
        \rq@todo{#1}%
    }
}

%    \end{macrocode}
% \end{macro}
%
% We also define a |\citeneed| command for the special case of a missing citation.
% As per Steve Flammia's suggestion, this is formatted in analogy to the infamous
% Wikipedia annotation.
%
% \begin{macro}{\citeneed}
%     \begin{macrocode}
\ifthenelse{\boolean{@final}}{
    \newcommand{\citeneed}{%
        \PackageError{revquantum}{citation needed}%
        \rq@todo{[citation needed]}%
    }
}{
    \newcommand{\citeneed}{%
        \PackageWarning{revquantum}{citation needed}%
        \rq@todo{[citation needed]}%
    }
}
%    \end{macrocode}
% \end{macro}
%
% Both of these macros are based on the |\rq@todo| macro, which performs the
% formatting for TODOs.
%
% \begin{macro}{\rq@todo}
%    \begin{macrocode}
\newcommand{\rq@todo}[1]{%
    {\color{magenta} #1}%
}
%    \end{macrocode}
% \end{macro}
%
% We also provide a few other special cases below.
%
% \begin{macro}{\TODO}
%    \begin{macrocode}
\newcommand{\TODO}{\todo{TODO}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\todolist}
%    \begin{macrocode}
\newcommand{\todolist}[1]{\todo{
    \begin{itemize}
        #1
    \end{itemize}
}}

%    \end{macrocode}
% \end{macro}

% \subsection{Color Universal Design} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%    \begin{macrocode}
\definecolor{cud-black}         {RGB}{0,0,0}
\definecolor{cud-orange}        {RGB}{230,159,0}
\definecolor{cud-sky-blue}      {RGB}{86,180,233}
\definecolor{cud-bluish-green}  {RGB}{0,158,115}
\definecolor{cud-yellow}        {RGB}{240,228,66}
\definecolor{cud-blue}          {RGB}{0,114,178}
\definecolor{cud-vermillion}    {RGB}{213,94,0}
\definecolor{cud-reddish-purple}{RGB}{204,121,167}
%    \end{macrocode}

% \subsection{Affiliation Database} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\newaffil}
%    \begin{macrocode}
\newcommand{\newaffil}[2]{
    \expandafter\newcommand\csname affil#1\endcsname{
        \affiliation{
            #2
        }
    }
}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{General Affiliations}
%
%    \begin{macrocode}

\newaffil{TODO}{\TODO}

%    \end{macrocode}
%
% \subsubsection{Australia}
%
%    \begin{macrocode}

\newaffil{EQuSUSyd}{
    Centre for Engineered Quantum Systems,
    University of Sydney,
    Sydney, NSW, Australia
}
\newaffil{EQuSMacq}{
    Centre for Engineered Quantum Systems,
    Macquarie University,
    Sydney, NSW, Australia
}
\newaffil{USydPhys}{
    School of Physics,
    University of Sydney,
    Sydney, NSW, Australia
}

%    \end{macrocode}
%
% \subsubsection{Canada}
%
%    \begin{macrocode}

\newaffil{IQC}{
    Institute for Quantum Computing,
    University of Waterloo,
    Waterloo, ON, Canada
}
\newaffil{UWPhys}{
    Department of Physics,
    University of Waterloo,
    Waterloo, ON, Canada
}
\newaffil{UWAMath}{
    Department of Applied Mathematics,
    University of Waterloo,
    Waterloo, ON, Canada
}
\newaffil{UWChem}{
    Department of Chemistry,
    University of Waterloo,
    Waterloo, ON, Canada
}
\newaffil{PI}{
    Perimeter Institute for Theoretical Physics,
    31 Caroline St. N,
    Waterloo, Ontario, Canada N2L 2Y5
}
\newaffil{CIFAR}{
    Canadian Institute for Advanced Research,
    Toronto, ON, Canada
}

%    \end{macrocode}
%
% \subsubsection{United States}
%
%    \begin{macrocode}

\newaffil{CQuIC}{
    Center for Quantum Information and Control,
    University of New Mexico,
    Albuquerque, NM 87131-0001, USA
}
\newaffil{IBMTJW}{
    IBM T. J. Watson Research Center,
    Yorktown Heights, New York 10598, USA
}


%    \end{macrocode}


% \subsection{\textsf{hyperref} Setup} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Finally, we load \textsf{hyperref} separately so that it can go last.

% Get rid of \textsf{hyperref}'s ugly boxes.
%From:http://tex.stackexchange.com/a/51349
%    \begin{macrocode}

\RequirePackage[breaklinks=true]{hyperref}

\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = blue, %Colour for external hyperlinks
  linkcolor    = blue, %Colour of internal links
  citecolor    = red %Colour of citations
}

%    \end{macrocode}


% \subsubsection{\textsf{autoref} Setup}
% We must declare our \textsf{autoref} configuration at the beginning
% of the document to keep other packages from clobbering it.

% \begin{macro}{\sectionautorefname}
%    \begin{macrocode}
\AtBeginDocument{%
    \def\sectionautorefname{Section}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\algorithmautorefname}
%    \begin{macrocode}
\AtBeginDocument{%
    \def\algorithmautorefname{Algorithm}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\equationautorefname}
% See http://tex.stackexchange.com/a/66150.
%    \begin{macrocode}
\AtBeginDocument{%
    \def\equationautorefname~#1\null{(#1)\null}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\lemmaautorefname}
%    \begin{macrocode}
\AtBeginDocument{%
    \newcommand{\lemmaautorefname}{Lemma}%
}
%    \end{macrocode}
% \end{macro}
%
% \iffalse
%&lt;/package&gt;
% \fi
%
% \Finale
\endinput
</pre></body></html>