texlive[54911] Master/texmf-dist: quantikz (27apr20)

commits+karl at tug.org commits+karl at tug.org
Mon Apr 27 23:15:37 CEST 2020


Revision: 54911
          http://tug.org/svn/texlive?view=revision&revision=54911
Author:   karl
Date:     2020-04-27 23:15:37 +0200 (Mon, 27 Apr 2020)
Log Message:
-----------
quantikz (27apr20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf
    trunk/Master/texmf-dist/doc/latex/quantikz/quantikz.tex
    trunk/Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz.code.tex

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/latex/quantikz/quantikz.sty

Modified: trunk/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/quantikz/quantikz.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/quantikz/quantikz.tex	2020-04-27 18:46:48 UTC (rev 54910)
+++ trunk/Master/texmf-dist/doc/latex/quantikz/quantikz.tex	2020-04-27 21:15:37 UTC (rev 54911)
@@ -128,6 +128,20 @@
 \end{lstlisting}
 \end{Code}
 
+One particularly common reason for wanting an arrow is to indicate that a qubit is not being measured. There is a \verb!\trash! command in this instance.
+\begin{Code}
+\begin{center}
+\begin{quantikz}
+\lstick{$\ket{0}$} & \gate{H} & \trash{\text{trash}}
+\end{quantikz}
+\end{center}
+\tcblower
+\begin{lstlisting}
+\lstick{$\ket{0}$} & \gate{H} & \trash{\text{trash}}
+\end{lstlisting}
+\end{Code}
+
+
 Sometimes, you may want to group a whole bunch of wires together. Use \verb!\qwbundle! instead of \verb!\qw!.
 \begin{Code}
 \begin{center}
@@ -154,11 +168,11 @@
 \tcblower
 \begin{lstlisting}
 \begin{quantikz}
-\lstick{$\ket{0}^{\otimes n}$} & \gate{H} \qwbundle[alternate]{}& \control\qwbundle[alternate]{} 
+\lstick{$\ket{0}^{\otimes n}$} & \gate{H} \qwbundle[alternate]{}& \qwbundle[alternate]{} 
 \end{quantikz}
 \end{lstlisting}
 \end{Code}
-\noindent The alternate version does not represent how many wires are supposed to be in the bundle.
+\noindent The alternate version does not typically represent how many wires are supposed to be in the bundle. However, there is the \texttt{alternate=2} option if you only want 2 wires.
 
 
 \section{Multiple Qubits}
@@ -220,6 +234,39 @@
 \end{lstlisting}
 \end{Code}
 
+Standard gate commands will typically work well with the alternate option for bundled quantum wires. However, when using the \texttt{alternate=2} option, you may need to disable to default wire using the \texttt{nwires} option, as described in Sec.\ \ref{sec:wires}. However, the control can look messy. To that end, we use the \texttt{ctrlbundle} command.
+\begin{Code}
+\begin{center}
+\begin{quantikz}
+\lstick{\ket{x}} & \ctrlbundle{1} & \rstick{\ket{x}}\qwbundle[alternate]{} \\
+& \gate[nwires=1]{U_x}\qwbundle[alternate=2]{} & \qwbundle[alternate=2]{}
+\end{quantikz}
+\end{center}
+\tcblower
+\begin{lstlisting}
+\begin{quantikz}
+\lstick{\ket{x}} & \ctrlbundle{1} & \rstick{\ket{x}}\qwbundle[alternate]{} \\
+& \gate[nwires=1]{U_x}\qwbundle[alternate=2]{} & \qwbundle[alternate=2]{}
+\end{quantikz}
+\end{lstlisting}
+\end{Code}
+If \texttt{ctrlbundle} should only use two wires, supply the optional parameter \texttt{[2]},
+\begin{Code}
+\begin{center}
+\begin{quantikz}
+\lstick{\ket{x}} & \ctrlbundle[2]{1} & \rstick{\ket{x}}\qwbundle[alternate=2]{} \\
+& \gate{U_x}\qwbundle[alternate]{} & \qwbundle[alternate]{}
+\end{quantikz}
+\end{center}
+\tcblower
+\begin{lstlisting}
+\begin{quantikz}
+\lstick{\ket{x}} & \ctrlbundle[2]{1} & \rstick{\ket{x}}\qwbundle[alternate=2]{} \\
+& \gate{U_x}\qwbundle[alternate]{} & \qwbundle[alternate]{}
+\end{quantikz}
+\end{lstlisting}
+\end{Code}
+
 \section{Operating on Many Qubits}
 
 We have already met the \verb!\lstick!, \verb!\rstick!, and \verb!\gate! commands. By default, these all act on a single quantum wire. However, they also take the optional parameter \verb!wires=n! to specify that they should extend over $n$ wires. The syntax is otherwise unchanged\footnote{Strictly, the \texttt{wires=} statement should not be necessary, as this is presumed to be the default key, but it is useful for readability.}.
@@ -328,28 +375,28 @@
 \end{lstlisting}
 \end{Code}
 
-\subsection{Different Connections}
+\subsection{Different Connections}\label{sec:wires}
 
-It is assumed that most of the time you want to connect your gates with quantum wires. However, it is possible to override that, and either use classical wires or no wire. These appear as option keys for the gate command, both of which are a comma-separated list of incoming wires that should be altered.
+It is assumed that most of the time you want to connect your gates with quantum wires. However, it is possible to override that, and either use classical wires, an alternate wire bundle, or no wire. These appear as option keys for the gate command, each of which are a comma-separated list of incoming wires that should be altered.
 
 \begin{Code}
 \begin{center}
 \begin{quantikz}
-& \gate[5,cwires={2,4},nwires={3}]{U} & \qw \\
+& \gate[5,cwires={2,4},nwires={3},bundle={5}]{U} & \qw \\
 & & \cw \\
 & & \qw \\
 & & \cw \\
-& & \qw
+& & \qwbundle[alternate]{}
 \end{quantikz}
 \end{center}
 \tcblower
 \begin{lstlisting}
 \begin{quantikz}
-& \gate[5,cwires={2,4},nwires={3}]{U} & \qw \\
+& \gate[5,cwires={2,4},nwires={3},bundle={5}]{U} & \qw \\
 & & \cw \\
 & & \qw \\
 & & \cw \\
-& & \qw
+& & \qwbundle[alternate]{}
 \end{quantikz}
 \end{lstlisting}
 \end{Code}
@@ -613,91 +660,168 @@
 \end{quantikz}
 \end{lstlisting}
 \end{Code}
-
-\subsubsection{Perfecting Vertical Alignment}
-
-If you want total control over vertical alignment between several different circuits, the trick is to use the \verb!baseline! key. All the baselines of different items are placed on the same level. This is particularly helpful if you give certain wires in the circuit a name, and that will let you place the baseline directly on a level with that wire.
-
-To name a wire as `name', place an \verb!\alias{name}! command in any cell which is either empty, or contains a \verb!\qw!, \verb!\cw! or \verb!\push! \emph{only}, and place it before that command\footnote{Alternatively, for any node that accepts tikz styling parameters directly as an option, passing the option \texttt{alias=name} should do.}. That lets you align circuit identities such as
+Alternatively, you can use a \texttt{midstick} command, which is a bit like \texttt{rstick} or \texttt{lstick}. By default, it places braces both before and after, but these can be replaced using the optional argument \texttt{brackets=none|left|right|both}. This is typically the simplest options. Thus,
 \begin{Code}
-$$
-\begin{quantikz}[baseline=(W.base)]
-\lstick{\ket{0}} & \qw & \ctrl{1} & \qw \\
-& \gate{H} & \targ{} & \alias{W} \qw
+\begin{center}
+\begin{quantikz}
+& \qw & \ctrl{1} & \midstick[2,brackets=none]{=}\qw& \ctrl{1} & \gate{Z} & \qw \\
+& \gate{Z} & \targ{} & \qw& \targ{}  & \gate{Z} & \qw
 \end{quantikz}
-\equiv
-\begin{quantikz}[baseline=(W.base)]
-& \gate{H} & \gate{X} & \alias{W} \qw
-\end{quantikz}
-$$
+\end{center}
 \tcblower
 \begin{lstlisting}
-$$
-\begin{quantikz}[baseline=(W.base)]
-\lstick{\ket{0}} & \qw & \ctrl{1} & \qw \\
-& \gate{H} & \targ{} & \alias{W} \qw
+\begin{quantikz}
+& \qw & \ctrl{1} & \midstick[2,brackets=none]{=}\qw& \ctrl{1} & \gate{Z} & \qw \\
+& \gate{Z} & \targ{} & \qw& \targ{}  & \gate{Z} & \qw
 \end{quantikz}
-\equiv\begin{quantikz}[baseline=(W.base)]
-& \gate{H} & \gate{X} & \alias{W} \qw
-\end{quantikz}
-$$
 \end{lstlisting}
 \end{Code}
-This has aligned the bottom wire of the first circuit with the wire in the second circuit, making the correspondence more obvious. However, the $\equiv$ sign is now in the wrong place, with its baseline placed at the same point as the baseline of the circuits. We can fix this with a vertical shift of the two diagrams. We demonstrate two different ways of achieving the same effect (the only important feature is that both diagrams have the same shift).
+Another example that doesn't remove the braces:
 \begin{Code}
-$$
-\begin{quantikz}[baseline={($(W.base)+0.3*(0,1cm)$)}]
-\lstick{\ket{0}} & \qw & \ctrl{1} & \qw \\
-& \gate{H} & \targ{} & \alias{W} \qw
+\begin{center}
+\begin{quantikz}[column sep=0.2cm]
+\lstick{\ket{x}} & \gate{H} & \ctrl{1} & \midstick[2]{$\mapsto\ket{\psi_{xy}}\mapsto$}\qw & \ctrl{1} & \gate{H} & \rstick{\ket{x}}\qw \\
+\lstick{\ket{y}} & \qw & \targ{} & \qw&\targ{} & \qw & \rstick{\ket{y}}\qw
 \end{quantikz}
-\equiv\begin{quantikz}[baseline={([yshift=0.3cm]new.base)}]
-& \gate{H} & \gate{X} & \alias{new} \qw
-\end{quantikz}
-$$
+\end{center}
 \tcblower
 \begin{lstlisting}
-$$
-\begin{quantikz}[baseline={($(W.base)+0.3*(0,1cm)$)}]
-\lstick{\ket{0}} & \qw & \ctrl{1} & \qw \\
-& \gate{H} & \targ{} & \alias{W} \qw
+\begin{quantikz}
+\lstick{\ket{x}} & \gate{H} & \ctrl{1} & \midstick[2]{$\mapsto\ket{\psi_{xy}}\mapsto$}\qw & \ctrl{1} & \gate{H} & \rstick{\ket{x}}\qw \\
+\lstick{\ket{y}} & \qw & \targ{} & \qw&\targ{} & \qw & \rstick{\ket{y}}\qw
 \end{quantikz}
-\equiv\begin{quantikz}[baseline={([yshift=0.3cm]new.base)}]
-& \gate{H} & \gate{X} & \alias{new} \qw
-\end{quantikz}
-$$
 \end{lstlisting}
 \end{Code}
 
-If you have an even number if wires, you might choose to calculate the centre of the circuit from \verb!current bounding box.center!, or you could perform a calculation to average the position of two wires. This calculation can then be adjusted to take into account the desire to vertically align on the centre of an equals sign rather than the baseline (which is below the bottom of the equals)
+ \subsubsection{Perfecting Vertical Alignment}
 
+Sometimes when you're typesetting circuit identities as multiple separate circuits, the vertical alignment of the equals sign doesn't appear quite right (and can really niggle). Here, for example, the equals seems a bit high:
 \begin{Code}
-$$
-\begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}]
-& \gate{X} & \ctrl{1} & \alias{W} \qw \\
-& \ghost{X}\qw & \targ{} & \alias{W2} \qw
+\begin{center}
+\begin{quantikz}[column sep=0.3cm]
+& \targ{} & \ctrl{1} & \targ{} & \qw \\
+\lstick{\ket{0}} & \ctrl{-1} & \targ{} & \ctrl{-1} & \qw
+\end{quantikz}=\begin{quantikz}[column sep=0.3cm]
+ & \ctrl{1} & \targ{} & \qw \\
+\lstick{\ket{0}} & \targ{} & \ctrl{-1} & \qw
 \end{quantikz}
-=\begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}]
-& \ctrl{1} & \gate{X} & \qw \\
-& \targ{}  & \gate{X} & \qw
+\end{center}
+\tcblower
+\begin{lstlisting}
+\begin{quantikz}[column sep=0.3cm]
+& \targ{} & \ctrl{1} & \targ{} & \qw \\
+\lstick{\ket{0}} & \ctrl{-1} & \targ{} & \ctrl{-1} & \qw
+\end{quantikz}=\begin{quantikz}[column sep=0.3cm]
+ & \ctrl{1} & \targ{} & \qw \\
+\lstick{\ket{0}} & \targ{} & \ctrl{-1} & \qw
 \end{quantikz}
-$$
+\end{lstlisting}
+\end{Code}
+To that end, we have added the key \texttt{align equals at=} option for the tikzcd and quantikz environments. This specifies which wire should be align with the equals sign. You can even use a non-integer. For instance, 2.5 will set it half way between wires 2 and 3.
+\begin{Code}
+\begin{center}
+\begin{quantikz}[align equals at=1.5,column sep=0.3cm]
+& \targ{} & \ctrl{1} & \targ{} & \qw \\
+\lstick{\ket{0}} & \ctrl{-1} & \targ{} & \ctrl{-1} & \qw
+\end{quantikz}=\begin{quantikz}[align equals at=1.5,column sep=0.3cm]
+ & \ctrl{1} & \targ{} & \qw \\
+\lstick{\ket{0}} & \targ{} & \ctrl{-1} & \qw
+\end{quantikz}
+\end{center}
 \tcblower
 \begin{lstlisting}
-$$
-\begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}]
-& \gate{X} & \ctrl{1} & \alias{W} \qw \\
-& \ghost{X}\qw & \targ{} & \alias{W2} \qw
+\begin{quantikz}[align equals at=1.5,column sep=0.3cm]
+& \targ{} & \ctrl{1} & \targ{} & \qw \\
+\lstick{\ket{0}} & \ctrl{-1} & \targ{} & \ctrl{-1} & \qw
+\end{quantikz}=\begin{quantikz}[align equals at=1.5,column sep=0.3cm]
+ & \ctrl{1} & \targ{} & \qw \\
+\lstick{\ket{0}} & \targ{} & \ctrl{-1} & \qw
 \end{quantikz}
-=\begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}]
-& \ctrl{1} & \gate{X} & \qw \\
-& \targ{}  & \gate{X} & \qw
-\end{quantikz}
-$$
 \end{lstlisting}
 \end{Code}
 
-For more details on the possible syntax here, see the \verb!calc! library in tikz.
+% If you want total control over vertical alignment between several different circuits, the trick is to use the \verb!baseline! key. All the baselines of different items are placed on the same level. This is particularly helpful if you give certain wires in the circuit a name, and that will let you place the baseline directly on a level with that wire.
 
+% To name a wire as `name', place an \verb!\alias{name}! command in any cell which is either empty, or contains a \verb!\qw!, \verb!\cw! or \verb!\push! \emph{only}, and place it before that command\footnote{Alternatively, for any node that accepts tikz styling parameters directly as an option, passing the option \texttt{alias=name} should do.}. That lets you align circuit identities such as
+% \begin{Code}
+% $$
+% \begin{quantikz}[baseline=(W.base)]
+% \lstick{\ket{0}} & \qw & \ctrl{1} & \qw \\
+% & \gate{H} & \targ{} & \alias{W} \qw
+% \end{quantikz}
+% \equiv
+% \begin{quantikz}[baseline=(W.base)]
+% & \gate{H} & \gate{X} & \alias{W} \qw
+% \end{quantikz}
+% $$
+% \tcblower
+% \begin{lstlisting}
+% $$
+% \begin{quantikz}[baseline=(W.base)]
+% \lstick{\ket{0}} & \qw & \ctrl{1} & \qw \\
+% & \gate{H} & \targ{} & \alias{W} \qw
+% \end{quantikz}
+% \equiv\begin{quantikz}[baseline=(W.base)]
+% & \gate{H} & \gate{X} & \alias{W} \qw
+% \end{quantikz}
+% $$
+% \end{lstlisting}
+% \end{Code}
+% This has aligned the bottom wire of the first circuit with the wire in the second circuit, making the correspondence more obvious. However, the $\equiv$ sign is now in the wrong place, with its baseline placed at the same point as the baseline of the circuits. We can fix this with a vertical shift of the two diagrams. We demonstrate two different ways of achieving the same effect (the only important feature is that both diagrams have the same shift).
+% \begin{Code}
+% $$
+% \begin{quantikz}[baseline={($(W.base)+0.3*(0,1cm)$)}]
+% \lstick{\ket{0}} & \qw & \ctrl{1} & \qw \\
+% & \gate{H} & \targ{} & \alias{W} \qw
+% \end{quantikz}
+% \equiv\begin{quantikz}[baseline={([yshift=0.3cm]new.base)}]
+% & \gate{H} & \gate{X} & \alias{new} \qw
+% \end{quantikz}
+% $$
+% \tcblower
+% \begin{lstlisting}
+% $$
+% \begin{quantikz}[baseline={($(W.base)+0.3*(0,1cm)$)}]
+% \lstick{\ket{0}} & \qw & \ctrl{1} & \qw \\
+% & \gate{H} & \targ{} & \alias{W} \qw
+% \end{quantikz}
+% \equiv\begin{quantikz}[baseline={([yshift=0.3cm]new.base)}]
+% & \gate{H} & \gate{X} & \alias{new} \qw
+% \end{quantikz}
+% $$
+% \end{lstlisting}
+% \end{Code}
+
+% If you have an even number if wires, you might choose to calculate the centre of the circuit from \verb!current bounding box.center!, or you could perform a calculation to average the position of two wires. This calculation can then be adjusted to take into account the desire to vertically align on the centre of an equals sign rather than the baseline (which is below the bottom of the equals)
+
+% \begin{Code}
+% $$
+% \begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}]
+% & \gate{X} & \ctrl{1} & \alias{W} \qw \\
+% & \ghost{X}\qw & \targ{} & \alias{W2} \qw
+% \end{quantikz}
+% =\begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}]
+% & \ctrl{1} & \gate{X} & \qw \\
+% & \targ{}  & \gate{X} & \qw
+% \end{quantikz}
+% $$
+% \tcblower
+% \begin{lstlisting}
+% $$
+% \begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}]
+% & \gate{X} & \ctrl{1} & \alias{W} \qw \\
+% & \ghost{X}\qw & \targ{} & \alias{W2} \qw
+% \end{quantikz}
+% =\begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}]
+% & \ctrl{1} & \gate{X} & \qw \\
+% & \targ{}  & \gate{X} & \qw
+% \end{quantikz}
+% $$
+% \end{lstlisting}
+% \end{Code}
+
+% For more details on the possible syntax here, see the \verb!calc! library in tikz.
+
 \subsection{Scaling}
 
 When we altered the spacing, that left all the gate elements, text etc.\ the same size, and just altered the spacing between them. If you want to override the standard size of a circuit (gate elements, text and spacing), you can make it a node inside a \verb!tikzpicture!:
