projekter/yquant

scaling does not work with boxes

Closed this issue · 3 comments

Describe the bug
scaling does not work when boxes are included. they are moved outside the circuit, also it would be nice if text would not be scaled as well...

To Reproduce
code for reproduction:

\begin{tikzpicture}[scale=1.5]
  \begin{yquant}
    qubits {} a;
    nobit syndrome;

    [this subcircuit box style={dashed, color=blue, "Syndrome Measurement"}]
    subcircuit {
       qubits {} a;
       [out]
       qubits {$\ket0^{\otimes n}$} syndrome;
       box {$P$} a | syndrome;
       measure {} syndrome;
    } (a, syndrome);

    ["Recovery"]
    box {R} (a) | syndrome;
    discard syndrome;
  \end{yquant}
\end{tikzpicture}

Expected output
boxes are where they should be

Screenshots
scale1
scale1 5

Environment
whatever overleaf has

I don't know which version of yquant overleaf is running, but it is not the most current. I already made some improvements to scaled handling quite some time ago, however, thanks to this report, I also found some bugs in there, so that when I tried to run your example, it does not even compile. These are fixed with the previous commit.
However, the placement of the box is only slightly better, but still not correct. I'll have to see what else is missing.
Regarding the scaling of the text, this is because yquant defines /yquant/every circuit by default to be every node/.prefix style={transform shape}. You can simply disable this altogether or selectively, then nodes (text) will no longer be scaled/rotated/whatever transformations you have in effect. However, I don't think this is what you want to have (remember that every gate is also a node). You might want to selectively disable it for labels, so you can add every label/.append style={transform shape=false}] to the tikzpicture (this refers to the TikZ style every label, not to the yquant style every label!)

The lastest version should fix this. If you confirm, I'll push the new release to CTAN.

Thanks for the prompt response. It works now.