diff options
author | Karl Berry <karl@freefriends.org> | 2021-12-28 22:48:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-12-28 22:48:51 +0000 |
commit | 3a8f490ec582c95b7adc117b1f8d3debb60b7f88 (patch) | |
tree | 555a386e2cd67bb1f172b2a5d65bbfe983ff60df /Master/texmf-dist/tex/latex/yquant | |
parent | ad334beadbb0679b7608a2d9612050802d5273d1 (diff) |
yquant (28dec21)
git-svn-id: svn://tug.org/texlive/trunk@61429 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/yquant')
11 files changed, 428 insertions, 59 deletions
diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex b/Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex index 52cb435b2f0..14f6a1f77bc 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex @@ -217,16 +217,18 @@ % restores the data captured for an uncontrolled operator and starts preparation % #1: \yquant@attrs@remaining -% #2: \yquant@circuit@operator@targets -% #3: \yquant@circuit@operator@mintarget -% #4: \yquant@circuit@operator@maxtarget -% #5: \yquant@circuit@operator@numtarget -\protected\def\yquant@circuit@restore#1#2#3#4#5{% +% #2: \yquant@lang@attr@name +% #3: \yquant@circuit@operator@targets +% #4: \yquant@circuit@operator@mintarget +% #5: \yquant@circuit@operator@maxtarget +% #6: \yquant@circuit@operator@numtarget +\protected\def\yquant@circuit@restore#1#2#3#4#5#6{% \def\yquant@attrs@remaining{#1}% - \def\yquant@circuit@operator@targets{#2}% - \def\yquant@circuit@operator@mintarget{#3}% - \def\yquant@circuit@operator@maxtarget{#4}% - \def\yquant@circuit@operator@numtarget{#5}% + \def\yquant@lang@attr@name{#2}% + \def\yquant@circuit@operator@targets{#3}% + \def\yquant@circuit@operator@mintarget{#4}% + \def\yquant@circuit@operator@maxtarget{#5}% + \def\yquant@circuit@operator@numtarget{#6}% \yquant@circuit@operator@hasControlsfalse% \let\yquant@circuit@operator@pctrls=\empty% \def\yquant@circuit@operator@minpctrl{2147483647}% @@ -323,10 +325,20 @@ % sets the output of wires % #1: arbitrary register list \protected\def\yquant@circuit@output{% - \protected\def\idx{}% + \let\idx=\yquant@protectedempty% + \ifnum\yquant@compat>1 % + \let\Ifnum=\yquant@protectedempty% + \let\Ifcase=\yquant@protectedempty% + \let\Or=\yquant@protectedempty% + \let\Else=\yquant@protectedempty% + \let\Fi=\yquant@protectedempty% + \let\Unless=\yquant@protectedempty% + \let\The=\yquant@protectedempty% + \fi% \protected@csxappto{\yquant@prefix outputs}% {\yquant@circuit@restore% {\yquant@attrs@remaining}% + {\yquant@lang@attr@name}% {\unexpanded\expandafter{\yquant@circuit@operator@targets}}% {\yquant@circuit@operator@mintarget}{\yquant@circuit@operator@maxtarget}% {\yquant@circuit@operator@numtarget}% diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-config.tex b/Master/texmf-dist/tex/latex/yquant/yquant-config.tex index a2d5a8fc9e5..a50b2a4792c 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-config.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-config.tex @@ -43,7 +43,9 @@ % BEGIN_FOLD Register creation \pgfqkeys{/yquant}{% register/default name/.store in=% - \yquant@config@register@default@name% + \yquant@config@register@default@name,% + register/default lazy name/.store in=% + \yquant@config@register@default@lazyname% } \ifnum\yquant@compat<2 % \pgfqkeys{/yquant}{% @@ -172,9 +174,25 @@ } \fi \pgfqkeys{/yquant}{% - operators/every box/.style=% - {shape=yquant-rectangle, draw, align=center, inner xsep=1mm, x radius=2mm, y radius=2.47mm},% + operators/every text/.style=% + {shape=yquant-rectangle, align=center, inner xsep=1mm, x radius=2mm, y radius=2.47mm}% } +\ifnum\yquant@compat<3 % + \pgfqkeys{/yquant}{% + % we did not have this style before 0.6, but for the ease of implementation, we just change the direction of inheritance---users of earlier compat versions will never use the style, so this is fully transparent + operators/every rectangular box/.style=% + {/yquant/operators/every box},% + operators/every box/.style=% + {shape=yquant-rectangle, draw, align=center, inner xsep=1mm, x radius=2mm, y radius=2.47mm}% + } +\else + \pgfqkeys{/yquant}{% + operators/every rectangular box/.style=% + {shape=yquant-rectangle, draw, align=center, inner xsep=1mm, x radius=2mm, y radius=2.47mm},% + operators/every box/.style=% + {/yquant/operators/every rectangular box}% + } +\fi \ifnum\yquant@compat<2 % \pgfqkeys{/yquant}{% operators/every custom gate/.style=% @@ -200,7 +218,7 @@ operators/every not/.style=% {shape=yquant-oplus, radius=1.3mm, draw},% operators/every pauli/.style=% - {/yquant/operators/every box},% + {/yquant/operators/every rectangular box},% operators/every phase/.style=% {shape=yquant-circle, radius=.5mm, fill},% operators/every slash/.style=% @@ -208,7 +226,7 @@ operators/every subcircuit/.style=% {},% operators/every subcircuit box/.style=% - {/yquant/operators/every box},% + {/yquant/operators/every rectangular box},% subcircuit box style/.style=% {/yquant/operators/every subcircuit box/.append style={#1}},% operators/this subcircuit box/.style=% @@ -219,7 +237,11 @@ {/yquant/operators/this subcircuit box/.append style={draw=none, inner sep=0pt}},% operators/subcircuit/seamless/.code=% {\pgfkeysalso{/yquant/operators/subcircuit/frameless, /yquant/register/default name=}% - \letcs\yquant@prevseamless{\yquant@prefix seamless}% + \ifdefined\yquant@prefix% + \csletcs{yquant@prevseamless}{\yquant@prefix seamless}% + \else% + \csletcs{yquant@prevseamless}{iffalse}% + \fi% \yquant@config@circuit@seamlesstrue}, operators/subcircuit/name mangling/.is choice,% operators/subcircuit/name mangling/prefix or discard/.code=% @@ -270,6 +292,7 @@ % END_FOLD \def\yquant@config@register@default@name{\regidx} +\let\yquant@config@register@default@lazyname=\empty \def\yquant@config@register@minimum@height{1.5mm} \def\yquant@config@register@minimum@depth{1.5mm} \def\yquant@config@register@sep{1mm} diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-env.tex b/Master/texmf-dist/tex/latex/yquant/yquant-env.tex index c6e9f52b01c..f26919c8d16 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-env.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-env.tex @@ -56,7 +56,7 @@ \edef\yquant@prefix{yquant@env\the\yquant@env @}% \ifnum\yquant@env=1 % \yquantmeasuringtrue% - \yquant@env@substikz#1% + \yquant@env@substitute% \global\cslet{\yquant@prefix parameters}\empty% \else% \let\yquant@lang@reset@attrs@inputoutput=\yquant@lang@reset@attrs@inputoutput@subcircuit% @@ -529,8 +529,29 @@ \pgftransformreset% } +\protected\def\yquant@env@protectidx{% + \ifundef\idx{% + \let\idx=\yquant@protectedempty% + }\relax% + \ifundef\reg{% + \let\reg=\yquant@protectedempty% + }\relax% + \ifundef\regidx{% + \let\regidx=\yquant@protectedempty% + }\relax% + \ifundef\len{% + \let\len=\yquant@protectedempty% + }\relax% +} + +\let\yquant@env@substitutions=\empty +\def\yquant@env@substitute{% + \forlistloop\@firstofone\yquant@env@substitutions% +} + % substitute the tikz commands (defined in \tikz@installcommands) so that they can be arbitrarily interleaved with yquant code. We patch \path, \scope, \endscope, \stopscope, their internal complements, and also patch \yquantset. -\protected\def\yquant@env@substikz#1{% +\listadd\yquant@env@substitutions\yquant@env@substikz +\protected\def\yquant@env@substikz{% % \tikz@path@do@at@end is called after a path. Hence, it is an ideal candidate to re-invoke \yquant@env@scan. However, it is by default defined to be \tikz@lib@scope@check, and we need this definition for the scopes library to work correctly. But since \tikz@lib@scope@check is also called after a scope and the end of a scope, this is even better. Yet, we need to check whether the scopes library is present or not. \let\yquant@env@substikz@scopecheck=\tikz@lib@scope@check% \ifx\tikz@lib@scope@check\pgfutil@empty% @@ -547,25 +568,31 @@ \protected@csxappto{\yquant@prefix draw}{% \noexpand\path##1;% }% - #1% + \yquant@env@scan% }% % no need for \scoped, because it internally calls \scope. % We need to hack into \scope, but this is a bit tricky due to its argument handling. In order to get all optional arguments, including the possible animations library, correct, we change \tikz@scope@opt. \ifdefined\tikz@scope@opt% \let\yquant@env@substikz@scope=\tikz@scope@opt% \def\tikz@scope@opt[##1]{% - \protected@csxappto{\yquant@prefix draw}{% - \noexpand\tikz@scope@env[{##1}]% - }% + \begingroup% + \yquant@env@protectidx% scope options may contain \idx, \reg, and \regidx + \protected@csxappto{\yquant@prefix draw}{% + \noexpand\tikz@scope@env[{##1}]% + }% + \endgroup% \yquant@env@substikz@scope[{##1}]% }% \else% % this is for the arXiv, which has a very outdated version of TikZ \let\yquant@env@substikz@scope=\tikz@@scope@env% \def\tikz@@scope@env[##1]{% - \protected@csxappto{\yquant@prefix draw}{% - \noexpand\tikz@@scope@env[{##1}]% - }% + \begingroup% + \yquant@env@protectidx% scope options may contain \idx, \reg, and \regidx + \protected@csxappto{\yquant@prefix draw}{% + \noexpand\tikz@@scope@env[{##1}]% + }% + \endgroup% \yquant@env@substikz@scope[{##1}]% }% \fi% @@ -580,14 +607,39 @@ \let\stopscope=\endscope% % We define \yquantset as a pgfkeys-like macro. Anything else would deteriorate performance badly, as \pgfkeys, \pgfqkeys, or \tikzset are used a lot internally. \protected\def\yquantset##1{% - \protected@csxappto{\yquant@prefix draw}{% - \noexpand\pgfqkeys{/yquant}{##1}% - }% + \begingroup% + \yquant@env@protectidx% yquant options may contain \idx, \reg, and \regidx + \protected@csxappto{\yquant@prefix draw}{% + \noexpand\pgfqkeys{/yquant}{##1}% + }% + \endgroup% \pgfqkeys{/yquant}{##1}% \yquant@env@scan% }% } +\listadd\yquant@env@substitutions\yquant@env@secondpass +\protected\def\yquant@env@secondpass{% + \protected\long\def\yquantsecondpass##1{% + \csgappto{\yquant@prefix draw}{##1}% + \yquant@env@scan% + }% + \protected\long\def\yquantesecondpass##1{% + \protected@csxappto{\yquant@prefix draw}{##1}% + \yquant@env@scan% + }% + \protected\long\def\yquantescape##1{% + ##1% + \protected@csxappto{\yquant@prefix draw}{##1}% + \yquant@env@scan% + }% + \protected\long\def\yquanteescape##1{% + ##1% + \csgappto{\yquant@prefix draw}{##1}% + \yquant@env@scan% + }% +} + % Scan until the next non-space token is found and execute it as a csname \def\yquant@env@scan{% \begingroup% @@ -604,6 +656,230 @@ \yquant@env@scan% } +\ifdefined\beamer@masterdecode + \expandafter\@firstoftwo +\else + \expandafter\@secondoftwo +\fi{% + \protected\def\yquant@env@check@findmacro{% + % we only put the beamer macros in here that effectively remove things from the input stream. Everything that is typeset in a special way will end the group + \ifx\yquant@env@nextchar\only% + \let\next=\yquant@env@beamer@only% + \else% + \ifx\yquant@env@nextchar\alt% + \let\next=\yquant@env@beamer@alt% + \else% + \ifx\yquant@env@nextchar\temporal% + \let\next=\yquant@env@beamer@temporal% + \else% + \ifx\yquant@env@nextchar\note% + \let\next=\yquant@env@beamer@note% + \else% + % in principle: \endgroup for all in here, but need to preserve \yquant@env@nextchar + \ifx\yquant@env@nextchar\uncover% + \endgroup% + \let\next=\yquant@env@beamer@uncover% + \else% + \ifx\yquant@env@nextchar\visible% + \endgroup% + \let\next=\yquant@env@beamer@visible% + \else% + \ifx\yquant@env@nextchar\invisible% + \endgroup% + \let\next=\yquant@env@beamer@invisible% + \else% + \ifx\yquant@env@nextchar\onslide% + \endgroup% + \let\next=\yquant@env@beamer@onslide% + \else% + \ifx\yquant@env@nextchar\pause% + \endgroup% + \let\next=\yquant@env@beamer@pause% + \else% + \ifx\yquant@env@nextchar\yquant@env@beamer@checkifactive% + \endgroup% + \let\yquant@env@beamer@checkifactive@true=\relax% + \let\next=\relax% + \else% + \endgroup% + \let\next=\relax% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + }% + + \listadd\yquant@env@substitutions\yquant@env@substbeamer + \protected\def\yquant@env@substbeamer{% + \long\def\yquant@env@beamer@only@arga<##1>##2{% + \beamer@alt<##1>{\yquant@env@contscan##2}{\yquant@env@contscan}% + }% + \long\def\yquant@env@beamer@alt@arga<##1>##2##3{% + \beamer@alt<##1>{\yquant@env@contscan##2}{\yquant@env@contscan##3}% + }% + \protected\long\def\yquant@env@beamer@temporal\temporal<##1>##2##3##4{% + \temporal<##1>{\yquant@env@contscan##2}{\yquant@env@contscan##3}{\yquant@env@contscan##4}% + }% + % There's no need for the fakeinvisible or spacingcover macros, since we are within TikZ anyway + \mode<presentation>{ + \protected\long\def\yquant@env@beamer@visibilitymacros##1##2##3##4{% + \yquant@env@beamer@visibilitymacros@flip##1% + \beamer@altget% + {\yquant@env@scan##3}% + {% + \begingroup% + \letcs\yquant@env@beamer@olddraw{\yquant@prefix draw}% + \global\cslet{\yquant@prefix draw}\empty% + \undef\yquant@env@beamer@checkifactive@true% + ##2{\yquant@env@scan##3\yquant@env@beamer@checkifactive}% + \csxdef{\yquant@prefix draw}{% + \unexpanded\expandafter{\yquant@env@beamer@olddraw}% + \ifx0##1% + \noexpand\beamer@alt##4{}% + \else% + \noexpand\beamer@only##4% + \fi% + {% + \unexpanded{##2}{% + \unexpanded\expandafter\expandafter\expandafter{\csname\yquant@prefix draw\endcsname}% + }% + }% + }% + \expandafter% + \endgroup% + \ifdefined\yquant@env@beamer@checkifactive@true% + \expandafter\@firstofone% + \else% + \expandafter\@gobble% + \fi% + \yquant@env@scan% + }% + ##4% + } + \newcommand<>\yquant@env@beamer@onslidenoargs[2]{% + \let\yquant@env@beamer@onslideappdraw=\empty% + \appto\yquant@env@beamer@onslideappdraw{\beamer@endpause}% + \yquant@for \i := 1 to \csname\yquant@prefix registers\endcsname{% + \eappto\yquant@env@beamer@onslideappdraw{\noexpand\yquant@circuit@flushwire{\i}}% + }% + \csxappto{\yquant@prefix draw}% + {\unexpanded\expandafter{\yquant@env@beamer@onslideappdraw}}% + \beamer@alt##3% + {\csgappto{\yquant@prefix draw}{% + \global\let\beamer@endpause=\empty% + }% + \yquant@env@scan}% + {\csgappto{\yquant@prefix draw}{% + ##1% + \gdef\beamer@endpause{##2}% + }% + \yquant@env@scan% + }% + } + % This is \beamer@inframenote, but we are always in a frame if we an in yquant + \newcommand<>{\yquant@env@beamer@note@}[2][]{% + \beamer@inframenote##3[{##1}]{##2}% + \yquant@env@contscan% + } + }% + \mode<article>{ + \newcommand<>\yquant@env@beamer@uncover@[1]{% + \beamer@alt##2{\yquant@env@scan##1}{\yquant@env@scan}% + } + % we don't need \yquant@env@beamer@visible@ in this mode, since \uncover and \visible are equal (w.r.t. \ifx), so we will always end up with the \uncover path + \newcommand<>\yquant@env@beamer@invisible@[1]{% + \beamer@alt##2{\yquant@env@scan}{\yquant@env@scan##1}% + } + \newcommand<>{\yquant@env@beamer@note@}[2][]{\yquant@env@contscan} + \newrobustcmd\yquant@env@beamer@pause@[1][]{\yquant@env@scan} + } + \protected\def\yquant@env@beamer@onslide@{% + \@ifstar{\yquant@env@scan\only}% + {\@ifnextchar+{\expandafter\yquant@env@beamer@visibleonslide\@gobble}% + {\yquant@env@beamer@mainonslide}% + }% + }% + } + + \protected\def\yquant@env@beamer@only\only{\@ifnextchar<{\yquant@env@beamer@only@arga}% + {\yquant@env@beamer@only@argb}}% + \long\def\yquant@env@beamer@only@argb#1{% + \beamer@ifnextcharospec{\yquant@env@beamer@only@argb@{#1}}{#1}% + }% + \long\def\yquant@env@beamer@only@argb@#1<#2>{% + \yquant@env@beamer@only@arga<#2>{#1}% + }% + \protected\def\yquant@env@beamer@alt\alt{\@ifnextchar<{\yquant@env@beamer@alt@arga}% + {\yquant@env@beamer@alt@argb}}% + \long\def\yquant@env@beamer@alt@argb#1#2{% + \beamer@ifnextcharospec{\yquant@env@beamer@alt@argb@{#1}{#2}}{#1}% + } + \long\def\yquant@env@beamer@alt@argb@#1#2<#3>{% + \yquant@env@beamer@alt@arga<#3>{#1}{#2}% + } + + \def\yquant@env@beamer@checkifactive{% + % this should not compare to anything else, but should also not give an error on expansion + \yquant@env@beamer@checkifactive@% + } + \let\yquant@env@beamer@checkifactive@=\empty% + \def\yquant@env@beamer@note\note{\yquant@env@beamer@note@} + % note: in article mode, the definitions of \uncover and \visible are identical, hence we will mistake \visible for \uncover (which is checked first); therefore, \yquant@env@beamer@uncover may be followed by \uncover or \visible, just take an arbitrary argument. + \def\yquant@env@beamer@uncover#1{\yquant@env@beamer@uncover@} + \def\yquant@env@beamer@visible\visible{\yquant@env@beamer@visible@} + \def\yquant@env@beamer@invisible\invisible{\yquant@env@beamer@invisible@} + \def\yquant@env@beamer@onslide\onslide{\yquant@env@beamer@onslide@} + \def\yquant@env@beamer@pause\pause{\yquant@env@beamer@pause@} + + \mode<presentation>{ + \long\def\yquant@env@beamer@visibilitymacros@flip#1#2#3#4{% + \ifx1#1% + \expandafter\@firstoftwo% + \else% + \expandafter\@secondoftwo% + \fi% + {#2{#4}{#3}}{#2{#3}{#4}}% + } + \newcommand<>\yquant@env@beamer@uncover@[1]{% + \yquant@env@beamer@visibilitymacros0\beamer@makecovered{#1}{#2}% + } + \newcommand<>\yquant@env@beamer@visible@[1]{% + \yquant@env@beamer@visibilitymacros0\beamer@reallymakeinvisible{#1}{#2}% + } + \newcommand<>\yquant@env@beamer@invisible@[1]{% + \yquant@env@beamer@visibilitymacros1\beamer@reallymakeinvisible{#1}{#2}% + } + \newrobustcmd\yquant@env@beamer@pause@[1][]{% + \ifblank{#1}% + {\stepcounter{beamerpauses}}% + {\setcounter{beamerpauses}{#1}}% + \yquant@env@beamer@onslidenoargs<\value{beamerpauses}->\beamer@startcovered\beamer@endcovered% + } + } + \mode<article>{ + \newcommand<>\yquant@env@beamer@onslidenoargs[2]{} + } + \newcommand<>{\yquant@env@beamer@visibleonslide}{% + \@ifnextchar\bgroup{\yquant@env@beamer@visible@#1}% + {\yquant@env@beamer@onslidenoargs#1\beamer@begininvisible\beamer@endinvisible}% + } + \newcommand<>{\yquant@env@beamer@mainonslide}{% + \@ifnextchar\bgroup{\yquant@env@beamer@uncover@#1}% + {\yquant@env@beamer@onslidenoargs#1\beamer@startcovered\beamer@endcovered}% + } +}{% + \def\yquant@env@check@findmacro{% + \endgroup% + \let\next=\relax% + } +}% + \protected\def\yquant@env@check@{% \let\next=\relax% % Here we assume standard catcodes for A and [, but our language specification also requires this implicitly. @@ -625,8 +901,7 @@ \let\next=\yquant@env@gobblepar% \else% \ifcat\noexpand\yquant@env@nextchar\relax% - \endgroup% - \let\next=\relax% + \yquant@env@check@findmacro% \else% \PackageError{yquant.sty}% {Invalid yquant syntax: `\meaning\yquant@env@nextchar'}% diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-lang.tex b/Master/texmf-dist/tex/latex/yquant/yquant-lang.tex index 8658d3af9fa..cc882a7ffb0 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-lang.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-lang.tex @@ -298,7 +298,7 @@ % usually, we will not be in a tikzpicture here, so all the commands that abbreviate some path operation are undefined! \tikz@installcommands% % While we want the content to be expanded, protect the most likely TikZ commands - the same ones that we usually substitute in \yquant@env@substikz. - \protected\def\path{}% + \let\path=\yquant@protectedempty% \let\scoped=\path% \let\scope=\path% \let\endscope=\path% @@ -362,7 +362,7 @@ \def\yquantdefinebox@#1#2{% \@ifnextchar[{\yquantdefinebox@i{#1}{#2}}% - {\yquantdefinebox@i{#1}{#2}[/yquant/operators/every box]}% + {\yquantdefinebox@i{#1}{#2}[/yquant/operators/every rectangular box]}% } \protected\long\def\yquantdefinebox@i#1#2[#3]#4{% @@ -393,6 +393,16 @@ } \yquant@langhelper@setup@attrs{box}{value}{} +\yquant@langhelper@declare@command% + {text}% + \yquant@register@get@allowmultitrue% + {% + \expandafter\yquant@prepare% + \expandafter{\yquant@lang@attr@value}% + {/yquant/operators/every text}% + } +\yquant@langhelper@setup@attrs{text}{value}{} + % Hadamard \yquantdefinebox{h}{$H$} @@ -601,6 +611,7 @@ {init}% {% \yquant@register@get@allowmultitrue% + \let\yquant@config@register@default@lazyname=\empty% % we will count how many registers contain the "clean" flag, and only if this is equal to the number of targets, we apply the shift. \count8=0 % }% diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex b/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex index fb46e4e7d13..9869a61a763 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex @@ -293,7 +293,7 @@ } \protected\long\def\yquant@prepare@finalize#1#2{% % We now know the dimensions of all the registers (though we didn't bother with the height of the control knobs [if present], we just assume they are too small to change this). - \protected\def\idx{}%# + \let\idx=\yquant@protectedempty% \yquant@prepare@ifs@set% \let\yquant@prepare@append=\empty% \yquant@sort\yquant@prepare@sort% diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-registers.tex b/Master/texmf-dist/tex/latex/yquant/yquant-registers.tex index 97762cf3dde..41a472821f1 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-registers.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-registers.tex @@ -166,9 +166,56 @@ \else% \def\idx{0}% \fi% - % pre-set y position - \yquant@for \idx := \idx to \numexpr \len -1\relax {% - \yquant@prepare@create\reg\idx\yquant@register@type@q% + % define text macros + \ifnum\len=1 % + \let\regidx=\reg% + \else% + \def\regidx{\reg[\idx]}% + \fi% + \numdef\yquant@circuit@operator@mintarget{\csname\yquant@prefix registers\endcsname+1}% + \begingroup% + \yquant@for \idx := \idx to \numexpr \len -1\relax {% + \yquant@prepare@create\reg\idx\yquant@register@type@q% + }% + \endgroup% + \ifx\yquant@config@register@default@lazyname\empty% + \expandafter\@gobble% + \else% + \expandafter\@firstofone% + \fi% + {% + \let\yquant@lang@attr@value=\yquant@config@register@default@lazyname% + % gather details about the created registers + \letcs\yquant@circuit@operator@maxtarget{\yquant@prefix registers}% + \numdef\yquant@circuit@operator@numtarget{\yquant@circuit@operator@maxtarget-\yquant@circuit@operator@mintarget+1}% + \edef\yquant@circuit@operator@targets{% + \yquant@list@range% + \yquant@circuit@operator@mintarget% + \yquant@circuit@operator@maxtarget% + }% + \let\yquant@circuit@operator@pctrls=\empty% + \def\yquant@circuit@operator@minpctrl{2147483647}% + \def\yquant@circuit@operator@maxpctrl{0}% + \let\yquant@circuit@operator@numpctrl=\yquant@circuit@operator@maxpctrl% + \let\yquant@circuit@operator@nctrls=\empty% + \let\yquant@circuit@operator@minnctrl=\yquant@circuit@operator@minpctrl% + \let\yquant@circuit@operator@maxnctrl=\yquant@circuit@operator@maxpctrl% + \let\yquant@circuit@operator@numnctrl=\yquant@circuit@operator@numpctrl% + \let\yquant@circuit@operator@minctrl=\yquant@circuit@operator@mintarget% + \let\yquant@circuit@operator@maxctrl=\yquant@circuit@operator@maxtarget% + % there are no multi inits in this context + \preto\yquant@attrs@remaining{internal/move label,}% + \def\yquant@config@operator@minimum@width{0pt}% + \unless\ifx\yquant@lang@attr@value\empty% + % make sure to immediately remove the "clear" marker again if we have a text + \yquant@for \i := \yquant@circuit@operator@mintarget to \yquant@circuit@operator@maxtarget {% + \yquant@register@execclear@lastgate{\i}{init}% + }% + \fi% + \expandafter\yquant@prepare% + \expandafter{\yquant@lang@attr@value}% + {/yquant/every label, /yquant/every initial label,% + /yquant/every qubit label}% }% \endgroup% } @@ -216,8 +263,8 @@ } \endgroup -\protected\def\yquant@register@get@ids@@index{} -\protected\def\yquant@register@get@ids@@multi{} +\let\yquant@register@get@ids@@index=\yquant@protectedempty +\let\yquant@register@get@ids@@multi=\yquant@protectedempty \def\yquant@register@get@ids@outerlist#1{% \ifyquant@firsttoken\yquant@register@get@ids@@multi{#1}{% @@ -557,8 +604,8 @@ \yquant@register@get@id#1{\trim@spaces{#2}[\trim@spaces{\trim@spaces#3}]}% } -\let\yquant@register@multi=\empty% -\protected\def\yquant@register@multi@contiguous{}% +\let\yquant@register@multi=\empty +\let\yquant@register@multi@contiguous=\yquant@protectedempty % splits \yquant@register@get@ids@list into a list of contiguous parts \protected\def\yquant@register@multi@splitparts{% @@ -738,7 +785,7 @@ } % This plays a similar role: It must never be expanded before the tikz command is invoked (because it does not exist). -\protected\def\nodepart{} +\let\nodepart=\yquant@protectedempty \def\yquant@register@get@y@unprotected#1{% \ifcsname\yquant@prefix registermap@#1\endcsname% diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-shapes.tex b/Master/texmf-dist/tex/latex/yquant/yquant-shapes.tex index 88cddd66ddf..ea62802b2b5 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-shapes.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-shapes.tex @@ -192,8 +192,7 @@ \@tempdima=\pgf@x% \@tempdimb=\pgf@y% \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}% - {\pgfqpoint{.707107\dimexpr\xradius\relax}% - {.707107\dimexpr\yradius\relax}}% + {\pgfqpoint{\xradius}{\yradius}}% }% \backgroundpath{% \pgfpathellipse{\pgfpointorigin}% @@ -202,8 +201,8 @@ }% \clippath{% \pgfpathellipse{\pgfpointorigin}% - {\pgfqpoint{\dimexpr\xradius+.5\pgflinewidth}{0pt}}% - {\pgfqpoint{0pt}{\dimexpr\yradius+.5\pgflinewidth}}% + {\pgfqpoint{\dimexpr\xradius+.5\pgflinewidth\relax}{0pt}}% + {\pgfqpoint{0pt}{\dimexpr\yradius+.5\pgflinewidth\relax}}% }% } diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-tools.tex b/Master/texmf-dist/tex/latex/yquant/yquant-tools.tex index 65880b995f6..f30dc308bc0 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-tools.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-tools.tex @@ -37,6 +37,8 @@ \long\def\@fourthoffive#1#2#3#4#5{#4} % unused \long\def\@fifthoffive#1#2#3#4#5{#5} +\protected\def\yquant@protectedempty{} + % Loop #1 from min(#2, #3) to max(#2, #3), executing #4 \protected\def\yquant@for #1:=#2to#3#{% \yquant@for@aux#1{#2}{#3}% diff --git a/Master/texmf-dist/tex/latex/yquant/yquant.sty b/Master/texmf-dist/tex/latex/yquant/yquant.sty index a3bda686b8d..75b1cfd2149 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/09/04 v0.5.1 Yet another quantum circuit library for LaTeX] +\ProvidesPackage{yquant}[2021/12/28 v0.6 Yet another quantum circuit library for LaTeX] \RequirePackage{etoolbox}[2018/02/11] \RequirePackage{tikz}[2015/08/29] @@ -23,16 +23,16 @@ \RequirePackage{xkeyval}[2005/05/07] \usetikzlibrary{arrows.meta,decorations.pathreplacing,decorations.pathmorphing} -\define@choicekey+{yquant.sty}{compat}[\val\yquant@compat]{newest,0.3,0.4}{ +\define@choicekey+{yquant.sty}{compat}[\val\yquant@compat]{newest,0.3,0.4,0.6}{ \ifnum\yquant@compat=0 % - \def\yquant@compat{2} % current version + \def\yquant@compat{3} % current version \fi% }{ \PackageWarning{yquant.sty}{Invalid value for `compat` key specified. Using `0.3`.} } \ProcessOptionsX \unless\ifdefined\yquant@compat - \PackageWarning{yquant.sty}{Please specify the `compat` key for yquant. Using `0.3`. Current compatibility version `0.4`.} + \PackageWarning{yquant.sty}{Please specify the `compat` key for yquant. Using `0.3`. Current compatibility version `0.6`.} \def\yquant@compat{1} \fi diff --git a/Master/texmf-dist/tex/latex/yquant/yquantlanguage-groups.sty b/Master/texmf-dist/tex/latex/yquant/yquantlanguage-groups.sty index e8330d731e5..1ea78cace69 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquantlanguage-groups.sty +++ b/Master/texmf-dist/tex/latex/yquant/yquantlanguage-groups.sty @@ -15,9 +15,9 @@ % % The Current Maintainer of this work is Benjamin Desef. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{yquantlanguage-groups}[2021/08/14 v0.5 yquant-groups] +\ProvidesPackage{yquantlanguage-groups}[2021/08/14 v0.6 yquant-groups] -\RequirePackage{yquant}[2021/08/14] +\RequirePackage{yquant}[2021/12/24] % BEGIN_FOLD Config \newif\ifyquantgroup@config@aligned @@ -173,7 +173,7 @@ \edef\yquant@prefix{yquant@env\the\yquant@env @}% \ifnum\yquant@env=1 % \yquantmeasuringtrue% - \yquant@env@substikz#1% + \yquant@env@substitute% \global\cslet{\yquant@prefix parameters}\empty% \else% \let\yquant@lang@reset@attrs@inputoutput=\yquant@lang@reset@attrs@inputoutput@subcircuit% @@ -188,7 +188,7 @@ \let\yquant@parent=\yquantgroup@parent% \let\yquant@prefix=\yquantgroup@prefix% \yquantmeasuringtrue% - \yquant@env@substikz#1% + \yquant@env@substitute% \global\cslet{\yquant@prefix parameters}\empty% }\relax{% \PackageError{yquant.sty}{Internal error}% diff --git a/Master/texmf-dist/tex/latex/yquant/yquantlanguage-qasm.sty b/Master/texmf-dist/tex/latex/yquant/yquantlanguage-qasm.sty index d37aa6b9f0a..86128e643c6 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquantlanguage-qasm.sty +++ b/Master/texmf-dist/tex/latex/yquant/yquantlanguage-qasm.sty @@ -1,7 +1,7 @@ % yquantlanguage-qasm.sty % Extend yquant to understand qasm syntax. % -% Copyright 2020 Benjamin Desef +% Copyright 2021 Benjamin Desef % % This work may be distributed and/or modified under the conditions of the LaTeX Project % Public License, either version 1.3c of this license or (at your option) any later @@ -15,9 +15,9 @@ % % The Current Maintainer of this work is Benjamin Desef. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{yquantlanguage-qasm}[2021/03/27 v0.4 yquant-qasm] +\ProvidesPackage{yquantlanguage-qasm}[2021/12/24 v0.6 yquant-qasm] -\RequirePackage{yquant}[2021/03/27] +\RequirePackage{yquant}[2021/12/24] % BEGIN_FOLD Environment definitions \begingroup @@ -338,13 +338,13 @@ % BEGIN_FOLD Configuration \pgfkeys{% /yquant/operators/every s/.style={% - /yquant/operators/every box% + /yquant/operators/every rectangular box% },% /yquant/operators/every t/.style={% - /yquant/operators/every box% + /yquant/operators/every rectangular box% },% /yquant/operators/every utwo/.style={% - /yquant/operators/every box% + /yquant/operators/every rectangular box% }, /qasm/zero/.store in=% \qasm@config@zero,% |