texlive[68997] Master/texmf-dist: yquant (29nov23)

commits+karl at tug.org commits+karl at tug.org
Wed Nov 29 22:23:56 CET 2023


Revision: 68997
          https://tug.org/svn/texlive?view=revision&revision=68997
Author:   karl
Date:     2023-11-29 22:23:56 +0100 (Wed, 29 Nov 2023)
Log Message:
-----------
yquant (29nov23)

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	2023-11-29 21:23:41 UTC (rev 68996)
+++ trunk/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex	2023-11-29 21:23:56 UTC (rev 68997)
@@ -232,7 +232,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.7.4 \emph{should} be stable and interfaces are not very likely to change in an incompatible way in the future.
+      This beta version~0.7.5 \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}.
 
@@ -5392,7 +5392,10 @@
          This is more useful when putting labels to controls.
 
       \subsection*{2023-03-05: Version 0.7.4}
-         Fix \href{https://github.com/projekter/yquant/issues/26}{\#25}: Reset all the special groups\hyp related commands that are only valid \emph{directly} in a \tex!yquantgroups! environment when parsing the arguments of \tex!\registers!, \tex!\circuit!, or \tex!\equals!.
+         Fix \href{https://github.com/projekter/yquant/issues/26}{\#26}: Reset all the special groups\hyp related commands that are only valid \emph{directly} in a \tex!yquantgroups! environment when parsing the arguments of \tex!\registers!, \tex!\circuit!, or \tex!\equals!.
          Most notably, this affects \tex!\\!, which can now be used properly within a grouped circuit.
+
+      \subsection*{2023-11-26: Version 0.7.5}
+         Fix \href{https://github.com/projekter/yquant/issues/29}{\#29}: Scaling the whole picture would lead to compilation failures and wrong output with subcircuits.
 %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	2023-11-29 21:23:41 UTC (rev 68996)
+++ trunk/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex	2023-11-29 21:23:56 UTC (rev 68997)
@@ -544,7 +544,7 @@
             \fi%
          \else%
             % first wire, left end
-            \pgfpointtransformed{\yquant at pgfqpoint{\yquant at draw@@x-.5\dimexpr\@firstofthree#4\relax}{\yquant at register@get at y1\relax}}%
+            \pgfpointtransformed{\yquant at pgfqpoint{\dimexpr\yquant at draw@@x-.5\dimexpr\@firstofthree#4\relax\relax}{\yquant at register@get at y1\relax}}%
             \ifdim\yquant at pgf@y>\yquant at pgf@picmaxy %
                \global\yquant at pgf@picmaxy=\yquant at pgf@y %
             \fi%
@@ -552,7 +552,7 @@
                \global\yquant at pgf@picminy=\yquant at pgf@y %
             \fi%
             % first wire, right end
-            \pgfpointtransformed{\yquant at pgfqpoint{\yquant at draw@@x+.5\dimenxpr\@firstofthree#4\relax}{\yquant at register@get at y1\relax}}%
+            \pgfpointtransformed{\yquant at pgfqpoint{\dimexpr\yquant at draw@@x+.5\dimexpr\@firstofthree#4\relax\relax}{\yquant at register@get at y1\relax}}%
             \ifdim\yquant at pgf@y>\yquant at pgf@picmaxy %
                \global\yquant at pgf@picmaxy=\yquant at pgf@y %
             \fi%
@@ -560,7 +560,7 @@
                \global\yquant at pgf@picminy=\yquant at pgf@y %
             \fi%
             % last wire, left end
-            \pgfpointtransformed{\yquant at pgfqpoint{\yquant at draw@@x-.5\dimexpr\@firstofthree#4\relax}{\yquant at register@get at y{\csname\yquant at prefix registers\endcsname}\relax}}%
+            \pgfpointtransformed{\yquant at pgfqpoint{\dimexpr\yquant at draw@@x-.5\dimexpr\@firstofthree#4\relax\relax}{\yquant at register@get at y{\csname\yquant at prefix registers\endcsname}\relax}}%
             \ifdim\yquant at pgf@y>\yquant at pgf@picmaxy %
                \global\yquant at pgf@picmaxy=\yquant at pgf@y %
             \fi%
@@ -568,7 +568,7 @@
                \global\yquant at pgf@picminy=\yquant at pgf@y %
             \fi%
             % last wire, right end
-            \pgfpointtransformed{\yquant at pgfqpoint{\yquant at draw@@x+.5\dimenxpr\@firstofthree#4\relax}{\yquant at register@get at y{\csname\yquant at prefix registers\endcsname}\relax}}%
+            \pgfpointtransformed{\yquant at pgfqpoint{\dimexpr\yquant at draw@@x+.5\dimexpr\@firstofthree#4\relax\relax}{\yquant at register@get at y{\csname\yquant at prefix registers\endcsname}\relax}}%
             \ifdim\yquant at pgf@y>\yquant at pgf@picmaxy %
                \global\yquant at pgf@picmaxy=\yquant at pgf@y %
             \fi%
@@ -603,20 +603,49 @@
          \dimen2=\dimexpr\yquant at pgf@picmaxy-\yquant at pgf@picminy\relax%
       \else%
          \begingroup%
-            \pgftransforminvert%
-            \pgfpointtransformed{\pgfqpoint{\pgf at picminx}{\pgf at picminy}}%
-            \@tempdima=\yquant at pgf@y%
-            \pgfpointtransform{\pgfqpoint{\pgf at picmaxx}{\pgf at picmaxy}}%
-            \edef\cmd{\@tempdima=\the\@tempdima\space\@tempdimb=\the\yquant at pgf@y\space}%
+            \ifdim\pgf at pt@ab pt=0pt% may also be reflection
+               % no rotations, not too hard
+               \pgftransforminvert%
+               \pgfpointtransformed{\pgfqpoint{\pgf at picminx}{\pgf at picminy}}%
+               \@tempdima=\yquant at pgf@y%
+               \pgfpointtransformed{\pgfqpoint{\pgf at picmaxx}{\pgf at picmaxy}}%
+               \dimen2=\dimexpr\yquant at pgf@y-\@tempdima\relax%
+               \ifdim\dimen2<0pt % reflections
+                  \dimen2=-\dimen2 %
+               \fi%
+               \dimen0=\dimexpr.5\dimexpr\@tempdima+\yquant at pgf@y\relax\relax%
+            \else%
+               % We must figure out the size manually. pgf at picminy/pgf at picmaxy are not trustworthy, as they describe the height over the outer unrotated rectangle that completely covers the rotated one.
+               % TODO: Well, that's as it should be, but it doesn't appear to be correct. Upon rotation, they turn out to be much smaller than they should be. Why?
+               \PackageWarning{yquant.sty}{Arbitrary-degree rotations are badly broken with subcircuits. Make sure not to draw the circuit's outline.}%
+               % Let a be the true width of the rotated rectangle and b its height. We are looking for b.
+               % If alpha is the rotation angle, the outer rectangle has height Y
+               %    Y = a sin alpha + b cos alpha
+               % and width
+               %    X = a cos alpha + b sin alpha
+               % so that b = (Y cos alpha - X sin alpha) / (cos^2 alpha - sin^2 alpha)
+               % In the transformation matrix, we already have - if there's no scaling -
+               %    sin alpha = \pgf at pt@ab, cos alpha = \pgf at pt@aa.
+               % And if there's scaling, these entries are scaled, so in total we divide by the scaling exactly once, which is the inversion, as it should be.
+               \@tempdima=\dimexpr\pgf at picmaxx-\pgf at picminx\relax% \@tempdima is X
+               \@tempdimb=\dimexpr\pgf at picmaxy-\pgf at picminy\relax% \@tempdimb is Y
+               \@tempdimc=\dimexpr\pgf at pt@aa\dimexpr\pgf at pt@aa pt\relax-%
+                                  \pgf at pt@ab\dimexpr\pgf at pt@ab pt\relax\relax% denominator
+               \dimen2=\dimexpr\dimexpr\pgf at pt@aa\@tempdimb-\pgf at pt@ab\@tempdima\relax*65536/%
+                                       \@tempdimc\relax%
+               % We now have the height, we still need the middle point. We can start from an outer y position, which is also a true extremal y position, and simply add half the height.
+               \dimen0=\dimexpr\pgf at picminy+.5\dimen2\relax
+               \ifdim\dimen2<0pt % reflections
+                  \dimen2=-\dimen2 %
+               \fi%
+            \fi%
+            \edef\cmd{%
+               \dimen0=\the\dimen0 %
+               \dimen2=\the\dimen2 %
+            }%
             \expandafter%
          \endgroup%
          \cmd%
-         \pgfpointtransformed{\yquant at pgfqpoint{\yquant at draw@@x}%
-                                               {.5\dimexpr\@tempdima+\@tempdimb\relax}}%
-         \dimen0=\yquant at pgf@y%
-         \pgfpointtransformed{\yquant at pgfqpoint{\yquant at draw@@x}%
-                                               {\dimexpr\@tempdimb-\@tempdima\relax}}%
-         \dimen2=\yquant at pgf@y%
       \fi%
       \edef\cmd{%
          \noexpand\path \yquant at coords(\yquant at draw@@x, \the\dimen0)%

Modified: trunk/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex	2023-11-29 21:23:41 UTC (rev 68996)
+++ trunk/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex	2023-11-29 21:23:56 UTC (rev 68997)
@@ -933,7 +933,22 @@
    \let\yquant at register@multi at contiguous=\yquant at prepare@finalize at ctrl@multi at contiguous%
    \ifyquant at circuit@operator at hasControls%
       \ifyquant at config@operator at multi@warn%
-         \def\yquant at prepare@finalize at ctrl@multi at contiguous@warn{0}%
+         \ifx\yquant at register@multi at splitparts\yquant at register@multi at splitparts@sepall%
+            % In the multi as single case, we assume it can be implicitly understood that we always have a maximal multi gate. Only if there are two, we are in trouble.
+            \ifdefined\yquant at prepare@finalize at ctrl@multi at contiguous@warn%
+               \ifnum\yquant at prepare@finalize at ctrl@multi at contiguous@warn=1 %
+                  \PackageWarning{yquant.sty}{Ambiguous operation: multiple multi-register operations in combination with controls make it impossible to visually determine on which registers the gates act on.}%
+                  \yquant at config@operator at multi@warnfalse%
+                  \def\yquant at prepare@finalize at ctrl@multi at contiguous@warn{2}%
+               \else%
+                  \def\yquant at prepare@finalize at ctrl@multi at contiguous@warn{1}%
+               \fi%
+            \else%
+               \def\yquant at prepare@finalize at ctrl@multi at contiguous@warn{1}%
+            \fi%
+         \else%
+            \def\yquant at prepare@finalize at ctrl@multi at contiguous@warn{0}%
+         \fi%
       \else%
          \def\yquant at prepare@finalize at ctrl@multi at contiguous@warn{2}%
       \fi%
@@ -947,15 +962,17 @@
 }
 
 \protected\def\yquant at prepare@finalize at ctrl@multi at contiguous#1#2#3{%
-   \ifnum\yquant at prepare@finalize at ctrl@multi at contiguous@warn=1 %
-      \PackageWarning{yquant.sty}{Ambiguous operation: multiple discontiguous multi-register operations in combination with controls make it hard to visually determine on which registers the gates act on.}%
-      % switch the warning off for this group (which is a single operation)
-      \yquant at config@operator at multi@warnfalse%
-      \def\yquant at prepare@finalize at ctrl@multi at contiguous@warn{2}%
-   \else%
-      \numdef\yquant at prepare@finalize at ctrl@multi at contiguous@warn{%
-         \yquant at prepare@finalize at ctrl@multi at contiguous@warn+1%
-      }%
+   \unless\ifx\yquant at register@multi at splitparts\yquant at register@multi at splitparts@sepall%
+      \ifnum\yquant at prepare@finalize at ctrl@multi at contiguous@warn=1 %
+         \PackageWarning{yquant.sty}{Ambiguous operation: multiple discontiguous multi-register operations in combination with controls make it hard to visually determine on which registers the gates act on.}%
+         % switch the warning off for this group (which is a single operation)
+         \yquant at config@operator at multi@warnfalse%
+         \def\yquant at prepare@finalize at ctrl@multi at contiguous@warn{2}%
+      \else%
+         \numdef\yquant at prepare@finalize at ctrl@multi at contiguous@warn{%
+            \yquant at prepare@finalize at ctrl@multi at contiguous@warn+1%
+         }%
+      \fi%
    \fi%
    {% save \body
       \yquant at for \yquant at i := #1 to #2 {{% let inner loop mess up with macros

Modified: trunk/Master/texmf-dist/tex/latex/yquant/yquant.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/yquant/yquant.sty	2023-11-29 21:23:41 UTC (rev 68996)
+++ trunk/Master/texmf-dist/tex/latex/yquant/yquant.sty	2023-11-29 21:23:56 UTC (rev 68997)
@@ -15,7 +15,7 @@
 %
 % The Current Maintainer of this work is Benjamin Desef.
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{yquant}[2023/03/05 v0.7.4 Yet another quantum circuit library for LaTeX]
+\ProvidesPackage{yquant}[2023/11/26 v0.7.5 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.