projekter / yquant

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

Circuit note centered #7

Closed Bebotron closed 3 years ago

Bebotron commented 3 years ago

First, let me say thank you for such a wonderful package, it has made my writing way more streamlined!

Describe the bug On the arxiv paper https://arxiv.org/abs/2007.12931, the example circuits are centered appropriately in their respective columns. The circuits in my document are aligned to the left of their respective column, leaving a significant empty space to the right of the image.

To Reproduce

\documentclass{article}

\usepackage{yquant, braket, lipsum}

\begin{document}

\section{example column}

Example of what this is supposed to look like

\lipsum[1]

\begin{tikzpicture}
    \begin{yquant}
        qubit {$\ket{q_{\idx}}$} q[3];
        swap (q[0], q[1]);
        swap (q[1], q[2]);
    \end{yquant}
\end{tikzpicture}

Image is not centered in the column

\lipsum[1]

\end{document}

Expected output I would like to get image centered on the column, but even adding \centering under \begin{tikzpicture} doesn't change anything. The below screenshot is from https://arxiv.org/abs/2007.12931 image

Screenshots The following is the output from the example above image

Environment some output from the .log file from the working example above. This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2020.8.26) 31 MAY 2021 Package: yquant 2020/07/11 v0.3.1 Yet another quantum circuit library for LaTeX

projekter commented 3 years ago

I cannot reproduce this (though I use version 0.4, this should be the very same thing in all previous versions, as yquant really does not influence the positioning on the page, this is a pure TeX/TikZ thing). Using \centering, I can perfectly center the picture, though I would usually go for the center environment if you want to switch back and forth:

\documentclass{article}

\usepackage{yquant, braket, lipsum}

\begin{document}

\section{example column}

Example of what this is supposed to look like

\lipsum[1]

\begin{center}
   \begin{tikzpicture}
      \begin{yquant}
         qubit {$\ket{q_{\idx}}$} q[3];
         swap (q[0], q[1]);
         swap (q[1], q[2]);
      \end{yquant}
   \end{tikzpicture}
\end{center}

Image is centered in the column

\lipsum[1]

\end{document}

image

Bebotron commented 3 years ago

Sorry about the noise, turns out I was doing it wrong and \begin{tikxpicture} had to be under \centering, the way it's properly done in your example. Again, thanks for a great package! Closing now.