[Tex/LaTex] Using table number in the text


Latex takes care of the number of tables by itself. Like it will automatically number the table as Table 4 etc. I want to use this number in the text.

For example, if I write "See Table 4" and later on I insert one more table above it then Table 4 becomes Table 5 but my text still says Table 4 which is inconsistent.

Best Answer

I suggest to have a look at The Not So Short Introduction to LaTex2e, in particular Section 2.8, which explains cross referencing.

In short, you need to define a label for your table, and later on reference this label to have an always updated number. It looks like this:

    Some & text
  \caption{The caption of the table}\label{table:somename}
In text, I can reference the Table~\ref{table:somename} like this.

You need to run latex twice to get the reference mechanism correct.

Related Question