@@ -855,7 +979,7 @@
 \begin{Code}
 \begin{center}
 \begin{quantikz}
-& \gate[style={fill=red!20},label style=cyan]{H} & \phase[green,label position=above]{\beta} & \gate{H} & \qw & \meter{$\ket{\pm}$}
+& \gate[style={fill=red!20},label style=cyan]{H} & \phase[green,label position=above]{\beta} & \gate{H} & \qw & \meter[draw=blue]{$\ket{\pm}$}
 \end{quantikz}
 \end{center}
 \tcblower
@@ -863,7 +987,7 @@
 \begin{quantikz}
 & \gate[style={fill=red!20},label style=cyan]{H} 
   & \phase[green,label position=above]{\beta} 
-  & \gate{H} & \qw & \meter{$\ket{\pm}$}
+  & \gate{H} & \qw & \meter[draw=blue]{$\ket{\pm}$}
 \end{quantikz}
 \end{lstlisting}
 \end{Code}
@@ -872,7 +996,7 @@
 \begin{tabular}{p{0.4\textwidth}|p{0.4\textwidth}}
 gates that don't accept formatting parameters & \verb!\qw!,\verb!\vqw!,\verb!\qwbundle!,\verb!\cw!,\verb!\vcw!,\verb!\cwbend!,\verb!\push!	\\
 \hline
