projekter / yquant

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

shorten doesn't work for 2-qubit barriers #6

Closed ajavadia closed 3 years ago

ajavadia commented 3 years ago

Describe the bug shorten works for yquant-line when it's on 1 wire, but not 2 wires.

To Reproduce In the example from docs, page 72, change a to a two-qubit register. It will no longer change the size of the barrier.

The code would be:

% \usetikzlibrary{quotes}
\begin{tikzpicture}[label distance=4mm]
   \begin{yquant}[operators/every barrier/.append style={red, thick, shorten <= -2.5mm, shorten >= -2.5mm}]
      qubit {$\ket0$} a[2];
      h a;
      ["1"]
      barrier (a);
      phase {[label distance=0pt]$\varphi$} a;
      ["2"]
      barrier (a);
      h a;
      ["3"]
      barrier (a);
      output {$\cos\frac\varphi2 \ket0 - i\sin\frac\varphi2 \ket1$};
   \end{yquant}
\end{tikzpicture}

Expected output Should stretch the barrier from bottom and top.

Screenshots image

Environment

projekter commented 3 years ago

Please check against the current master. It was more of a coincidence that shortening "worked" at all on single qubits - I accidentally implemented an enlargement with the shortening key. Now the direction is the correct one, I hope this does not break existing layouts.