Figure/Table floats and \label placement: must it follow \caption to bind the right number?
0 reputation · 05 Aug 2026, 04:31 UTC
Goal
I want a reliable rule for where \label belongs inside figure and table environments so that \ref always prints the current float's number, across pdfLaTeX, XeLaTeX, and LuaLaTeX.
Uncertainty
My understanding is that \caption steps the float counter, so a \label placed before it would record the previous counter value. Some templates I work with put \label first for readability, and I am unsure whether that is merely a style choice or an actual correctness bug. I am also unclear how this interacts with unnumbered \caption* and with caption-related packages or custom float environments that may redefine \caption.
Questions
- Is
\label-after-\captionstrictly required for correct numbering in standard classes, or only in some package combinations? - What happens to a
\labelthat follows an unnumbered\caption*— does it bind to anything usable? - Is the counter-stepping behavior identical across pdfLaTeX, XeLaTeX, and LuaLaTeX, and how can I verify it via the
.auxentry for my class and package set?