Closed tigerjack closed 1 year ago
There is no "intrinsic" support for this, and there are only styling keys that address all gates, positive, or negative controls.
However, it is not too hard to fake this: As always, yquant defines the \idx
macro before applying every style to the control. This macro holds the current visual index within the group (so, it iterates from 0 to the number of gates -1; from 0 to the number of positive control -1; and also negative controls). So you could simply define a conditional style like this:
\documentclass[tikz]{standalone}
\usepackage[compat=0.6]{yquant}
\begin{document}
\begin{tikzpicture}
\begin{yquant}
qubit {$q_\idx$} q[4];
[this control/.append style={fill=orange}]
cnot q[3] | q[0], q[1], q[2];
%
[this control/.code={\unexpanded{%
\ifcase\idx\relax%
\pgfkeysalso{fill=red}%
\or%
\pgfkeysalso{fill=blue}%
\else%
\pgfkeysalso{fill=green}%
\fi%
}}]
cnot q[3]| q[0], q[1], q[2];
\end{yquant}
\end{tikzpicture}
\end{document}
Of course, you can use any kind of style that you like. If you use this more often, it might be worth defining a custom style that does this job for you.
Excellent! Thank you @projekter
Is your feature request related to a problem? Please describe. At the moment, I can only style the whole operator or all the controls at once, but not the single controls.
Describe the solution you'd like I would like to style each control (i.e., the dots) of a multi-controlled gate individually.
Describe alternatives you've considered I tried to overcome the limitations using the usual
begin/end{scope}
, but it gets complicated and difficult to generalize.Additional context Using the code below
I obtained something like this, which is far from optimal![image](https://user-images.githubusercontent.com/8199216/214675174-9ac34dcc-11ec-4c2c-8577-16ea127a2e1b.png)