I recently had the following problem, I was using a label to reference a table where I placed the “tabular”- environment into the “small”- environment to decrease its size. The number indicated by the reference was not the table index, but rather the number of the section/subsection within which I placed the table. The problems seems to exist in both, Miktex and MacTex…
A table ususally has the following structure (for an introduction to tables click here) with the “small”- environment added to slightly decrease its size:
\begin{table}[htdp] \caption{default} \begin{small} \begin{center} \begin{tabular}{|c|c|} \end{tabular} \end{center} \end{small} \label{default} \end{table}
Placing the label inside both, “small”- and “center”- environment solves the problem.
Hence:
\begin{table}[htdp] \caption{default} \begin{small} \begin{center} \begin{tabular}{|c|c|} \end{tabular} \label{default} \end{center} \end{small} \end{table}
I actually don’t know why Latex does not translate the reference correctly, as the label is still within the “table”-environment, at least the problem can be solved that way.
I am working with LyX and having the same problem as you (except that I am not using the small enviroment). The problem is that I can’t solve it the same way as you did, because I don’t have direct access to the Latex code. I don’t know why it doesn’t work referencing tables if with figures it does ok. ¿Do you figure out how to solve it?
Found the solution 🙂
I only needed to insert the label inside the caption, and it solved automagically.
I actually thought there is a way to write raw Latex code directly into the Lyx file, but I don’t know Lyx very well, maybe I am wrong.
Glad you solved your problem 😉
I’m writting my PhD thesis and I’ve been suffering from the same problem you
describe and fix. So I thank you for your solution, which worked perfectly for my
particular case. I’m using TeX (Web2C 7.4.5) running on a Slackware Linux 9.1 (2003).
I’m working on a publication document and was having the same problem. You fixed me! Thanks!
Thanks Artik, your solucion worked for me too.
it works like you said, I wonder why is that. Just use something like
Thanks
caption thing worked for me.
thanks
Thanks so much, today I’ve spent hours trying to solve such a problem. Thanks again
Use the package “caption” and set the options. This provides great flexibility in changing the properties of the label and the legend for a table.
E.g.
writes label and legend in small letters and additionally the label in bold face.
Thx a lot!! This fix helped a lot for my master thesis!