Closed tigerjack closed 1 year ago
Can you please give a more precise description what you expect? Where is a wire deleted? And what should be black?
Ah, now I see what you mean (probably). As a workaround, you can set [drawing mode=size]
as option for yquant
(requires version 0.7). But this is just a workaround because really there's a much larger problem here: The heights/depths are completed incorrectly. I'll have to look into this, but this will probably take some time.
@projekter I confirm that the workaround correctly draws the missing line on the wire a2,1
, with no overlap with the Z
gate. Those were the two issues in the original figure.
Thanks, as always, for your help.
@projekter On a closer inspection, the workaround correctly fixes the problem with the missing wire. However, the wire color is set to the one specified after.
For example, in the image, I would like to have the blue color to be applied exactly when I called it. Or, in other words, the initial part of wire a2,0
should be black. Or at least a reasonable portion of it.
Well, the initial part (the one before the subcircuit) is black. If I then just look at the first subcircuit, i.e., \bef
is zero, then all the loops expand to
nobit above;
qubit {} a0[3]; qubit {} a1[3]; qubit {} a2[3];
nobit below;
% i = 0: since \i=\bef, the \if part is skipped.
% i = 1:
setstyle {color=blue} a1[0];
% aft = 0: since \aft=\bef, the if part is skipped.
% aft = 1
z a1[1] | a0[1], a1[0];
% aft = 2
z a1[2] | a0[2], a1[0];
setstyle {color=orange} a1[0];
% i = 2
setstyle {color=blue} a2[0];
% aft = 0: since \aft=\bef, the if part is skipped
% aft = 1
z a2[1] | a0[1], a2[0];
% aft = 2
z a2[2] | a0[2], a2[0];
setstyle {color=orange} a2[0];
And looking at this, yquant correctly colors your wires as you instructed it to do. Note that when you change a wire style, it will change the style starting from the last gate on this wire and continuing until further notice. This is because there are no true time slices in yquant. The current "time" of a wire is always the position of the last gate on the wire. So since you apply setstyle
as the very first things before any other wire, it will simply color the wire from the start (in this case, from the start of the subcircuit). In order to change this, you'll have to place a gate before the setstyle
command. Any gate will do, also if it is invisible - you'll probably want to put hspace
in there, so that you can exactly state how long the black line segment should be. (In fact, you can simply put the hspace to all gates at the very beginning).
Thanks again @projekter , indeed using hspace {} -;
right before the addstyle
command did the trick.
Out of curiosity, what if I want to extend instead the color a bit above the gate? Like, for example, on the wire a1,0
, what if I want for the blue color to extend a bit after the control qubit? Is there an easy way for it?
EDIT: well, I found the answer myself. Just use another hspace
after :)
And hspace is not called this way for nothing. You can pass any valid length as argument to extend the line: hspace {1cm} -;
. Or use the align
pseudo-gate, if you want to match with the position of another register.
The styling issue is now fixed and works in the default mode. However, I didn't deal the wrong vertical placement yet.
And now the positioning problem is also fixed.
Describe the bug Setting the style of a wire using either
setstyle
oraddstyle
delete the previous wire.To Reproduce This is a MWE reproducing the behavior
Expected output Change the color of a wire without affecting the previous one.
Screenshots![image](https://user-images.githubusercontent.com/8199216/212982837-853787da-aaab-445f-935e-6dad7ff2470e.png)
Environment
TeX 3.141592653 (TeX Live 2022/Arch Linux)
pdflatex
yquant Revision: 65351