diff options
author | Karl Berry <karl@freefriends.org> | 2023-11-29 21:23:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-11-29 21:23:56 +0000 |
commit | de32418b6e60bf26d650dc041a55f491d9f56dd4 (patch) | |
tree | fa0a66b521512af15606556df5381f9a19dfe1b9 | |
parent | 1b4d04da2f07200012f27e1eb51f99718967b263 (diff) |
yquant (29nov23)
git-svn-id: svn://tug.org/texlive/trunk@68997 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/yquant/yquant-doc.pdf | bin | 1023770 -> 1024472 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/yquant/yquant-doc.tex | 7 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/yquant/yquant-draw.tex | 59 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex | 37 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/yquant/yquant.sty | 2 |
5 files changed, 77 insertions, 28 deletions
diff --git a/Master/texmf-dist/doc/latex/yquant/yquant-doc.pdf b/Master/texmf-dist/doc/latex/yquant/yquant-doc.pdf Binary files differindex c5de54c0c12..47ecd1a36fb 100644 --- a/Master/texmf-dist/doc/latex/yquant/yquant-doc.pdf +++ b/Master/texmf-dist/doc/latex/yquant/yquant-doc.pdf diff --git a/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex b/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex index 22d624b637a..825967b9291 100644 --- a/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex +++ b/Master/texmf-dist/doc/latex/yquant/yquant-doc.tex @@ -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 diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex b/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex index ed99e036d70..6cc47913c95 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-draw.tex @@ -544,7 +544,7 @@ \fi% \else% % first wire, left end - \pgfpointtransformed{\yquant@pgfqpoint{\yquant@draw@@x-.5\dimexpr\@firstofthree#4\relax}{\yquant@register@get@y1\relax}}% + \pgfpointtransformed{\yquant@pgfqpoint{\dimexpr\yquant@draw@@x-.5\dimexpr\@firstofthree#4\relax\relax}{\yquant@register@get@y1\relax}}% \ifdim\yquant@pgf@y>\yquant@pgf@picmaxy % \global\yquant@pgf@picmaxy=\yquant@pgf@y % \fi% @@ -552,7 +552,7 @@ \global\yquant@pgf@picminy=\yquant@pgf@y % \fi% % first wire, right end - \pgfpointtransformed{\yquant@pgfqpoint{\yquant@draw@@x+.5\dimenxpr\@firstofthree#4\relax}{\yquant@register@get@y1\relax}}% + \pgfpointtransformed{\yquant@pgfqpoint{\dimexpr\yquant@draw@@x+.5\dimexpr\@firstofthree#4\relax\relax}{\yquant@register@get@y1\relax}}% \ifdim\yquant@pgf@y>\yquant@pgf@picmaxy % \global\yquant@pgf@picmaxy=\yquant@pgf@y % \fi% @@ -560,7 +560,7 @@ \global\yquant@pgf@picminy=\yquant@pgf@y % \fi% % last wire, left end - \pgfpointtransformed{\yquant@pgfqpoint{\yquant@draw@@x-.5\dimexpr\@firstofthree#4\relax}{\yquant@register@get@y{\csname\yquant@prefix registers\endcsname}\relax}}% + \pgfpointtransformed{\yquant@pgfqpoint{\dimexpr\yquant@draw@@x-.5\dimexpr\@firstofthree#4\relax\relax}{\yquant@register@get@y{\csname\yquant@prefix registers\endcsname}\relax}}% \ifdim\yquant@pgf@y>\yquant@pgf@picmaxy % \global\yquant@pgf@picmaxy=\yquant@pgf@y % \fi% @@ -568,7 +568,7 @@ \global\yquant@pgf@picminy=\yquant@pgf@y % \fi% % last wire, right end - \pgfpointtransformed{\yquant@pgfqpoint{\yquant@draw@@x+.5\dimenxpr\@firstofthree#4\relax}{\yquant@register@get@y{\csname\yquant@prefix registers\endcsname}\relax}}% + \pgfpointtransformed{\yquant@pgfqpoint{\dimexpr\yquant@draw@@x+.5\dimexpr\@firstofthree#4\relax\relax}{\yquant@register@get@y{\csname\yquant@prefix registers\endcsname}\relax}}% \ifdim\yquant@pgf@y>\yquant@pgf@picmaxy % \global\yquant@pgf@picmaxy=\yquant@pgf@y % \fi% @@ -603,20 +603,49 @@ \dimen2=\dimexpr\yquant@pgf@picmaxy-\yquant@pgf@picminy\relax% \else% \begingroup% - \pgftransforminvert% - \pgfpointtransformed{\pgfqpoint{\pgf@picminx}{\pgf@picminy}}% - \@tempdima=\yquant@pgf@y% - \pgfpointtransform{\pgfqpoint{\pgf@picmaxx}{\pgf@picmaxy}}% - \edef\cmd{\@tempdima=\the\@tempdima\space\@tempdimb=\the\yquant@pgf@y\space}% + \ifdim\pgf@pt@ab pt=0pt% may also be reflection + % no rotations, not too hard + \pgftransforminvert% + \pgfpointtransformed{\pgfqpoint{\pgf@picminx}{\pgf@picminy}}% + \@tempdima=\yquant@pgf@y% + \pgfpointtransformed{\pgfqpoint{\pgf@picmaxx}{\pgf@picmaxy}}% + \dimen2=\dimexpr\yquant@pgf@y-\@tempdima\relax% + \ifdim\dimen2<0pt % reflections + \dimen2=-\dimen2 % + \fi% + \dimen0=\dimexpr.5\dimexpr\@tempdima+\yquant@pgf@y\relax\relax% + \else% + % We must figure out the size manually. pgf@picminy/pgf@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@pt@ab, cos alpha = \pgf@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@picmaxx-\pgf@picminx\relax% \@tempdima is X + \@tempdimb=\dimexpr\pgf@picmaxy-\pgf@picminy\relax% \@tempdimb is Y + \@tempdimc=\dimexpr\pgf@pt@aa\dimexpr\pgf@pt@aa pt\relax-% + \pgf@pt@ab\dimexpr\pgf@pt@ab pt\relax\relax% denominator + \dimen2=\dimexpr\dimexpr\pgf@pt@aa\@tempdimb-\pgf@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@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@pgfqpoint{\yquant@draw@@x}% - {.5\dimexpr\@tempdima+\@tempdimb\relax}}% - \dimen0=\yquant@pgf@y% - \pgfpointtransformed{\yquant@pgfqpoint{\yquant@draw@@x}% - {\dimexpr\@tempdimb-\@tempdima\relax}}% - \dimen2=\yquant@pgf@y% \fi% \edef\cmd{% \noexpand\path \yquant@coords(\yquant@draw@@x, \the\dimen0)% diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex b/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex index bbd826a8c8c..e58905e902f 100644 --- a/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex +++ b/Master/texmf-dist/tex/latex/yquant/yquant-prepare.tex @@ -933,7 +933,22 @@ \let\yquant@register@multi@contiguous=\yquant@prepare@finalize@ctrl@multi@contiguous% \ifyquant@circuit@operator@hasControls% \ifyquant@config@operator@multi@warn% - \def\yquant@prepare@finalize@ctrl@multi@contiguous@warn{0}% + \ifx\yquant@register@multi@splitparts\yquant@register@multi@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@prepare@finalize@ctrl@multi@contiguous@warn% + \ifnum\yquant@prepare@finalize@ctrl@multi@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@config@operator@multi@warnfalse% + \def\yquant@prepare@finalize@ctrl@multi@contiguous@warn{2}% + \else% + \def\yquant@prepare@finalize@ctrl@multi@contiguous@warn{1}% + \fi% + \else% + \def\yquant@prepare@finalize@ctrl@multi@contiguous@warn{1}% + \fi% + \else% + \def\yquant@prepare@finalize@ctrl@multi@contiguous@warn{0}% + \fi% \else% \def\yquant@prepare@finalize@ctrl@multi@contiguous@warn{2}% \fi% @@ -947,15 +962,17 @@ } \protected\def\yquant@prepare@finalize@ctrl@multi@contiguous#1#2#3{% - \ifnum\yquant@prepare@finalize@ctrl@multi@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@config@operator@multi@warnfalse% - \def\yquant@prepare@finalize@ctrl@multi@contiguous@warn{2}% - \else% - \numdef\yquant@prepare@finalize@ctrl@multi@contiguous@warn{% - \yquant@prepare@finalize@ctrl@multi@contiguous@warn+1% - }% + \unless\ifx\yquant@register@multi@splitparts\yquant@register@multi@splitparts@sepall% + \ifnum\yquant@prepare@finalize@ctrl@multi@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@config@operator@multi@warnfalse% + \def\yquant@prepare@finalize@ctrl@multi@contiguous@warn{2}% + \else% + \numdef\yquant@prepare@finalize@ctrl@multi@contiguous@warn{% + \yquant@prepare@finalize@ctrl@multi@contiguous@warn+1% + }% + \fi% \fi% {% save \body \yquant@for \yquant@i := #1 to #2 {{% let inner loop mess up with macros diff --git a/Master/texmf-dist/tex/latex/yquant/yquant.sty b/Master/texmf-dist/tex/latex/yquant/yquant.sty index 6c4bbe47542..c3e0c2af131 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}[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] |