projekter / yquant

Typesetting quantum circuits in a human-readable language
LaTeX Project Public License v1.3c
56 stars 5 forks source link

Subcircuit boxes don't render in `groups` environment #18

Closed till-m closed 2 years ago

till-m commented 2 years ago

Describe the bug When using subcircuits in a yquantgroup environment, the borders of the subcircuit box don't render.

To Reproduce

\begin{figure}[h]
    \centering
    \begin{tikzpicture}
        \begin{yquantgroup}
            \registers{
                qubit {} q[2];
            }
            \circuit{
                x q[0];
                cnot q[1] | q[0];
            }
            \equals
            \circuit{
                cnot q[1] | q[0];
                [this subcircuit box style={inner ysep=6pt, "Two $X$"}]
                subcircuit {
                    qubit {} q[2];
                    x q;
                } (-);
            }
        \end{yquantgroup}
    \end{tikzpicture}
\end{figure}

I also tried using a dashed style, which unfortunately doesn't seem to work either. Neither produces an error, it just won't render the borders.

Expected output I would expect a solid-border subcircuit box around the two X gates.

Screenshots image

Environment Compiled using PdfLaTeX with yquant 0.6 and tikz v3.1.8b.

Once again, thank you for the project @projekter!

projekter commented 2 years ago

Thank you for reporting this. Within groups, the frameless attribute was applied via a normal style, not an argument. This did not get reset at all appropriate places.

till-m commented 2 years ago

Thank you for the quick fix!

On an unrelated sidenote, I was wondering if it was possible to make gates with dashed instead of solid borders?

projekter commented 2 years ago

Sure, just pass [dashed] as an attribute to the gate (or any line dashing pattern that TikZ understands). You can use arbitrary TikZ styles, as shown in the manual examples (have a look for example at pages 122 and 123 in the current master version). Or, if you want to apply it to all gates of a certain type, add it to the respective style of the gate (e.g. \begin{yquant}[operators/every h/.append style={dashed}], or even globally in the document by using \yquantset{operators/every h.....}.