summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-05 20:52:47 +0000
committerKarl Berry <karl@freefriends.org>2021-07-05 20:52:47 +0000
commitdc58973d18f4ed8cece22b11f1cc31e7ea3dd9df (patch)
tree96b7f7d5315368716eef851eeec80369c5d30958 /Master/texmf-dist/tex
parentf7dfa53922f2b6799e814a0009a24b6f19b27746 (diff)
yquant (5jul21)
git-svn-id: svn://tug.org/texlive/trunk@59839 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/yquant/yquant-draw.tex55
-rw-r--r--Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex8
-rw-r--r--Master/texmf-dist/tex/latex/yquant/yquant.sty2
3 files changed, 43 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex b/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex
index 1bf8d3fb19a..7527e1ea05f 100644
--- a/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex
+++ b/Master/texmf-dist/tex/latex/yquant/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/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex b/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex
index c9db0883b67..ba240dfc5e3 100644
--- a/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex
+++ b/Master/texmf-dist/tex/latex/yquant/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/Master/texmf-dist/tex/latex/yquant/yquant.sty b/Master/texmf-dist/tex/latex/yquant/yquant.sty
index ecbee654e01..e98878845ce 100644
--- a/Master/texmf-dist/tex/latex/yquant/yquant.sty
+++ b/Master/texmf-dist/tex/latex/yquant/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]