summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/yquant
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-07-06 03:00:52 +0000
committerNorbert Preining <norbert@preining.info>2021-07-06 03:00:52 +0000
commit109a435244c29109322bcd46386301f6c62d4061 (patch)
tree13a621b9870dcf81bf4c6e38410f6ee4b0fb54f3 /graphics/pgf/contrib/yquant
parent500adb5fa10a924ea571a0d9d7754ed17dab5dbf (diff)
CTAN sync 202107060300
Diffstat (limited to 'graphics/pgf/contrib/yquant')
-rw-r--r--graphics/pgf/contrib/yquant/doc/yquant-doc.pdfbin679110 -> 680322 bytes
-rw-r--r--graphics/pgf/contrib/yquant/doc/yquant-doc.tex10
-rw-r--r--graphics/pgf/contrib/yquant/tex/yquant-draw.tex55
-rw-r--r--graphics/pgf/contrib/yquant/tex/yquant-prepare.tex8
-rw-r--r--graphics/pgf/contrib/yquant/tex/yquant.sty2
5 files changed, 51 insertions, 24 deletions
diff --git a/graphics/pgf/contrib/yquant/doc/yquant-doc.pdf b/graphics/pgf/contrib/yquant/doc/yquant-doc.pdf
index 203ef161c9..0a1e1d144a 100644
--- a/graphics/pgf/contrib/yquant/doc/yquant-doc.pdf
+++ b/graphics/pgf/contrib/yquant/doc/yquant-doc.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/yquant/doc/yquant-doc.tex b/graphics/pgf/contrib/yquant/doc/yquant-doc.tex
index 8a9ebc886d..2b2469e463 100644
--- a/graphics/pgf/contrib/yquant/doc/yquant-doc.tex
+++ b/graphics/pgf/contrib/yquant/doc/yquant-doc.tex
@@ -1,3 +1,4 @@
+% !TeX spellcheck = en_US
\documentclass{scrartcl}
\title{yquant.sty package documentation}
@@ -216,7 +217,7 @@
This document outlines the scope and usage of the \Yquant{} package.
It contains both a reference and a huge number of examples.
\Yquant{} is a package that makes typesetting quantum circuits easy; the package is available on CTAN.
- This beta version~0.4 \emph{should} be stable and interfaces are not very likely to change in an incompatible way in the future.
+ This beta version~0.4.1 \emph{should} be stable and interfaces are not very likely to change in an incompatible way in the future.
\compat{New in 0.4}Sometimes, backwards\hyp incompatible changes are required or advisable, in which case a compatibility setting will allow to revert back to the old behavior (rather, to maximize compatibility, this is an opt\hyp in setting: unless you choose the new behavior, you will get the old one).
Please do report all issues and desirable additions on \href{https://github.com/projekter/yquant/issues}{GitHub}.
@@ -1021,6 +1022,7 @@ IndexSingle = ?number? | ( [ ?number? ], "-", [ ?number? ] );
Counters for target registers, positive, and negative controls are all independent.
Finally, you can even access names within a subcircuit, provided you give a name to the subcircuit.
All nodes in the subcircuit will then have the name \texttt{\textit{<subcircuit name>}-\textit{<name specified in the subcircuits>}}.
+ Note that here, \texttt{\textit{<subcircuit name>}} is the \emph{full} name of the subcircuit, which includes the \tex!-\idx! suffix, \compat{New in 0.4.1}unless there is only a single target register.
For nested subcircuits, you will get multiple prefixes.
\subsection{Shapes and the drawing pipeline}
@@ -3410,7 +3412,7 @@ $=$
\subsection*{2020-10-27: Version 0.3.3}
Fix \href{https://github.com/projekter/yquant/issues/6}{\#6}: shorten doesn't work for 2-qubit barriers. This fixes a bug in how the \texttt{shorten} keyword worked on \gate{barrier}s, which may require re\hyp assessing your chosen values.
- \subsection*{2021-02-21: Version 0.4a}
+ \subsection*{2021-02-21: Version 0.4-alpha}
Lots of internal fixes, most notably vertical alignment with subcircuits. \\
Introduce capability to perform vertical alignment with multi\hyp register gates. \\
Dramatic changes under the hood regarding horizontal positioning, which is now only determined in the drawing stage; this paves the way for delayed gates, which are planned for 0.4.
@@ -3427,5 +3429,9 @@ $=$
\subsection*{2021-03-27: Version 0.4}
New gate: \gate{inspect}. Various bug fixes. \\
Introduce the \texttt{direct control} feature: \gate{measure} gates can now substitute positive controls of future gates.
+
+ \subsection*{2021-07-03: Version 0.4.1}
+ Fix \href{https://github.com/projekter/yquant/issues/9}{\#9}: Output bracket misaligned. \\
+ Fix \href{https://github.com/projekter/yquant/issues/10}{\#10}: Unable to access node in subcircuit. As of this version, named nodes in subcircuits will also be properly aliased if there is only a single target subcircuit (so that you don't need to use the \texttt{-0} suffix for the subcircuit's name).
%END_FOLD
\end{document} \ No newline at end of file
diff --git a/graphics/pgf/contrib/yquant/tex/yquant-draw.tex b/graphics/pgf/contrib/yquant/tex/yquant-draw.tex
index 1bf8d3fb19..7527e1ea05 100644
--- a/graphics/pgf/contrib/yquant/tex/yquant-draw.tex
+++ b/graphics/pgf/contrib/yquant/tex/yquant-draw.tex
@@ -404,7 +404,7 @@
\noexpand\path (\yquant@circuit@endwires@x, \the\dimexpr.5\dimexpr%
\yquant@draw@multiinit@@min+\yquant@draw@multiinit@@max\relax%
\relax)%
- node[\ifnum\yquant@compat>1 /yquant/every operator, /yquant/every output,\fi%
+ node[\ifnum\yquant@compat>1 /yquant/every operator,\fi /yquant/every output,%
\yquant@draw@@style,%
\ifnum\yquant@compat<2 /yquant/every multi output,\fi%
/yquant/this operator,%
@@ -413,7 +413,7 @@
{\unexpanded\expandafter{\yquant@draw@@content}};%
\ifdefined\yquant@parent%
\pgfshapeclippath{yquantbox}%
- {\ifnum\yquant@compat>1 /yquant/every operator, /yquant/every output,\fi%
+ {\ifnum\yquant@compat>1 /yquant/every operator,\fi /yquant/every output,%
\yquant@draw@@style,
\ifnum\yquant@compat<2 /yquant/every multi output,\fi%
/yquant/this operator}%
@@ -441,9 +441,10 @@
% #1: id of subcircuit
% #2: name
-% #3: {width of subcircuit (excluding outer box)}{including outer box}{left margin}
-% #4: affected wires
-\protected\long\def\yquant@draw@subcircuit@prepare#1#2#3#4{%
+% #3: 1 if aliasing of the name should be done (remove -0), 0 else
+% #4: {width of subcircuit (excluding outer box)}{including outer box}{left margin}
+% #5: affected wires
+\protected\long\def\yquant@draw@subcircuit@prepare#1#2#3#4#5{%
\let\idx=\yquant@draw@@idx@content%
% In order to wrap the inner circuit in a proper box operator and clip outer paths appropriately (which was not possible yet, as we didn't know the exact vertical positions), we first place it within a box.
% First, we anticipate the macro that is used by our subcircuit to store the node
@@ -458,19 +459,19 @@
\pgf@picminy=16000pt %
\pgf@size@hookedfalse%
\let\pgf@path@size@hook=\pgfutil@empty%
- % now we must take care of extending all the wires appropriately until the beginning of the box. #3 contains width of this box, #4 contains registers affected by this box. Note that for subcircuits, x extension by the group is disabled.
+ % now we must take care of extending all the wires appropriately until the beginning of the box. #4 contains width of this box, #5 contains registers affected by this box. Note that for subcircuits, x extension by the group is disabled.
\dimdef\newx{%
- \yquant@draw@@x-.5\dimexpr\@secondofthree#3\relax%
+ \yquant@draw@@x-.5\dimexpr\@secondofthree#4\relax%
}%
\dimen0=\newx%
\let\yquant@draw@subcircuit@leftpos=\newx% seamless subcircuits: do not add another separation if we are there
\let\pgfshapeclippathhorzresult=\empty%
- \forlistloop\yquant@draw@move@loop{#4}%
+ \forlistloop\yquant@draw@move@loop{#5}%
% but the new positions are not at the beginning of the box, but inside (with possible margin)
\dimdef\newx{%
- \yquant@draw@@x-.5\dimexpr\@firstofthree#3\relax-\@thirdofthree#3%
+ \yquant@draw@@x-.5\dimexpr\@firstofthree#4\relax-\@thirdofthree#4%
}%
- \forlistloop\yquant@draw@group@advance{#4}%
+ \forlistloop\yquant@draw@group@advance{#5}%
\setbox\yquant@prepare@subcircuit@box=\hbox{{%
\let\yquant@draw@subcircuit@wirestart=\newx%
\let\yquant@parent=\yquant@prefix%
@@ -481,6 +482,9 @@
\let\pgf@nodecallback=\yquant@draw@subcircuit@nodecallback%
}{%
\pgfkeys{/tikz/name prefix/.expanded={\pgfkeysvalueof{/tikz/name prefix}#2-}}%
+ \ifnum#3=1 %
+ \let\pgf@nodecallback=\yquant@draw@subcircuit@nodecallback%
+ \fi%
}%
\pgfkeys{/yquant/operators/this subcircuit box/.style={}}%
\edef\yquant@draw@subcircuit@style{%
@@ -497,6 +501,17 @@
\ifdim\dimen0<\pgf@picminy %
\global\pgf@picminy=\dimen0 %
\fi%
+ \ifnum#3=1 %
+ % we must apply the aliasing to all the included nodes. We do this in this group, which still has the callback available, so that the aliased nodes will also be added to the list and can propagate (note that the number of node names is then exponential in the number of nested subcircuits)
+ \protected\def\yquant@draw@subcircuit@alias@do##1#2-##2\relax##3\relax{%
+ \ifstrempty{##1}{%
+ \pgfnodealias{\yquant@draw@subcircuit@alias@removezero#2-##2}{#2-##2}%
+ \@gobble% there is an additional \relax
+ }\relax%
+ }%
+ \forlistcsloop%
+ {\yquant@draw@subcircuit@alias{#2}}\yquant@draw@subcircuit@nodelist%
+ \fi%
}}%
\edef\cmd{%
\noexpand\path (\yquant@draw@@x, \the\dimexpr.5\pgf@picminy+.5\pgf@picmaxy\relax)%
@@ -505,10 +520,10 @@
/yquant/operators/this subcircuit box,%
/yquant/internal/multi main=true,%
name prefix=, name suffix=, name=yquantbox]%
- {\vbox to \the\dimexpr\pgf@picmaxy-\pgf@picminy\relax {\hbox to \@firstofthree#3 {}}};%
+ {\vbox to \the\dimexpr\pgf@picmaxy-\pgf@picminy\relax {\hbox to \@firstofthree#4 {}}};%
}%
\cmd%
- \unhbox\yquant@prepare@subcircuit@box
+ \unhbox\yquant@prepare@subcircuit@box%
% \endpgfinterruptboundingbox + increase
\ifdim\pgf@interrupt@savemaxy>\pgf@picmaxy%
\global\pgf@picmaxy=\pgf@interrupt@savemaxy%
@@ -519,7 +534,7 @@
\endgroup%
% Now that the subcircuit is finished, we need advance all the wires
\dimdef\newx{\yquant@draw@@x+.5\dimexpr\yquant@draw@@width\relax}%
- \forlistloop\yquant@draw@group@advance{#4}%
+ \forlistloop\yquant@draw@group@advance{#5}%
\ifstrempty{#2}{%
% However, if the outer node was not named, no access to the inner nodes is desired, so we delete all nodes again.
\def\do##1{%
@@ -539,9 +554,15 @@
}%
}
-\protected\long\def\yquant@draw@subcircuit@single#1#2#3#4{%
+\def\yquant@draw@subcircuit@alias@removezero#1-0{#1}
+
+\def\yquant@draw@subcircuit@alias#1#2{%
+ \yquant@draw@subcircuit@alias@do#2\relax#1-0-\relax\relax%
+}
+
+\protected\long\def\yquant@draw@subcircuit@single#1#2#3#4#5{%
\yquant@config@operator@multifalse%
- \yquant@draw@subcircuit@prepare{#2}{#3}{#4}{#1}%
+ \yquant@draw@subcircuit@prepare{#2}{#3}{#4}{#5}{#1}%
\edef\cmd{%
\pgfshapeclippath{yquantbox}{%
/yquant/every operator, \yquant@draw@@style,%
@@ -563,10 +584,10 @@
\numdef\yquant@draw@@idx@content{\yquant@draw@@idx@content+1}%
}
-\protected\long\def\yquant@draw@subcircuit@multi#1#2#3#4#5#6#7{%
+\protected\long\def\yquant@draw@subcircuit@multi#1#2#3#4#5#6#7#8{%
\yquant@config@operator@multitrue%
% there is no contiguous slicing for subcircuits, as they may have all kinds of wire operations that can extend beyond the individual slices, let alone ancillas
- \yquant@draw@subcircuit@prepare{#5}{#6}{#7}{#4}%
+ \yquant@draw@subcircuit@prepare{#5}{#6}{#7}{#8}{#4}%
\edef\cmd{%
\pgfshapeclippath{yquantbox}{%
/yquant/every operator, \yquant@draw@@style,%
diff --git a/graphics/pgf/contrib/yquant/tex/yquant-prepare.tex b/graphics/pgf/contrib/yquant/tex/yquant-prepare.tex
index c9db0883b6..ba240dfc5e 100644
--- a/graphics/pgf/contrib/yquant/tex/yquant-prepare.tex
+++ b/graphics/pgf/contrib/yquant/tex/yquant-prepare.tex
@@ -766,7 +766,7 @@
\yquant@draw@subcircuit@single%
{#2}% register index
{\yquant@circuit@subcircuit@id}%
- {\nodename}%
+ {\nodename}\ifnum\yquant@circuit@operator@numtarget=1 1\else0\fi%
{\noexpand\yquant@prepare@subcircuit@width}%
}%
}%
@@ -787,7 +787,7 @@
\yquant@draw@subcircuit@multi%
#2%
{\yquant@circuit@subcircuit@id}%
- {\nodename}%
+ {\nodename}\ifnum\yquant@circuit@operator@numtarget=1 1\else0\fi%
{\noexpand\yquant@prepare@subcircuit@width}%
}%
}%
@@ -866,7 +866,7 @@
}%
}
-\def\yquant@prepare@finalize@ctrl@subcircuit@single#1#2#3#4{%
+\def\yquant@prepare@finalize@ctrl@subcircuit@single#1#2#3#4#5{%
\yquant@prepare@finalize@ctrl@single{#1}{#3}%
}
@@ -877,7 +877,7 @@
\yquant@prepare@callback@prepare{#1}%
}
-\protected\def\yquant@prepare@finalize@ctrl@subcircuit@multi#1#2#3#4#5#6#7{%
+\protected\def\yquant@prepare@finalize@ctrl@subcircuit@multi#1#2#3#4#5#6#7#8{%
% there are no contiguous parts here, don't call the normal @multi
\forlistloop\yquant@prepare@finalize@ctrl@subcircuit@multi@loop{#4}%
} \ No newline at end of file
diff --git a/graphics/pgf/contrib/yquant/tex/yquant.sty b/graphics/pgf/contrib/yquant/tex/yquant.sty
index ecbee654e0..e98878845c 100644
--- a/graphics/pgf/contrib/yquant/tex/yquant.sty
+++ b/graphics/pgf/contrib/yquant/tex/yquant.sty
@@ -15,7 +15,7 @@
%
% The Current Maintainer of this work is Benjamin Desef.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{yquant}[2021/03/27 v0.4 Yet another quantum circuit library for LaTeX]
+\ProvidesPackage{yquant}[2021/07/03 v0.4.1 Yet another quantum circuit library for LaTeX]
\RequirePackage{etoolbox}[2018/02/11]
\RequirePackage{tikz}[2015/08/29]