0

When I reference a table in a posterior chapter in my thesis, instead of the correct table number it puts ??. However, the link works correctly, and the table appears in the List of Tables fine.

I reference it as:

\ref{tab:datasets}

The table is:

\begin{table}[h] \label{tab:datasets} ...

The log shows

Reference 'tab:datasets' on page 16 undefined

How can I make Latex show the proper table number?

5
  • 3
    Put the label behind the caption. Jun 24, 2015 at 14:26
  • And you need to compile at least twice. The label number is written to the .aux file and read at the beginning (\begin{document}) of the next LaTeX run. Jun 24, 2015 at 14:31
  • @HeikoOberdiek: As the table appears in the list of table and links work I think one can assume that the document has been compiled twice. Jun 24, 2015 at 14:54
  • @UlrikeFischer That does not explain the question marks. The \label could be added at a later time, the the auxiliary files already contain the caption, but not yet the label. Jun 24, 2015 at 15:01
  • @UlrikeFischer gave the correct answer. Jun 24, 2015 at 15:33

1 Answer 1

1

You need to run the program twice, one after another. And before that, be sure you have used the standard \label-\ref system: \label{labelname} and \ref{labelname}. In your case \label{tab:datasets} and \ref{tab:datasets}. Try to avoid using the same "label name" more times.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .