summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-11-30 03:00:54 +0000
committerNorbert Preining <norbert@preining.info>2023-11-30 03:00:54 +0000
commitff7e60f3d1af3d5bbcc9c125c01a063391a30cc5 (patch)
treefd310171798141fad998be0012bec3f6f580deb9 /graphics/pgf/contrib
parent948069736e39240a1486f59e30fb094b4fd09b74 (diff)
CTAN sync 202311300300
Diffstat (limited to 'graphics/pgf/contrib')
-rw-r--r--graphics/pgf/contrib/yquant/doc/yquant-doc.pdfbin1023770 -> 1024472 bytes
-rw-r--r--graphics/pgf/contrib/yquant/doc/yquant-doc.tex7
-rw-r--r--graphics/pgf/contrib/yquant/tex/yquant-draw.tex59
-rw-r--r--graphics/pgf/contrib/yquant/tex/yquant-prepare.tex37
-rw-r--r--graphics/pgf/contrib/yquant/tex/yquant.sty2
5 files changed, 77 insertions, 28 deletions
diff --git a/graphics/pgf/contrib/yquant/doc/yquant-doc.pdf b/graphics/pgf/contrib/yquant/doc/yquant-doc.pdf
index c5de54c0c1..47ecd1a36f 100644
--- a/graphics/pgf/contrib/yquant/doc/yquant-doc.pdf
+++ b/graphics/pgf/contrib/yquant/doc/yquant-doc.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/yquant/doc/yquant-doc.tex b/graphics/pgf/contrib/yquant/doc/yquant-doc.tex
index 22d624b637..825967b929 100644
--- a/graphics/pgf/contrib/yquant/doc/yquant-doc.tex
+++ b/graphics/pgf/contrib/yquant/doc/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/graphics/pgf/contrib/yquant/tex/yquant-draw.tex b/graphics/pgf/contrib/yquant/tex/yquant-draw.tex
index ed99e036d7..6cc47913c9 100644
--- a/graphics/pgf/contrib/yquant/tex/yquant-draw.tex
+++ b/graphics/pgf/contrib/yquant/tex/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/graphics/pgf/contrib/yquant/tex/yquant-prepare.tex b/graphics/pgf/contrib/yquant/tex/yquant-prepare.tex
index bbd826a8c8..e58905e902 100644
--- a/graphics/pgf/contrib/yquant/tex/yquant-prepare.tex
+++ b/graphics/pgf/contrib/yquant/tex/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/graphics/pgf/contrib/yquant/tex/yquant.sty b/graphics/pgf/contrib/yquant/tex/yquant.sty
index 6c4bbe4754..c3e0c2af13 100644
--- a/graphics/pgf/contrib/yquant/tex/yquant.sty
+++ b/graphics/pgf/contrib/yquant/tex/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]