[texhax] Wrong Labelling

Heiko Oberdiek heiko.oberdiek at googlemail.com
Thu Dec 9 21:55:33 CET 2010


On Thu, Dec 09, 2010 at 10:59:28AM +0000, Claudia Wolff wrote:

> \begin{center}
> \begin{figure}[ht]
> \includegraphics[width=0.6 \linewidth]{pLate.png}
> \textit{\caption{Relative Rise in Share of Pupils at Upper Secondary School
> between June and July, (Both Parents have the same Education Level)}}
> \label{percentage-late}
> \end{figure}
> \end{center}

My answer, given in comp.text.tex:

* The environment `center' is outside the *floating* environment
  `figure'.
    \begin{figure}
    \centering
    ...
    \end{figure}
* \caption is inside a group (\textit), therefore \label references
  the entry that was active before that group.
    \textit{\caption{...}\label{...}}
  But \caption inside \textit doesn't look quite sound.
  The font of a caption can easily be changed using the
  package `caption', e.g.
    \usepackage[font=it]{caption}
  or
    \usepackage{caption}
    \captionsetup{font=it}

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list