Reply to comment

First, thanks again for this

First, thanks again for this sample code. And second, I got this to work. The short answer is that I had to move the label to a position immediately after the caption, like this:

\caption{Lattice mismatch calculations}\label{table:mism}

The longer answer is that I dug through an old (but very good) book named The LaTeX Companion, where I found the following information (which I'm pretty much just copying and pasting, forgive me for this plagiarism). The first lines are background information, and the last line (in bold) describes the solution:

For building cross-reference labels, the "currently active" structural element of a document is determined in the following way. The sectioning commands (\chapter, \section, ...), the environments equation, figure, table, and the theorem family, as well as the various levels of the enumerate environment, and \footnote set the current reference string, which contains the number generated by LaTeX for the given element. This reference string is usually set at the beginning of an element and reset when the scope of the element is exited.

Notable exceptions to this rule are the table and figure environments, where the reference string is defined by the \caption commands. This allows several \caption and \label pairs inside one environment. As it is the \caption directive that generates the number, the corresponding \label command must follow the \caption command in question, otherwise an incorrect number will be generated.

(I don't think some of those sentences are grammatically correct, but I double-checked my typing.)

I don't know if this will help all the problems described here, but I hope it does.

Reply

The content of this field is kept private and will not be shown publicly.