-gates that accept tikz node formatting keys directly in optional argument & \verb!\phase!, \verb!\control!, \verb!\ocontrol!, \verb!\targ!, \verb!\targX!, \verb!\meter!, \verb!\meterD!, \verb!\measure!, \verb!\measuretab!, \verb!\wave! \\
+gates that accept tikz node formatting keys directly in optional argument & \verb!\phase!, \verb!\control!, \verb!\ocontrol!, \verb!\targ!, \verb!\targX!, \verb!\trash!, \verb!\meter!, \verb!\meterD!, \verb!\measure!, \verb!\measuretab!, \verb!\wave! \\
 \hline
 gates that accept node formatting keys as \verb!label style! key in optional argument & \verb!\gate!, \verb!\slice!, \verb!\lstick!, \verb!\rstick!, \verb!\gategroup!, \verb!\gateinput!, \verb!\gateoutput!
 \end{tabular}
@@ -898,7 +1022,7 @@
 \lstick{$\ket{0}$} & \qw & \targ{} & \qw & \qw & \qw & \ctrl{3} & \qw & \qw \\
 \lstick{$\ket{0}$} & \qw & \targ{}& \qw & \qw & \qw & \qw & \ctrl{2} & \qw\\
 &&&&\lstick{$\ket{0}$} & \targ{} & \targ{} & \qw & \meter{} \\
-&&&&\lstick{$\ket{0}$} & \qw & \targ{} & \targ{} & \meter{} 
+&&&&\lstick{$\ket{0}$} & \qw & \targ{} & \targ{} & \meter[draw=blue]{} 
 \end{quantikz}
 \end{center}
 \tcblower
@@ -910,7 +1034,7 @@
 \lstick{$\ket{0}$} & \qw & \targ{} & \qw & \qw & \qw & \ctrl{3} & \qw & \qw \\
 \lstick{$\ket{0}$} & \qw & \targ{}& \qw & \qw & \qw & \qw & \ctrl{2} & \qw\\
 &&&&\lstick{$\ket{0}$} & \targ{} & \targ{} & \qw & \meter{} \\
-&&&&\lstick{$\ket{0}$} & \qw & \targ{} & \targ{} & \meter{} 
+&&&&\lstick{$\ket{0}$} & \qw & \targ{} & \targ{} & \meter[draw=blue]{} 
 \end{quantikz}
 \end{lstlisting}
 \end{Code}
@@ -1033,6 +1157,24 @@
 \end{lstlisting}
 \end{Code}
 
+
+Creating an ebit. The single parameter is whatever text you want. The first optional parameter specifies the angle of the initial line relative to the vertical, which defaults to -45. The second optional parameter gives stylings for the text label.
+\begin{Code}
+\begin{center}
+\begin{tikzcd}
+& \makeebit[-60][blue]{test} & \qw & \qw \\
+ & & \qw & \qw
+\end{tikzcd}
+\end{center}
+\tcblower
+\begin{lstlisting}
+\begin{tikzcd}
+& \makeebit[-60][blue]{test} & \qw & \qw \\
+ & & \qw & \qw
+\end{tikzcd}
+\end{lstlisting}
+\end{Code}
+
 \section{Converting from QCircuit}
 
 I've updated all of my existing teaching materials from QCircuit to Quantikz with very little trouble. There are a few standard replacements:
@@ -1079,16 +1221,12 @@
 	every matrix/.style={ampersand replacement=\&}
 }
 \end{lstlisting}
-Beamer is particularly annoying with doing this. It probably helps to issue a global command
-\begin{lstlisting}
-\tikzcdset{
-	every matrix/.style={ampersand replacement=\&}
-}
-\end{lstlisting}
 somewhere in your document preamble. The tikzcd manual suggests another possible strategy, but I haven't had much success with it.
+\item If you're using a circuit diagram inside an \texttt{align} environment, the \texttt{tikzcd} environment works better than \texttt{quantikz}. You may also need to use the ampersand replacement strategy.
 \item If you have a \verb!\cwbend! in the bottom right cell of the matrix, sometimes you get an error (I have no understanding of why). Add an extra \& after, and all seems to be well.
 \item If you're using transparency, and the width of gates seems to be greater than you expected, it may be worthwhile removing the .aux file and recompiling. If your tex editor isn't good at resetting the .aux file, the system may be remembering older widths.
 \item The code provides definitions for \verb!\bra!, \verb!\ket!, \verb!\proj!, \verb!\braket!. If you don't like them, just define your own versions \emph{before} you load the quantikz library.
+\item Package load order: I've had reports that if you load certain packages in the wrong order it can create weird errors. For example, if you load the package cleveref after quantikz, and then use a split environment, it can lead to the error ``Only one \# is allowed per tab.''. Change the load order and it goes away. I have no idea why this happens.
 \end{itemize}
 
 For any bug reports (please make sure you've checked the above list first!) or feature requests, please contact alastair.kay at rhul.ac.uk.

Added: trunk/Master/texmf-dist/tex/latex/quantikz/quantikz.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/quantikz/quantikz.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/quantikz/quantikz.sty	2020-04-27 21:15:37 UTC (rev 54911)
@@ -0,0 +1,11 @@
+%This is the quantikz library for typesetting quantum circuits using LaTeX/Tikz. version 0.9.6
+% Written by Alastair Kay, 2018. Published under a CC-BY-4.0 licence
+% Please email me (alastair.kay at rhul.ac.uk) with any bug reports or feature requests.
+% If you find this library useful, please cite its usage in your work, using arXiv:1809.03842, and possibly the DOI: 10.17637/rh.7000520.
+% Usage is at your own risk.
+
+\ProvidesPackage{quantikz}[2020/04/27 typeset quantum circuit diagrams]
+\RequirePackage{tikz}[2013/12/13] % pgf version 3.0.0 required
+\usetikzlibrary{quantikz}
+
+\endinput


Property changes on: trunk/Master/texmf-dist/tex/latex/quantikz/quantikz.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz.code.tex	2020-04-27 18:46:48 UTC (rev 54910)
+++ trunk/Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz.code.tex	2020-04-27 21:15:37 UTC (rev 54911)
@@ -1,9 +1,20 @@
-%This is the quantikz library for typesetting quantum circuits using LaTeX/Tikz. version 0.9.4
+%This is the quantikz library for typesetting quantum circuits using LaTeX/Tikz. version 0.9.6
 % Written by Alastair Kay, 2018. Published under a CC-BY-4.0 licence
 % Please email me (alastair.kay at rhul.ac.uk) with any bug reports or feature requests.
 % If you find this library useful, please cite its usage in your work, using arXiv:1809.03842, and possibly the DOI: 10.17637/rh.7000520.
 % Usage is at your own risk.
 
+%version 0.9.6:
+%	changed packaging so there isn't a compile warning any more
+%	modified the meter command so that \meter[draw=blue]{} colours everything blue, not just outline.
+%	added trash command
+%	added \ctrlbundle command so that \ctrl works well with \qwbundle[alternate]. If you supple \ctrlbundle[2]{}, then the bundle only contains 2 wires instead of the default of 3
+%	\qwbundle[alternate] now also works with the parameter \qwbundle[alternate=2] to only have 2 wires in the bundle.
+%	added \midstick. Works a bit like rstick and lstick, but reserves space for the text. Can choose to have brackets=none|left|right|both (default is both). Gives better method for circuit identities and other things.
+%	added "align equals at" key for setting circuit identities (specifies wire number that should line up with equals. can be non-integer)
+%	added makeebit command. accepts one parameter which is the text. Haven't got tyling and different angles of the split working yet.
+%   added bundle option to supplement nwires and cwires.
+%	fixed bug where you couldn't put a wire command after the declaration of a multi-qubit gate command.
 %version 0.9.5:
 %	fixed bug which meant multi-wire gates didn't work outside of an environment such as center.
 %version 0.9.4:
@@ -32,13 +43,13 @@
 %version 0.9.0:
 %original release.
 
-\ProvidesPackage{quantikz}[2019/04/24 typeset quantum circuit diagrams]
+%\ProvidesPackage{quantikz}[2020/04/27 typeset quantum circuit diagrams]
 
 % Package(s) to include
-\RequirePackage{xargs,ifthen,xstring,xparse,etoolbox,mathtools}
+\RequirePackage{xargs,ifthen,xstring,xparse,etoolbox,mathtools,pgfmath}
 \RequirePackage{environ} %in an attempt to help with compatibility with the external library of tikz.
-\RequirePackage{tikz}
-\usetikzlibrary{cd,decorations.pathreplacing,calc,positioning,fit,shapes.symbols,decorations.pathmorphing,shapes.misc,backgrounds,decorations.markings}
+%\RequirePackage{tikz}
+\usetikzlibrary{cd,decorations.pathreplacing,calc,positioning,fit,shapes.symbols,decorations.pathmorphing,shapes.misc,backgrounds,decorations.markings,math}
 
 \newlength{\myl}
 \newlength{\myh}
@@ -126,6 +137,10 @@
 % 	\minwidth
 % }
 
