texlive[59839] Master/texmf-dist: yquant (5jul21)

commits+karl at tug.org commits+karl at tug.org
Mon Jul 5 22:52:48 CEST 2021


Revision: 59839
          http://tug.org/svn/texlive?view=revision&revision=59839
Author:   karl
Date:     2021-07-05 22:52:47 +0200 (Mon, 05 Jul 2021)
Log Message:
-----------
yquant (5jul21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/yquant/yquant-doc.pdf
    trunk/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex
    trunk/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex
    trunk/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex
    trunk/Master/texmf-dist/tex/latex/yquant/yquant.sty

Modified: trunk/Master/texmf-dist/doc/latex/yquant/yquant-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex	2021-07-05 20:52:31 UTC (rev 59838)
+++ trunk/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex	2021-07-05 20:52:47 UTC (rev 59839)
@@ -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 @@
          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

Modified: trunk/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex	2021-07-05 20:52:31 UTC (rev 59838)
+++ trunk/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex	2021-07-05 20:52:47 UTC (rev 59839)
@@ -404,7 +404,7 @@
       \noexpand\path (\yquant at circuit@endwires at x, \the\dimexpr.5\dimexpr%
                          \yquant at draw@multiinit@@min+\yquant at draw@multiinit@@max\relax%
                       \relax)%
-         node[\ifnum\yquant at compat>1 /yquant/every operator, /yquant/every output,\fi%
+         node[\ifnum\yquant at compat>1 /yquant/every operator,\fi /yquant/every output,%
               \yquant at draw@@style,%
               \ifnum\yquant at compat<2 /yquant/every multi output,\fi%
               /yquant/this operator,%
@@ -413,7 +413,7 @@
             {\unexpanded\expandafter{\yquant at draw@@content}};%
       \ifdefined\yquant at parent%
          \pgfshapeclippath{yquantbox}%
-                          {\ifnum\yquant at compat>1 /yquant/every operator, /yquant/every output,\fi%
+                          {\ifnum\yquant at compat>1 /yquant/every operator,\fi /yquant/every output,%
                            \yquant at draw@@style,
                            \ifnum\yquant at 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 at draw@subcircuit at 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 at draw@subcircuit at prepare#1#2#3#4#5{%
    \let\idx=\yquant at draw@@idx at 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 at picminy=16000pt %
       \pgf at size@hookedfalse%
       \let\pgf at path@size at hook=\pgfutil at 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 at draw@@x-.5\dimexpr\@secondofthree#3\relax%
+         \yquant at draw@@x-.5\dimexpr\@secondofthree#4\relax%
       }%
       \dimen0=\newx%
       \let\yquant at draw@subcircuit at leftpos=\newx% seamless subcircuits: do not add another separation if we are there
       \let\pgfshapeclippathhorzresult=\empty%
-      \forlistloop\yquant at draw@move at loop{#4}%
+      \forlistloop\yquant at draw@move at loop{#5}%
       % but the new positions are not at the beginning of the box, but inside (with possible margin)
       \dimdef\newx{%
-         \yquant at draw@@x-.5\dimexpr\@firstofthree#3\relax-\@thirdofthree#3%
+         \yquant at draw@@x-.5\dimexpr\@firstofthree#4\relax-\@thirdofthree#4%
       }%
-      \forlistloop\yquant at draw@group at advance{#4}%
+      \forlistloop\yquant at draw@group at advance{#5}%
       \setbox\yquant at prepare@subcircuit at box=\hbox{{%
          \let\yquant at draw@subcircuit at wirestart=\newx%
          \let\yquant at parent=\yquant at prefix%
@@ -481,6 +482,9 @@
             \let\pgf at nodecallback=\yquant at draw@subcircuit at nodecallback%
          }{%
             \pgfkeys{/tikz/name prefix/.expanded={\pgfkeysvalueof{/tikz/name prefix}#2-}}%
+            \ifnum#3=1 %
+               \let\pgf at nodecallback=\yquant at draw@subcircuit at nodecallback%
+            \fi%
          }%
          \pgfkeys{/yquant/operators/this subcircuit box/.style={}}%
          \edef\yquant at draw@subcircuit at style{%
@@ -497,6 +501,17 @@
          \ifdim\dimen0<\pgf at picminy %
             \global\pgf at 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 at draw@subcircuit at alias@do##1#2-##2\relax##3\relax{%
+               \ifstrempty{##1}{%
+                  \pgfnodealias{\yquant at draw@subcircuit at alias@removezero#2-##2}{#2-##2}%
+                  \@gobble% there is an additional \relax
+               }\relax%
+            }%
+            \forlistcsloop%
+               {\yquant at draw@subcircuit at alias{#2}}\yquant at draw@subcircuit at nodelist%
+         \fi%
       }}%
       \edef\cmd{%
          \noexpand\path (\yquant at draw@@x, \the\dimexpr.5\pgf at picminy+.5\pgf at 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 at picmaxy-\pgf at picminy\relax {\hbox to \@firstofthree#3 {}}};%
+            {\vbox to \the\dimexpr\pgf at picmaxy-\pgf at picminy\relax {\hbox to \@firstofthree#4 {}}};%
       }%
       \cmd%
-      \unhbox\yquant at prepare@subcircuit at box
+      \unhbox\yquant at prepare@subcircuit at box%
    % \endpgfinterruptboundingbox + increase
       \ifdim\pgf at interrupt@savemaxy>\pgf at picmaxy%
          \global\pgf at picmaxy=\pgf at interrupt@savemaxy%
@@ -519,7 +534,7 @@
    \endgroup%
    % Now that the subcircuit is finished, we need advance all the wires
    \dimdef\newx{\yquant at draw@@x+.5\dimexpr\yquant at draw@@width\relax}%
-   \forlistloop\yquant at draw@group at advance{#4}%
+   \forlistloop\yquant at draw@group at 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 at draw@subcircuit at single#1#2#3#4{%
+\def\yquant at draw@subcircuit at alias@removezero#1-0{#1}
+
+\def\yquant at draw@subcircuit at alias#1#2{%
+   \yquant at draw@subcircuit at alias@do#2\relax#1-0-\relax\relax%
+}
+
+\protected\long\def\yquant at draw@subcircuit at single#1#2#3#4#5{%
    \yquant at config@operator at multifalse%
-   \yquant at draw@subcircuit at prepare{#2}{#3}{#4}{#1}%
+   \yquant at draw@subcircuit at prepare{#2}{#3}{#4}{#5}{#1}%
    \edef\cmd{%
       \pgfshapeclippath{yquantbox}{%
           /yquant/every operator, \yquant at draw@@style,%
@@ -563,10 +584,10 @@
    \numdef\yquant at draw@@idx at content{\yquant at draw@@idx at content+1}%
 }
 
-\protected\long\def\yquant at draw@subcircuit at multi#1#2#3#4#5#6#7{%
+\protected\long\def\yquant at draw@subcircuit at multi#1#2#3#4#5#6#7#8{%
    \yquant at config@operator at 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 at draw@subcircuit at prepare{#5}{#6}{#7}{#4}%
+   \yquant at draw@subcircuit at prepare{#5}{#6}{#7}{#8}{#4}%
    \edef\cmd{%
       \pgfshapeclippath{yquantbox}{%
           /yquant/every operator, \yquant at draw@@style,%

Modified: trunk/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex	2021-07-05 20:52:31 UTC (rev 59838)
+++ trunk/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex	2021-07-05 20:52:47 UTC (rev 59839)
@@ -766,7 +766,7 @@
          \yquant at draw@subcircuit at single%
             {#2}% register index
             {\yquant at circuit@subcircuit at id}%
-            {\nodename}%
+            {\nodename}\ifnum\yquant at circuit@operator at numtarget=1 1\else0\fi%
             {\noexpand\yquant at prepare@subcircuit at width}%
       }%
    }%
@@ -787,7 +787,7 @@
          \yquant at draw@subcircuit at multi%
             #2%
             {\yquant at circuit@subcircuit at id}%
-            {\nodename}%
+            {\nodename}\ifnum\yquant at circuit@operator at numtarget=1 1\else0\fi%
             {\noexpand\yquant at prepare@subcircuit at width}%
       }%
    }%
@@ -866,7 +866,7 @@
    }%
 }
 
-\def\yquant at prepare@finalize at ctrl@subcircuit at single#1#2#3#4{%
+\def\yquant at prepare@finalize at ctrl@subcircuit at single#1#2#3#4#5{%
    \yquant at prepare@finalize at ctrl@single{#1}{#3}%
 }
 
@@ -877,7 +877,7 @@
    \yquant at prepare@callback at prepare{#1}%
 }
 
-\protected\def\yquant at prepare@finalize at ctrl@subcircuit at multi#1#2#3#4#5#6#7{%
+\protected\def\yquant at prepare@finalize at ctrl@subcircuit at multi#1#2#3#4#5#6#7#8{%
    % there are no contiguous parts here, don't call the normal @multi
    \forlistloop\yquant at prepare@finalize at ctrl@subcircuit at multi@loop{#4}%
 }
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/latex/yquant/yquant.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/yquant/yquant.sty	2021-07-05 20:52:31 UTC (rev 59838)
+++ trunk/Master/texmf-dist/tex/latex/yquant/yquant.sty	2021-07-05 20:52:47 UTC (rev 59839)
@@ -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]



More information about the tex-live-commits mailing list.