Issue with cropping using Qcircuit
Brought to you by:
mscharrer
I'm experiencing an issue in which the beginning and end labels of qcircuit diagrams are clipped. For example, this code
% \documentclass{article} \documentclass[border={0pt 1pt}]{standalone} \usepackage{qcircuit} \usepackage{amsmath} \usepackage{mathtools} \DeclarePairedDelimiter\ket{\lvert}{\rangle} \begin{document} \Qcircuit @C=1em @R=1em { \lstick{\ket{A}} & \ctrl{1} & \rstick{\ket{A}} \qw \\ \lstick{\ket{B}} & \targ & \rstick{\ket{B\oplus A}} \qw } \end{document}
compiled with pdflatex file.tex
, clips the beginning and terminal kets. If I use the article document class, or extend the border I can make the whole image appear. I've attached a PDF of the non-clipped, correct version. But I'm not sure how to attach 2 files or upload images, so I haven't included the clipped version. Basically, it cuts out the As, B, and B xor A. I'm using standalone 2018/03/26 v1.3a
. Please let me know if you need any further information, etc. Thanks!
Here's the clipped version.
Hi Matthew,
standalone
clipps to the official bounding box and some picture environments do not encount labels to their bounding boxes. There is nothing from within TeX whatstandalone
can do about it as it has no way to know where the ink is and not.Workarounds you can try:
1. you could try to make
Qcircuit
produce the correct bounding box. Maybe there is an option, but I actually doubt that.2. add a border using the
border=<value>
class option. This depends on the picture unfortunatly, i.e. needs manual work.3. the tool
pdfcrop
which should come with LaTeX usesghostscript
(might need extra installation) to get the actual bounding box of the whole PDF. That tool can look where the ink is.There might be a way to make
standalone
callghostscript
to get the bounding box, but that is tricky as it requires the whole PDF to be finished first. I had that idea a while ago, but it is not often required and can be fixed manually as shown above.Thanks for such a quick response Martin. My setup is a bit unusual, so modifying Qcircuit to include text in the bounding box might actually be the easiest solution. In any event, this doesn't appear to really be an issue with
standalone
, so feel free to close this. Thanks for all the work you've put into this tool!