From 57df68d21de1b2bd14611df0f545834e2fbe26ce Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 5 Feb 2022 21:23:01 +0000
Subject: yquant (5feb22)

git-svn-id: svn://tug.org/texlive/trunk@61897 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/yquant/yquant-env.tex | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/yquant/yquant-env.tex')

diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-env.tex b/Master/texmf-dist/tex/latex/yquant/yquant-env.tex
index f26919c8d16..bbbf740e713 100644
--- a/Master/texmf-dist/tex/latex/yquant/yquant-env.tex
+++ b/Master/texmf-dist/tex/latex/yquant/yquant-env.tex
@@ -85,7 +85,7 @@
          \expandafter\noexpand\csname\yquant@prefix seamless\endcsname%
          \expandafter\noexpand\csname\yquant@prefix cleanup\endcsname%
       }%
-      \scope[{/yquant/.cd, #2, /tikz/.cd, /yquant/every circuit}]%
+      \scope[{/yquant/.cd, #2, /tikz/.cd, /yquant/every circuit, /yquant/internal/setup done}]%
 }
 
 \protected\def\yquant@env@end{%
@@ -175,7 +175,7 @@
       \yquant@env@end@calcypositions@run1%
       \yquant@env@end@calcypositions@godeepfalse%
       \yquant@env@end@calcypositions@redo%
-%      % The macros now set up performed all the proper and unambiguous justification. After that, we will also need to take care of the multi gates. We expect that for most of all multi gates, we already have enough space. But sometimes, this may not be the case, so we need to increase overall spacing and re-evaluate all spacing. In order to get a proper balanced layout, we start with the largest enlargement that is required. Every enlargement step will equally distribute the registers in between. Starting with the largest one, this is likely to also solve issues with smaller ones.
+      % The macros now set up performed all the proper and unambiguous justification. After that, we will also need to take care of the multi gates. We expect that for most of all multi gates, we already have enough space. But sometimes, this may not be the case, so we need to increase overall spacing and re-evaluate all spacing. In order to get a proper balanced layout, we start with the largest enlargement that is required. Every enlargement step will equally distribute the registers in between. Starting with the largest one, this is likely to also solve issues with smaller ones.
       \yquant@env@end@calcypositions@multi%
       % Turn the preliminary positions into true ones at every level.
       \yquant@env@end@setypositions1%
@@ -477,16 +477,17 @@
    \ifyquantdebug%
       \yquant@for \i := 1 to \csname\yquant@prefix registers\endcsname {%
          \ifcsname\yquant@prefix registermap@\i\endcsname%
-            \message{^^J y(#1, \i): external}%
+            \message{^^J \yquant@orientation@y(#1, \i): external}%
          \else%
-            \message{^^J y(#1, \i): \csname\yquant@prefix env@endy@\i\endcsname}%
-            \yquant@register@set@y\i{-\csname\yquant@prefix env@endy@\i\endcsname}%
+            \message{^^J \yquant@orientation@y(#1, \i): \csname\yquant@prefix env@endy@\i\endcsname}%
+            % do not use \yquant@orientation@minus: this will lead to an explicit + in vertical mode, and the value of the register y position is directly used for TikZ coordinates. However, those are parsed using \pgfmathsetlength, which will skip pgf's parser if the value starts with an explicit +. We don't want this.
+            \yquant@register@set@y\i{\ifyquanthorz{-}{}\csname\yquant@prefix env@endy@\i\endcsname}%
          \fi%
       }%
    \else%
       \yquant@for \i := 1 to \csname\yquant@prefix registers\endcsname {%
          \unless\ifcsname\yquant@prefix registermap@\i\endcsname%
-            \yquant@register@set@y\i{-\csname\yquant@prefix env@endy@\i\endcsname}%
+            \yquant@register@set@y\i{\ifyquanthorz{-}{}\csname\yquant@prefix env@endy@\i\endcsname}%
          \fi%
       }%
    \fi%
-- 
cgit v1.2.3

