summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/quantikz/README.md4
-rw-r--r--Master/texmf-dist/doc/latex/quantikz/quantikz.pdfbin676349 -> 680113 bytes
-rw-r--r--Master/texmf-dist/doc/latex/quantikz/quantikz.tex17
-rw-r--r--Master/texmf-dist/tex/latex/quantikz/quantikz.sty4
-rw-r--r--Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz2.code.tex56
5 files changed, 59 insertions, 22 deletions
diff --git a/Master/texmf-dist/doc/latex/quantikz/README.md b/Master/texmf-dist/doc/latex/quantikz/README.md
index bd869cdbebd..5210c711450 100644
--- a/Master/texmf-dist/doc/latex/quantikz/README.md
+++ b/Master/texmf-dist/doc/latex/quantikz/README.md
@@ -4,4 +4,6 @@ The package is quantikz, written by Alastair Kay. Its purpose is to extend tikz
It is covered by a CC-BY 4.0 license.
-Please see the manual for detailed usage. \ No newline at end of file
+Please see the manual for detailed usage.
+
+Two versions are provided: quantikz (v. 0.9.8) as for legacy purposes, and quantikz2, the current release. \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf b/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf
index c7ffea7fb30..b3ad72f4a2f 100644
--- a/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf
+++ b/Master/texmf-dist/doc/latex/quantikz/quantikz.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/quantikz/quantikz.tex b/Master/texmf-dist/doc/latex/quantikz/quantikz.tex
index 6f2a7710f88..7f6b5ee15a8 100644
--- a/Master/texmf-dist/doc/latex/quantikz/quantikz.tex
+++ b/Master/texmf-dist/doc/latex/quantikz/quantikz.tex
@@ -336,7 +336,7 @@ You can also slice every step by using option \verb!slice all!, and the labels w
If you need to adjust where the last slice is, use the optional parameter \verb!remove end slices!, which counts the number of columns fewer to add slices to. You can also change the title of each of the slices, by setting \verb!slice titles!. Include the macro \verb!\col! in your specification if you want to use the step number. Note, however, that the columns won't automatically space themselves out to accommodate a very wide label. You can style the slicing lines with the \verb!slice style! key, and the labels with \verb!slice label style!. These can be used to rotate the labels and create a bit more space!
\begin{Code}
\begin{quantikz}[slice all,remove end slices=1,slice titles=slice \col,slice style=blue,slice label style={inner sep=1pt,anchor=south west,rotate=40}]
-& \gate{H} & \ctrl{1} & \meter{} && \\
+& \gate{H} & \ctrl{1} & \meter{} &\setwiretype{n}& \\
& & \targ{} & \ctrl{1} & \gate{H} & \\
& & & \targ{} & &
\end{quantikz}
@@ -465,6 +465,19 @@ Places a quantum wire that occupies that same space as a single-qubit gate with
\end{quantikz}
\end{Code}
+\item [\textbackslash ghost{[w][h]}\{l\}]
+Creates an invisible quantum gate that has the same height as \verb!\gate[][w][h]{l}!. Just like any other gate command, this should come before any other commands in a cell, and cannot be in the same cell as another gate command.
+\begin{Code}
+\begin{quantikz}
+%give the wires the same vertical space as if they had H gates on them
+&&\ghost{H} \\
+&& \ghost{H}
+\end{quantikz}=\begin{quantikz}
+ & \gate{H} & \\
+ & \gate{H} &
+\end{quantikz}
+\end{Code}
+
\item [\textbackslash phase{[s]}\{l\}]
Creates a phase gate (black circle) with label \texttt{l}. The optional parameter \texttt{s} controls the styling via the parameters
@@ -696,7 +709,7 @@ Draw a wave along an entire row. \texttt{s} is standard tikz formatting commands
Present the text in label \texttt{l} as vertically stacked. Can be helpful for slices.
\item [\textbackslash ket\{l\}, \textbackslash bra\{l\}, \textbackslash proj\{l\}, \textbackslash braket\{l\}\{m\}]
-Typeset Dirac notation $\ket{l}$, $\bra{l}$, $\proj{l}$ and $\braket{l}{m}$ respectively. These commands do not require math mode, and the braces will automatically resize to the argument. They are defined to behave well with other packages (e.g.\ physics) that may define the same commands. If you wish to ensure that you are using the version that this package defines, run \textbackslash forceredefine at the end of your preamble (after all packages have loaded). You may also need to be careful of the order in which you load those packages.
+Typeset Dirac notation $\ket{l}$, $\bra{l}$, $\proj{l}$ and $\braket{l}{m}$ respectively. These commands do not require math mode, and the braces will automatically resize to the argument. They are defined to behave well with other packages (e.g.\ physics) that may define the same commands. You may need to be careful of the order in which you load those packages: load quantikz \emph{after} the other package --- if quantikz sees that those commands are already defined, it does not redefine them. If you wish to ensure that you are using the version that this package defines, run \textbackslash forceredefine at the end of your preamble (after all packages have loaded).
% % \item [\textbackslash alias\{n\}]
% % Used in an otherwise empty cell, that gives the current row a name \texttt{n}. This is useful for referring to it for the purposes of vertical positioning.
diff --git a/Master/texmf-dist/tex/latex/quantikz/quantikz.sty b/Master/texmf-dist/tex/latex/quantikz/quantikz.sty
index f0400333379..f1ecfaa75fb 100644
--- a/Master/texmf-dist/tex/latex/quantikz/quantikz.sty
+++ b/Master/texmf-dist/tex/latex/quantikz/quantikz.sty
@@ -1,10 +1,10 @@
-%This is the quantikz library for typesetting quantum circuits using LaTeX/Tikz. version 0.9.6
+%This is the quantikz library for typesetting quantum circuits using LaTeX/Tikz. version 1.0.1
% Written by Alastair Kay, 2018. Published under a CC-BY-4.0 licence
% Please email me (alastair.kay@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}[2023/04/03 typeset quantum circuit diagrams]
+\ProvidesPackage{quantikz}[2023/05/24 typeset quantum circuit diagrams]
\RequirePackage{tikz}[2013/12/13] % pgf version 3.0.0 required
\usetikzlibrary{quantikz2}
diff --git a/Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz2.code.tex b/Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz2.code.tex
index ac1c7ef8315..90a54a257d4 100644
--- a/Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz2.code.tex
+++ b/Master/texmf-dist/tex/latex/quantikz/tikzlibraryquantikz2.code.tex
@@ -1,9 +1,12 @@
-%This is the quantikz library for typesetting quantum circuits using LaTeX/Tikz. version 1.0.0
+%This is the quantikz library for typesetting quantum circuits using LaTeX/Tikz. version 1.0.1
% Written by Alastair Kay, 2018. Published under a CC-BY-4.0 licence
% Please email me (alastair.kay@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 1.0.1
+% the lstick/midstick/rstick commands now correctly resize braces if you're using classical wires based on wire types at the *end* of each wire (so rstick more likely to look good than lstick/midstick!.
+% fixed incompatibility if physics2 package (turned out we both used the same variable name somewhere)
%version 1.0.0
%major new revision with massive under-the-hood changes in how wires work.
%aiming to reduce technical debt in the code as well.
@@ -13,13 +16,7 @@
%some minor changes in optional parameters (e.g. \meter). In practice, these are rarely used, and unlikely to be an issue.
%should always use quantikz and not tikzcd environment
-
-%to-do
-%complete rewrite of manual
-%add isosceles triangle example to manual
-%fix ampersand replacement (is it even necessary any more?). Check beamer.
-
-%\ProvidesPackage{quantikz}[2023/04/03 typeset quantum circuit diagrams]
+%\ProvidesPackage{quantikz}[2023/05/24 typeset quantum circuit diagrams]
% Package(s) to include
\RequirePackage{xargs,ifthen,xstring,xparse,etoolbox,mathtools,pgfmath}
@@ -52,7 +49,7 @@
%full solution suggested here https://tex.stackexchange.com/a/682872/148934
\ExplSyntaxOn
\NewDocumentEnvironment{quantikz}{O{}+b}{
-\gdef\toslice{0}\def\vert{0}%
+\gdef\toslice@qtkz{0}\def\vert@qtkz{0}%
\begin{tikzpicture}[/tikz/commutative~diagrams/.cd, every~diagram,baseline={([yshift=-axis_height]\tikzcdmatrixname)}, #1]
\pgfsetlayers{background,quantback,main}
\tl_set:Nn \l_tmpa_tl { #2 }
@@ -102,7 +99,7 @@
%patch tikzcd to allow for multiple layers of commands that get deferred until later
% \patchcmd\tikzcd@{\tikzpicture}{%
-% \def\toslice{0}\def\vert{0}%
+% \def\toslice{0}\def\vert@qtkz{0}%
% \begin{tikzpicture}}{}{}
%\patchcmd\tikzcd@{\tikzpicture[/tikz/commutative diagrams/.cd,every diagram,#1]}{%
%}{}{}
@@ -123,8 +120,8 @@
\csgundef{cell@width@\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn}
\csgundef{cell@height@\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn}}
%\pgfmathsetmacro{\mname}{random(100000)}
- \ifcsstring{toslice}{1}{\ifcsstring{vert}{0}{\pgfutil@g@addto@macro\tikzcd@atendslices\sliceallr}{\pgfutil@g@addto@macro\tikzcd@atendslices\sliceallvr}}{}
- %\ifthenelse{\toslice=1}{\ifthenelse{\vert=0}{\PackageWarning{quantikz}{We are slicing}\pgfutil@g@addto@macro\tikzcd@atendslices\sliceallr}{\pgfutil@g@addto@macro\tikzcd@atendslices\sliceallvr}}{}
+ \ifcsstring{toslice@qtkz}{1}{\ifcsstring{vert@qtkz}{0}{\pgfutil@g@addto@macro\tikzcd@atendslices\sliceallr}{\pgfutil@g@addto@macro\tikzcd@atendslices\sliceallvr}}{}
+ %\ifthenelse{\toslice=1}{\ifthenelse{\vert@qtkz=0}{\PackageWarning{quantikz}{We are slicing}\pgfutil@g@addto@macro\tikzcd@atendslices\sliceallr}{\pgfutil@g@addto@macro\tikzcd@atendslices\sliceallvr}}{}
}{}{}
%this patching works on modern systems, but I believe is incompatible with the old version that arXiv is running
@@ -147,8 +144,12 @@
I think the culprit is a tikzcd arrow in cell \tikzcd@currentrow-\tikzcd@currentcolumn}}%
\tikzcd@before@paths@hook%
\begin{pgfonlayer}{quantback}
+ \begingroup
+ \tikzcdset{wire types/.code={}}%prevent setting of wire types, which wipes all the work we've done!
+ %\begin{scope} already included in tikzcd@savedpaths so that it has right options
\tikzcd@savedpaths
\end{scope}
+ \endgroup
\end{pgfonlayer}
\tikzcd@atendsavedpaths\tikzcd@atendlabels\tikzcd@atendslices%I just added stuff here instead
\resetwiretypes%reset wire types
@@ -1193,8 +1194,8 @@ phase label/.code={\tikzset{label distance=2mm,anchor=mid,label position=45}
}
%ghost will get height correct if can't be automatically assigned.
-\DeclareExpandableDocumentCommand{\ghost}{O{}O{0pt}O{1.5pt}m}{%optional parameter contains styling info. compulsory is gate text.
- |[inner ysep=4pt,minimum width=#2,minimum height=#3]| \vphantom{#4}
+\DeclareExpandableDocumentCommand{\ghost}{O{0pt}O{1.5pt}m}{%optional parameter contains styling info. compulsory is gate text.
+ |[inner ysep=4pt,minimum width=#1,minimum height=#2]| \vphantom{#3}
}
%%%
@@ -1321,8 +1322,11 @@ phase label/.code={\tikzset{label distance=2mm,anchor=mid,label position=45}
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\groupoutput@mid\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter\newoptions\expandafter\expandafter\expandafter}\expandafter\expandafter\expandafter{\expandafter\options\expandafter}\expandafter{\opts}{#2}%
}
}
+\newcommand{\ifcsstringeitheror}[4]{%
+\ifcsstring{#1}{#2}{#4}{\ifcsstring{#1}{#3}{#4}{}}
+}
%deferred labelling of inputs
-\newcommand{\groupinput@end}[4]{%basic data as keys, lable options, brace options, text
+\newcommand{\groupinput@end}[4]{%basic data as keys, label options, brace options, text
\pgfkeys{/quantikz/gates/.cd,wires=1}
\def\rightbrace{1}
\pgfkeys{/quantikz/gates/.cd,#1}%
@@ -1330,6 +1334,12 @@ phase label/.code={\tikzset{label distance=2mm,anchor=mid,label position=45}
\pgfkeysgetvalue{/quantikz/gates/row}{\row}
\pgfkeysgetvalue{/quantikz/gates/col}{\col}
\xdef\LoopGI{}
+ \ifcsstringeitheror{wire@type@\row}{c}{b}{%is the first wire classical? (should include bundle as well)
+\xdef\LoopGI{\LoopGI($(\tikzcdmatrixname-\row-\col.center)+(0,\pgfkeysvalueof{/tikz/commutative diagrams/classical gap})$)}
+ }
+ \ifcsstringeitheror{wire@type@\the\numexpr\row+\quantwires-1\relax}{c}{b}{%is the last wire classical? (should include bundle as well)
+\xdef\LoopGI{\LoopGI($(\tikzcdmatrixname-\the\numexpr\row+\quantwires-1\relax-\col.center)+(0,-\pgfkeysvalueof{/tikz/commutative diagrams/classical gap})$)}
+ }
\foreach \n in {\row,...,\the\numexpr\row+\quantwires-1\relax} {
\ifnodedefined{\tikzcdmatrixname-\n-\col}{
\xdef\LoopGI{\LoopGI(\tikzcdmatrixname-\n-\col)}
@@ -1353,6 +1363,12 @@ phase label/.code={\tikzset{label distance=2mm,anchor=mid,label position=45}
\pgfkeysgetvalue{/quantikz/gates/row}{\row}
\pgfkeysgetvalue{/quantikz/gates/col}{\col}
\xdef\LoopGO{}
+ \ifcsstringeitheror{wire@type@\row}{c}{b}{%is the first wire classical? (should include bundle as well)
+\xdef\LoopGO{\LoopGO($(\tikzcdmatrixname-\row-\col.center)+(0,\pgfkeysvalueof{/tikz/commutative diagrams/classical gap})$)}
+ }
+ \ifcsstringeitheror{wire@type@\the\numexpr\row+\quantwires-1\relax}{c}{b}{%is the last wire classical? (should include bundle as well)
+\xdef\LoopGO{\LoopGO($(\tikzcdmatrixname-\the\numexpr\row+\quantwires-1\relax-\col.center)+(0,-\pgfkeysvalueof{/tikz/commutative diagrams/classical gap})$)}
+ }
\foreach \n in {\row,...,\the\numexpr\row+\quantwires-1\relax} {
\ifnodedefined{\tikzcdmatrixname-\n-\col}{
\xdef\LoopGO{\LoopGO(\tikzcdmatrixname-\n-\col)}
@@ -1375,6 +1391,12 @@ phase label/.code={\tikzset{label distance=2mm,anchor=mid,label position=45}
\pgfkeysgetvalue{/quantikz/gates/row}{\row}
\pgfkeysgetvalue{/quantikz/gates/col}{\col}
\xdef\LoopGO{}
+ \ifcsstringeitheror{wire@type@\row}{c}{b}{%is the first wire classical? (should include bundle as well)
+\xdef\LoopGO{\LoopGO($(\tikzcdmatrixname-\row-\col.center)+(0,\pgfkeysvalueof{/tikz/commutative diagrams/classical gap})$)}
+ }
+ \ifcsstringeitheror{wire@type@\the\numexpr\row+\quantwires-1\relax}{c}{b}{%is the first wire classical? (should include bundle as well)
+\xdef\LoopGO{\LoopGO($(\tikzcdmatrixname-\the\numexpr\row+\quantwires-1\relax-\col.center)+(0,-\pgfkeysvalueof{/tikz/commutative diagrams/classical gap})$)}
+ }
\foreach \n in {\row,...,\the\numexpr\row+\quantwires-1\relax} {
\ifnodedefined{\tikzcdmatrixname-\n-\col}{
\xdef\LoopGO{\LoopGO(\tikzcdmatrixname-\n-\col)}
@@ -1625,14 +1647,14 @@ phase label/.code={\tikzset{label distance=2mm,anchor=mid,label position=45}
%initialise all the pgfkeys for key=value parameter passing in macro options
\tikzcdset{%
- slice all/.code={\gdef\toslice{1}},
+ slice all/.code={\gdef\toslice@qtkz{1}},
remove end slices/.initial=0,
slice titles/.initial={\col},
slice style/.initial={},
slice label style/.initial={},
thin lines/.code={\resetstyles},
transparent/.code={\maketransparent},
- vertical slice labels/.code={\def\vert{1}},
+ vertical slice labels/.code={\def\vert@qtkz{1}},
align equals at/.code={\setmiddle{#1}},
wire types/.code={\importwiretypes{#1}},
classical gap/.initial=0.03cm, % define separation of classical wires (can override)