TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I've noticed that when centered captions contains \vref to some reference, the captions may sometimes not become entirely centered. I see this especially in my document where there are two figures on the same page, the second referring to the first, and the caption of the second is no longer completely centered.

I've tried to create a minimal example but it's difficult to get this behavior. However, I've managed to come up with the following:

\documentclass[a4paper, 11pt]{article}



  \caption{bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \vref{test}}

  \caption{bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \ref{test}}

The behavior I'm looking for will be shown in the caption of the Figure 2. However, when built twice as it is, everything looks okay. But if one does the following

  1. Build once
  2. Add an additional "bla" to the caption of the second figure, and rebuild.
  3. Remove the "bla" that you just added and then rebuild again.

Now the output will be the following:

enter image description here

Even though the captions of Figure 2 and 3 are textually exactly the same, the caption of Figure 2 is no longer centered as it should be. I fixed this problem in my own document by using \ref instead of \vref (the figures are on the same page anyway), but out of curiosity I would like to know what's going on.

share|improve this question
up vote 5 down vote accepted

When LaTeX typesets a caption, it does a check in order to see whether it fills at least one line; if it doesn't, then it centers the caption. One should go into the details of the implementation of \vref, but the most probable cause is that when doing the measurement, LaTeX "sees" a complete reference (to be resolved only later by the varioref macros) and so decides that the caption occupies more than a line of text.

share|improve this answer
Just as a side note: When the document is built twice as it is, the reference is first resolved to "??" and then to "Figure 1", both of which are small enough to make the entire caption fit on one line and thus be centered. However, when I do the modification in Step 2, the reference resolves to "Figure 1 on page 1", which causes the caption line to break. And only then does the caption gets messed up after, in the third build, being resolved to "Figure 1". – gablin Jan 7 '12 at 16:51
@gablin I really wouldn't go studying the details of varioref. Sorry. :) – egreg Jan 7 '12 at 16:56
Well, it was worth a try. =) – gablin Jan 7 '12 at 22:16

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.