This is a question about what's happening under the hood, since I already know some ways to get my desired output. My question is what is the reason why the combination of numberwithin/hyperref behaves differently for equations than for tables. Namely, the following code has the problem that the hyperlink to Table 3.1 actually points to Table 2.1. But the hyperlink to equation 3.1 correctly points to equation 3.1. I'm aware that this can be fixed by moving the \numberwithin commands to after the \usepackage{hyperref} (or via other methods). But I don't understand why the following code behaves differently for equations versus for tables, and I wonder whether this is an instance of some more general thing that I would benefit from knowing. Is there some general way in which (La)TeX handles equations differently from tables?






Cite equations \eqref{eq1} and \eqref{eq2}, and Tables \ref{table1} and \ref{table2}.




1&2 \\ \hline
3&4 \\ \hline



5&6 \\ \hline
7&8 \\ \hline


1 Answer 1


You get a warning from pdftex about duplicate destination names:

pdfTeX warning (ext4): destination with the same identifier (name{table.1}) has
 been already used, duplicate ignored

The cause is that hyperref assumes tables with unique numbers and creates for both the destination table.1.

If you move the \numberwithin{table}{section} behind hyperref, hyperref can kick in and adapt the destination name too (it will then use table.1.1 and table.2.1 etc).

The alternative is to adjust the destination name manually:


equations are different as at some time in history hyperref decided that it is safer to add the section number anyway. So it contains the definition

  • Thanks! To me it seems odd that hyperref does something different for equations than for tables, but anyway it's comforting to know that the issue I observed comes from that package, rather than from some more fundamental TeX issue I didn't know. Commented Mar 3 at 18:54

You must log in to answer this question.

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