diff options
author | Karl Berry <karl@freefriends.org> | 2020-04-27 21:15:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-04-27 21:15:37 +0000 |
commit | b6f15800b52e006097c3a2e6f18f0ff713545558 (patch) | |
tree | 92d4c9446de3da0c9f90210d0b93d32368a92472 /Master/texmf-dist/doc | |
parent | 3e9e014c35b9feb948e7f4bf082a9ec5d45c05a2 (diff) |
quantikz (27apr20)
git-svn-id: svn://tug.org/texlive/trunk@54911 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/latex/quantikz/quantikz.pdf | bin | 513931 -> 510921 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/quantikz/quantikz.tex | 294 |
2 files changed, 216 insertions, 78 deletions
diff --git a/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf b/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf Binary files differindex 39a11433e58..6e99c7bc66b 100644 --- a/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf +++ b/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf diff --git a/Master/texmf-dist/doc/latex/quantikz/quantikz.tex b/Master/texmf-dist/doc/latex/quantikz/quantikz.tex index 1153b735af5..72784f67e76 100644 --- a/Master/texmf-dist/doc/latex/quantikz/quantikz.tex +++ b/Master/texmf-dist/doc/latex/quantikz/quantikz.tex @@ -128,6 +128,20 @@ Since we have built quantikz on top of tikzcd, any of the standard arrow command \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 @@ You can access an alternative form for the multi-qubit wire using the \verb!alte \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 @@ If you want to use classical controls with both horizontal and vertical componen \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 @@ Sometimes, it might be that you want a multi-line label, and it should not be th \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,90 +660,167 @@ If you cannot identify the offending gate, and particularly if the operation is \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 -\end{quantikz} -\equiv -\begin{quantikz}[baseline=(W.base)] -& \gate{H} & \gate{X} & \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} -$$ +\end{center} \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 +\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} -$$ \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 -\end{quantikz} -\equiv\begin{quantikz}[baseline={([yshift=0.3cm]new.base)}] -& \gate{H} & \gate{X} & \alias{new} \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} -$$ +\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 -\end{quantikz} -\equiv\begin{quantikz}[baseline={([yshift=0.3cm]new.base)}] -& \gate{H} & \gate{X} & \alias{new} \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} -$$ \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 -\end{quantikz} -=\begin{quantikz}[baseline={($(W.base)!.5!(W2.base) - height("$\vcenter{}$")*(0,1pt)$)}] -& \ctrl{1} & \gate{X} & \qw \\ -& \targ{} & \gate{X} & \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} -$$ +\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}[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{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}[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{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} @@ -855,7 +979,7 @@ Individual gates can be modified using optional arguments of the calling functio \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 @@ Individual gates can be modified using optional arguments of the calling functio \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 @@ The specific syntax varies a little depending on the type of gate \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 @@ This styling is really quite flexible, as we can override the default shapes wit \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 @@ This styling is really quite flexible, as we can override the default shapes wit \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 @@ A wave for separating rows. Do we really need this? Perhaps not, but it's fun! \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 @@ Beamer is particularly annoying with doing this. It probably helps to issue a gl 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@rhul.ac.uk. |