Closed Bebotron closed 2 years ago
This is indeed the expected behavior. The documentation under "2.5 Arguments" states that yquant first tries to find whether the argument that you pass to the gate is some gate-specific argument (which are documented for each gate). Then, it tries to find it in the /yquant
namespace. And finally: "If it cannot be found there, it is passed to /yquant/operator style
."
So this last sentence is what happens here, since blue
is unknown at the other places. Basically, [blue]
is equivalent to [operator style={blue}]
. The definition of /yquant/operator style
then is to feed its arguments to the this operator
style, which only styles the operator itself. If you want to also overwrite the controls, you should additionally change the this control
style. If you also want to overwrite the vertical line that connects the operator with the controls, you should additionally change the every control line
style for this operator (curious, I didn't include a this control line
style... Can't remember why, but for sure made some sense initially).
Since the most likely cases are that
control style
shortcut that changes both at once andstyle
shortcut that changes all three at once.Note that these are not styles themselves, so the correct use is not with /.append style
, as you mentioned above. Instead, you have to call these styles directly (e.g., control style={...}
) and they then carry out /.append style
on the appropriate styles.
Long story short: [style=blue] cnot q[1] | q[0];
should do the job.
This is documented, but apparently not well-documented. I'd appreciate suggestions on how to make this more clear. I already thought about including the crazy circuit given in the qpic manual (Introduction), this should make things clear.
Perfect! That's exactly what I was looking for. Indeed I see more explanations in the docs. I think probably just having an example would be useful, as that is usually the first resource for creating circuits. Adding an explicit example in 6.3.6 B would seem appropriate. Perhaps this is asking for too much babying, but it certainly would be handy. That example you linked would indeed would be super helpful, and definitely a bit crazy.
Closing now since nothing is broken.
Ok, so now I included a note in 6.3.6B and also started implementing the qpic manual. In particular, the first circuit can already be found in the manual; this is a really nice example to showcase how the integration with TeX allows to defer all the circuit logic to the engine. I hope this helps.
Describe the bug Trying to style individual CNOTs does not seem to be behaving properly. Adding a single style descriptor to an individual CNOT gate changes the target, but not the control or the line.
To Reproduce
[control style/.append style={blue}]
does nothing.Expected output I would expect the full CNOT to be blue (control, control line, target)
I can get the desired effect manipulating the individual elements, but it really seems this should be the output from the above.
Perhaps this behavior is intentional, but it's not clear from the documentation since the only examples of changing the CNOT styling is by filling in the target, and not changing the outline color. So perhaps some clarity in the documentation on this would suffice. Environment