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}
\usepackage{varioref}
\begin{document}
\begin{figure}[!h]
\centering
\framebox{1}
\caption{test}
\label{test}
\end{figure}
\begin{figure}[!h]
\centering
\framebox{2}
\caption{bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \vref{test}}
\end{figure}
\begin{figure}[!h]
\centering
\framebox{3}
\caption{bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \ref{test}}
\end{figure}
\end{document}
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
- Build once
- Add an additional "bla" to the caption of the second figure, and rebuild.
- Remove the "bla" that you just added and then rebuild again.
Now the output will be the following:
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.