+%find the vertical position of the middle of an equals sign
+%https://tex.stackexchange.com/questions/355680/how-can-i-vertically-align-an-equals-sign-in-a-tikz-node/355686
+\pgfmathsetmacro\MathAxis{height("$\vcenter{}$")}
+
 %the main gate command
 \DeclareExpandableDocumentCommand{\gate}{O{}O{1.5pt}O{1.5pt}m}{%optional parameter contains styling info. compulsory is gate text.
 	|[inner sep=4pt,minimum width=#2,minimum height=#3]|%
@@ -143,6 +158,7 @@
  	\pgfkeysgetvalue{/quantikz/label style}{\b}
  	\pgfkeysgetvalue{/quantikz/cwires}{\mylist}
  	\pgfkeysgetvalue{/quantikz/nwires}{\nowires}
+ 	\pgfkeysgetvalue{/quantikz/bundle}{\bundle}
  	\ifthenelse{\toswap=1}{%if it's a swap gate...
  		\def\quantwires{2}
  		\phantom{wide}
@@ -162,7 +178,7 @@
  		}
  	}
 %	
- 	\IfInList{1}{\mylist}{\cw}{\IfInList{1}{\nowires}{}{\qw}}%do we need classical, no wire, or quantum wire?
+ 	\IfInList{1}{\mylist}{\cw}{\IfInList{1}{\nowires}{}{\IfInList{1}{\bundle}{\qwbundle[alternate]{}}{\qw}}}%do we need classical, no wire, or quantum wire?
  	\edef\k{\the\numexpr\n+\quantwires-1\relax}
  	\edef\mn{\the\numexpr\m-1\relax}
  	\ifthenelse{\quantwires=1}{}{%more than 1 wire on gate. iterate through each wire
@@ -169,22 +185,25 @@
  	\foreach \i in {\the\numexpr\n+1\relax,...,\k} {
  	    \edef\newcom{\noexpand\vcwhexplicit{\i-\m}{\i-\mn}}
        	\edef\newcomb{\noexpand\vqwexplicit{\i-\m}{\i-\mn}}
+       	\edef\newcomc{\noexpand\vqbundleexplicit{\i-\m}{\i-\mn}}
  	 	\edef\val{\the\numexpr\i+1-\n\relax}
- 		\IfInList{\val}{\mylist}{\newcom}{\IfInList{\val}{\nowires}{}{\newcomb}}%do we need classical, no wire, or quantum wire?
+ 		\IfInList{\val}{\mylist}{\newcom}{\IfInList{\val}{\nowires}{}{\IfInList{\val}{\bundle}{\newcomc}{\newcomb}}}%do we need classical, no wire, or quantum wire?
  		%apply auto width to the cell, and make sure we unset the setting so that it doesn't apply to later circuits.
+ 		%I think use of globaldefs in this way is very slow, but I don't know of a better way.
  		\globaldefs=1
- 		\edef\dotikzset{\noexpand\tikzset{row \i\space column \m/.append style={minimum width={max(\the\myl+8pt,#2)}}}}
- 		\dotikzset
- 		\edef\undotikzset{\noexpand\tikzset{row \i\space column \m/.style={}}}
-      	\expandafter\pgfutil at g@addto at macro\expandafter\tikzcd at atendglobals\expandafter{\undotikzset}
+ 		\edef\dotikzset{\noexpand\tikzset{row \i\space column \m/.append style={minimum width={max(\the\myl+8pt,#2)}}}}%
+ 		\dotikzset%
+ 		\edef\undotikzset{\noexpand\tikzset{row \i\space column \m/.style={}}}%
+      	\expandafter\pgfutil at g@addto at macro\expandafter\tikzcd at atendglobals\expandafter{\undotikzset}%
  	}
  			%apply auto height to last row only. unsetting already handled above.
- 		   \globaldefs=1
- 		   \edef\dotikzset{\noexpand\tikzset{row \k\space column \m/.append style={minimum height={max(\the\myh+\the\myd+8pt,#3)}}}}
- 		   \dotikzset
+ 		   \globaldefs=1%
+ 		   \edef\dotikzset{\noexpand\tikzset{row \k\space column \m/.append style={minimum height={max(\the\myh+\the\myd+8pt,#3)}}}}%
+ 		   \dotikzset%
+ 		   \globaldefs=0%
 %		
  	}
- 	%call deferred gate command.
+ 	%call deferred gate command. to be executed after the tikzcd matrix stuff is completed
 	\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgfutil at g@addto at macro\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\tikzcd at atendsavedpaths\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{%
 		\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\gate at end\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter\a\expandafter\expandafter\expandafter}\expandafter\expandafter\expandafter{\expandafter\b\expandafter}\expandafter{\options}{#4}
 	}
@@ -195,12 +214,13 @@
 	\pgfkeys{/quantikz,wires=1}
 	\def\toswap{0}
 	\def\DisableMinSize{0}
- 	\pgfkeys{/quantikz,#3}%
+ 	\pgfkeys{/quantikz,#3}%import options
 	\pgfkeysgetvalue{/quantikz/wires}{\quantwires}
 	\pgfkeysgetvalue{/quantikz/row}{\row}
 	\pgfkeysgetvalue{/quantikz/col}{\col}
 	\ifthenelse{\toswap=1}{\def\quantwires{2}}{}
 	\xdef\LoopGG{}
+	%create a list of cell names to be included in this grouped gate
 	\foreach \n in  {\row,...,\the\numexpr\row+\quantwires-1\relax} {
 	\ifnodedefined{\tikzcdmatrixname-\n-\col}{
 		\xdef\LoopGG{\LoopGG(\tikzcdmatrixname-\n-\col)}
@@ -212,6 +232,7 @@
 		\draw [line width=3pt,white,shorten >=0.9pt,shorten <=0.9pt] (group\tikzcdmatrixname-\row-\col.east|-\tikzcdmatrixname-\row-\col.center) to[out=180,in=0] (group\tikzcdmatrixname-\row-\col.west|-\tikzcdmatrixname-\the\numexpr\row+1\relax-\col.center);
 		\draw [thickness] (group\tikzcdmatrixname-\row-\col.east|-\tikzcdmatrixname-\row-\col.center) to[out=180,in=0] (group\tikzcdmatrixname-\row-\col.west|-\tikzcdmatrixname-\the\numexpr\row+1\relax-\col.center);
 	}{
+	%the actual gate drawing command
 	  \node (group\tikzcdmatrixname-\row-\col) [fit=\LoopGG,operator,inner sep=0pt,label={[gg label,#2]$#4$},#1] {\hphantom{$#4$}};
 	}
 }
@@ -290,6 +311,41 @@
 		\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\groupoutput at end\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter\newoptions\expandafter\expandafter\expandafter}\expandafter\expandafter\expandafter{\expandafter\options\expandafter}\expandafter{\opts}{#2}%
 	}
 }
+
+\newcommand\midstick[2][]{%
+	\hphantom{\text{gg#2gg}}\ %leave enough space for whatever text we've inserted
+	\pgfkeys{/quantikz,wires=1,style=,label style=,braces=}
+	\pgfkeys{/quantikz,#1}%
+	\edef\newoptions{row=\the\pgfmatrixcurrentrow,col=\the\pgfmatrixcurrentcolumn,#1}
+	\pgfkeysgetvalue{/quantikz/wires}{\quantwires}
+	\pgfkeysgetvalue{/quantikz/label style}{\options}
+	\pgfkeysgetvalue{/quantikz/braces}{\opts}
+	 \edef\n{\the\pgfmatrixcurrentrow} %the row
+ 	\edef\m{\the\pgfmatrixcurrentcolumn} %the column
+	\edef\mn{\the\numexpr\m-1\relax}
+	\edef\k{\the\numexpr\n+\quantwires-1\relax}
+	\settowidth{\myl}{gg#2gg}
+	%if more than 1 wire, need to reserve space for each wire
+	\ifthenelse{\quantwires=1}{}{
+	 	\foreach \i in {\the\numexpr\n+1\relax,...,\k} {
+ 	 	\edef\val{\the\numexpr\i+1-\n\relax}
+ 		%apply auto width to the cell, and make sure we unset the setting so that it doesn't apply to later circuits.
+ 		%I think use of globaldefs in this way is very slow, but I don't know of a better way.
+ 		\globaldefs=1
+ 		\edef\dotikzset{\noexpand\tikzset{row \i\space column \m/.append style={minimum width={\the\myl}}}}
+ 		\dotikzset
+ 		\edef\undotikzset{\noexpand\tikzset{row \i\space column \m/.style={}}}
+      	\expandafter\pgfutil at g@addto at macro\expandafter\tikzcd at atendglobals\expandafter{\undotikzset}
+      	\globaldefs=0
+ 	}
+%		
+ 	}
+	%\edef\n{\the\pgfmatrixcurrentrow}
+	%\edef\m{\the\pgfmatrixcurrentcolumn}
+	\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgfutil at g@addto at macro\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\tikzcd at atendsavedpaths\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{%
+		\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\groupoutput at mid\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter\newoptions\expandafter\expandafter\expandafter}\expandafter\expandafter\expandafter{\expandafter\options\expandafter}\expandafter{\opts}{#2}%
+	}
+}
 %deferred labelling of inputs
 \newcommand{\groupinput at end}[4]{%basic data as keys, lable options, brace options, text
 	\pgfkeys{/quantikz,wires=1}
@@ -311,7 +367,7 @@
 	}
 } %
 %deferred labelling of outputs
-\newcommand{\groupoutput at end}[4]{%basic data as keys, lable options, brace options, text
+\newcommand{\groupoutput at end}[4]{%basic data as keys, label options, brace options, text
 	\pgfkeys{/quantikz,wires=1}
  	\pgfkeys{/quantikz,#1}%
 	\pgfkeysgetvalue{/quantikz/wires}{\quantwires}
@@ -329,6 +385,31 @@
 	\draw[dd,#3] ($(outgr-\row.north east)+(0.1cm,0.1cm)$) to node[midway,align=center,anchor=west,xshift=0.1cm,#2] {#4} ($(outgr-\row.south east)+(0.1cm,-0.1cm)$);
 	}
 } %
+%deferred labelling in the middle of circuits
+\newcommand{\groupoutput at mid}[4]{%basic data as keys, label options, brace options, text
+	\pgfkeys{/quantikz,wires=1}
+	\def\leftbrace{1}\def\rightbrace{1}
+ 	\pgfkeys{/quantikz,#1}%
+	\pgfkeysgetvalue{/quantikz/wires}{\quantwires}
+	\pgfkeysgetvalue{/quantikz/row}{\row}
+	\pgfkeysgetvalue{/quantikz/col}{\col}
+	\xdef\LoopGO{}
+	\foreach \n in  {\row,...,\the\numexpr\row+\quantwires-1\relax} {
+		\ifnodedefined{\tikzcdmatrixname-\n-\col}{
+			\xdef\LoopGO{\LoopGO(\tikzcdmatrixname-\n-\col)} 
+		}}
+		\ifthenelse{\quantwires=1} {
+		\node (midgr-\row-\col) [fit=\LoopGO, inner sep=0pt,label={[align=center,#2]#4}] {};
+	}{
+	\node (midgr-\row-\col) [fit=\LoopGO, inner sep=0pt,label={[anchor=mid,#2]center:#4}] {};
+	\ifthenelse{\rightbrace=1}{
+	\draw[dm,#3] ($(midgr-\row-\col.north east)+(-0.1cm,0.05cm)$) to ($(midgr-\row-\col.south east)+(-0.1cm,-0.05cm)$);
+	}{}
+	\ifthenelse{\leftbrace=1}{
+	\draw[dd,#3] ($(midgr-\row-\col.north west)+(0.1cm,0.05cm)$) to ($(midgr-\row-\col.south west)+(0.1cm,-0.05cm)$);
+	}{}
+	}
+} %
 %inputs and outputs within a multi-wire gate
 \newcommand\gateinput[2][]{%
 	\pgfkeys{/quantikz,wires=1,style=,label style=,braces=}%
@@ -409,6 +490,14 @@
 	\node (wave-#1) [fit=(\tikzcdmatrixname-row#1),wave,#2] {};
 }
 
+\DeclareDocumentCommand{\makeebit}{O{-45}O{}m}{
+	\arrow[arrows,line cap=round,to path={(\tikztostart) -- ($(\tikztostart)!{0.5/cos(#1)}!#1:(\tikztotarget)$) node [anchor=east,style={#2}]{#3} -- (\tikztotarget) }]{d}
+}
+
+% \newcommand{\makeebit}[2][-45]{
+% 	\arrow[arrows,line cap=round,to path={(\tikztostart) -- ($(\tikztostart)!0.707!#1:(\tikztotarget)$) node [anchor=east]{#2} -- (\tikztotarget) }]{d}
+% }
+
 %put a border around a group of gates
 \newcommand\gategroup[2][]{%
 	\pgfkeys{/quantikz,wires=1,style=,label style=,braces=}
@@ -484,7 +573,7 @@
     \def\errmessage##1{\tikzcd at errmessage{##1^^J...^^Jl.\tikzcd at lineno\space%
         I think the culprit is a tikzcd arrow in cell \tikzcd at currentrow-\tikzcd at currentcolumn}}%
     \tikzcd at before@paths at hook%
-    \tikzcd at savedpaths\tikzcd at atendsavedpaths\tikzcd at atendlabels\tikzcd at atendslices{\globaldefs=1\tikzcd at atendglobals}%I just added stuff here instead
+    \tikzcd at savedpaths\tikzcd at atendsavedpaths\tikzcd at atendlabels\tikzcd at atendslices{\globaldefs=1\tikzcd at atendglobals\globaldefs=0}%I just added stuff here instead
   \endgroup%
   \end{tikzpicture}%
   \ifnum0=`{}\fi}
@@ -521,15 +610,37 @@
 	}
 }
 
-%initialise all the pgfkeys for key=value parametre passing in macro options
+%take a parameter, row number, where we want to set the baseline. if not integer, use the two rows spanned
+\providecommand{\setmiddle}[1]{%
+\IfInteger{#1}{
+\pgfmathtruncatemacro\wholepart{floor(#1)}
+\edef\temp{\noexpand\tikzset{%
+/tikz/baseline={([yshift=-\MathAxis]\noexpand\tikzcdmatrixname-\wholepart-1.base)}
+}}
+%\show\temp
+\temp
+}{%
+\pgfmathtruncatemacro\wholepart{floor(#1)}
+\pgfmathtruncatemacro\neighbour{floor(#1)+1}
+\pgfmathsetmacro\fractionalpart{#1-floor(#1)}
+\edef\temp{\noexpand\tikzset{%
+/tikz/baseline={([yshift=-\MathAxis]$(\noexpand\tikzcdmatrixname-\wholepart-1.base)!\fractionalpart!(\noexpand\tikzcdmatrixname-\neighbour-1.base)$)}
+}}
+%\show\temp
+\temp
+}
+}
 
-\pgfkeys{/tikz/slice all/.code={\def\toslice{1}},/tikz/remove end slices/.initial=0,/tikz/slice titles/.initial={\col},/tikz/slice style/.initial={},/tikz/slice label style/.initial={},/tikz/thin lines/.code={\resetstyles},/tikz/transparent/.code={\maketransparent},/tikz/vertical slice labels/.code={\def\vert{1}}}
+%initialise all the pgfkeys for key=value parameter passing in macro options
+
+\pgfkeys{/tikz/slice all/.code={\def\toslice{1}},/tikz/remove end slices/.initial=0,/tikz/slice titles/.initial={\col},/tikz/slice style/.initial={},/tikz/slice label style/.initial={},/tikz/thin lines/.code={\resetstyles},/tikz/transparent/.code={\maketransparent},/tikz/vertical slice labels/.code={\def\vert{1}},/tikz/align equals at/.code={\setmiddle{#1}}}
 \pgfkeys{/quantikz/.is family,/quantikz,%
 .unknown/.style={%
 	/quantikz/wires=\pgfkeyscurrentname
 },%
 wires/.initial=1,%
-style/.initial={},label style/.initial={},braces/.initial={},background/.code={\def\background{1}},alternate/.code={\def\helper{1}},row/.initial=1,col/.initial=1,steps/.initial=1,Strike Width/.initial=0.08cm,Strike Height/.initial=0.12cm,swap/.code={\def\toswap{1}},disable auto height/.code={\def\DisableMinSize{1}},cwires/.initial={-1},nwires/.initial={-1}}
+style/.initial={},label style/.initial={},braces/.initial={},background/.code={\def\background{1}},alternate/.default=1,alternate/.code={\def\helper{#1}},row/.initial=1,col/.initial=1,steps/.initial=1,Strike Width/.initial=0.08cm,Strike Height/.initial=0.12cm,swap/.code={\def\toswap{1}},disable auto height/.code={\def\DisableMinSize{1}},cwires/.initial={-1},nwires/.initial={-1},bundle/.initial={-1},brackets/.is choice,brackets/.initial=both}
+\pgfkeys{/quantikz,brackets/.cd,none/.code={\def\leftbrace{0}\def\rightbrace{0}},left/.code={\def\leftbrace{1}\def\rightbrace{0}},right/.code={\def\leftbrace{0}\def\rightbrace{1}},both/.code={\def\leftbrace{1}\def\rightbrace{1}}}
 
 %my standard Dirac notation commands. can be overridden by user.
 \providecommand{\ket}[1]{\ensuremath{\left|#1\right\rangle}}
@@ -554,9 +665,12 @@
 \DeclareExpandableDocumentCommand{\measuretab}{O{}{m}}{|[measuretab,#1]| {#2} \qw}
 \DeclareExpandableDocumentCommand{\meterD}{O{}{m}}{|[meterD,#1]| {#2} \qw}
 \DeclareExpandableDocumentCommand{\measure}{O{}{m}}{|[measure,#1]| {#2} \qw}
+\DeclareExpandableDocumentCommand{\trash}{O{}{m}}{|[trash,label={below:#2},#1]| {} \qw}
 
+
 %controlled gates
 \def\ctrl#1{\control{}	\vqw{#1}}
+\DeclareExpandableDocumentCommand{\ctrlbundle}{O{1}O{}m}{|[phase bundle,#2]| {} \vqw{#3}\qwbundle[alternate=#1]{}}
 \def\octrl#1{\ocontrol{}\vqw{#1}}
 \def\swap#1{%
 	\targX{}
@@ -582,6 +696,9 @@
 \newcommand{\vqwexplicit}[2]{
 	\arrow[from=#1,to=#2,arrows] {}
 }
+\newcommand{\vqbundleexplicit}[2]{
+	\arrow[from=#1,to=#2,arrows] {} \arrow[from=#1,to=#2,arrows,yshift=0.1cm] {}\arrow[from=#1,to=#2,arrows,yshift=-0.1cm] {}
+}
 %classical vertical wire, absolute positioning
 \newcommand{\vcwexplicit}[2]{
 	\arrow[from=#1,to=#2,arrows,xshift=0.05cm] {}\arrow[from=#1,to=#2,arrows,xshift=-0.05cm] {}
@@ -604,10 +721,12 @@
 \newcommand{\qwbundle}[2][]{\ifthenelse{\the\pgfmatrixcurrentcolumn>1}{
 	\def\helper{0}
 	\pgfset{/quantikz,#1}
-	\ifthenelse{\helper=1}{
-		\arrow[arrows,yshift=0.1cm]{l}\arrow[arrows]{l}\arrow[arrows,yshift=-0.1cm]{l}
+	\ifthenelse{\helper>0}{
+		\arrow[arrows,yshift=0.1cm]{l}
+		\ifthenelse{\helper=1}{\arrow[arrows]{l}}{}
+		\arrow[arrows,yshift=-0.1cm]{l}
 	}{
-	\arrow[phantom,strike arrow]{l}[xshift=\pgfkeysvalueof{/quantikz/Strike Width}, yshift=\pgfkeysvalueof{/quantikz/Strike Height},anchor=south west,inner sep=0pt]{\scriptstyle #2}
+	\arrow[phantom,strike arrow]{l}[xshift=\pgfkeysvalueof{/quantikz/Strike Width}, yshift=\pgfkeysvalueof{/quantikz/Strike Height},anchor=south west,inner sep=0pt]{\scriptstyle #2}\qw
 	}}{}}
 
 
@@ -629,6 +748,7 @@
     rightinternal/.style={anchor=mid east,font=\scriptsize,inner sep=4pt,align=center},
     wave/.style={inner sep=-3pt,tape,fill=white,apply={draw=black} except on segments {5,6,1,2,9}},
     phase/.style={fill,shape=circle,minimum size=4pt},
+    phase bundle/.style={fill,shape=rectangle,rounded corners=1.5pt,minimum width=4pt,minimum height=10pt},
     phase label/.style={label distance=2mm,anchor=mid,label position=45},
     ophase/.style={fill=white,draw=black,shape=circle,minimum size=4pt},
     internal/.style={thickness,black},
@@ -645,11 +765,12 @@
 (path picture bounding box.south east) -- (path picture bounding box.north west) (path picture bounding box.south west) -- (path picture bounding box.north east) (path picture bounding box.west) -- (path picture bounding box.east);
 }},
 	crossx2/.style={circle,crossx,minimum size=1em},
+	trash/.style={path picture={\draw[internal,inner sep=0pt,-stealth] (path picture bounding box.west) -- (path picture bounding box.center) -- (path picture bounding box.south);},minimum height=2.5em,minimum width=2em},
     dd/.style={decoration={brace},decorate,thickness},
     dm/.style={decoration={brace,mirror},decorate,thickness},
     slice/.style={thickness,red,dash pattern=on 5pt off 3pt,align=center},
     meter/.style={draw,fill=white,minimum width=2em,minimum height=1.5em, rectangle, font=\vphantom{A}, thickness,
- path picture={\draw[black] ([shift={(.1,.24)}]path picture bounding box.south west) to[bend left=50] ([shift={(-.1,.24)}]path picture bounding box.south east);\draw[black,-{Latex[scale=0.6]}] ([shift={(0,.1)}]path picture bounding box.south) -- ([shift={(.3,-.1)}]path picture bounding box.north);}},
+ path picture={\draw ([shift={(.1,.24)}]path picture bounding box.south west) to[bend left=50] ([shift={(-.1,.24)}]path picture bounding box.south east);\draw[-{Latex[scale=0.6]}] ([shift={(0,.1)}]path picture bounding box.south) -- ([shift={(.3,-.1)}]path picture bounding box.north);}},
  	measuretab/.style={draw,signal,signal to=west,inner sep=4pt,fill=white},
  	meterD/.style={draw,rounded rectangle,rounded rectangle left arc=none,inner sep=4pt,fill=white},
  	measure/.style={draw,rounded rectangle,inner sep=4pt,fill=white},



More information about the tex-live-commits mailing list.