TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My subfloat command is standard and simple:


  \caption{QR code}


And I end up getting something like this, with the captions shifted away to the right:

p i c t u r e 1     p i c t u r e 2     

                   (a) illegitimate     (b) legitimate  

Why are the captions shifted so far away instead of staying under the pictures? The pictures are of equal and appropriate sizes and there're plenty of space to move around!

Edit: I checked out the log file, which seems to say something's wrong with the picture anti02. What could be wrong, please?

LaTeX Warning: Label `' multiply defined.

) ABD: EveryShipout initializing macros
(E:\CTEX\MiKTeX\tex\latex\amsfonts\umsb.fd) [1] [2]
(E:\CTEX\MiKTeX\tex\latex\base\omscmr.fd) [3] [4] [5] [6] <QR.eps>
Underfull \hbox (badness 10000) in paragraph at lines 291--291

Overfull \hbox (233.31259pt too wide) in paragraph at lines 291--291
Underfull \hbox (badness 10000) in paragraph at lines 293--293

Overfull \hbox (233.31259pt too wide) in paragraph at lines 293--293
[7] [8] [9] [10] [11] [12] ("C:\Users\eric\Desktop\number guessing——test.aux"

2nd Edit: I removed this command:


in preamble and it worked right. But why?

share|improve this question
It works fine for me. What versions of subfig and caption are you using? – Jake Mar 29 '12 at 14:12
@Jake: I don't know. I downloaded the whole thing as a package. How could this matter? – Eric Mar 29 '12 at 14:16
Maybe you're using an old version of one of the packages that had a bug in it. If you add \listfiles to your preamble, the versions of the packages will be printed near the end of the .log file. I have subfig.sty 2005/06/28 ver: 1.3 and caption.sty 2011/11/10 v3.2e. Can you also try using \usepackage[demo]{graphicx} to load the graphicx package and see whether you still get the incorrect results? – Jake Mar 29 '12 at 14:20
Does the problem occur with the exact code you just posted? – Gonzalo Medina Mar 29 '12 at 14:20
@Jake: Yes they are exactly the same versions as yours. \usepackage[demo]{graphicx} still gets to same the wrong positions. – Eric Mar 29 '12 at 14:38

If I modify your MWE so it starts with


as I don't have your eps files I get the following

enter image description here

which shows that it works. If you get the same, then remove the draft again and try outside of the figure, just in normal text


If the box does not surround the figure, it means that the bounding box in the file is incorrect and so the dimensions of the image are not as they appear. if that is the case you can fix the eps file or supply a corrected bounding box using the bb= 1 2 3 4 key in the optional argument to \includegraphics using the correct values not 1 2 3 4!

share|improve this answer
Thank you for the answer. I was being unclear because that code is just part of a larger article. The real problem is this command \setcaptionwidth{5in} in the preamble. Please see the second edit. – Eric Mar 29 '12 at 16:27
Ah well what do you expect to happen? you have requested two captions each 5in wide, but the page is not that wide so they can't fit. – David Carlisle Mar 29 '12 at 16:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.