-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Styling controls individually #25
Comments
There is no "intrinsic" support for this, and there are only styling keys that address all gates, positive, or negative controls. \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 |
...and also take into account controls when calculating the extent of a gate
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
The text was updated successfully, but these errors were encountered: