Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
3  
You need to insert \label{name} after the table caption and then you can refer to the table by \ref{name} in the text. LaTeX will take care of updating the number. You will need to compile the document twice to get the referencing right. –  mythealias Mar 3 '13 at 19:04
1  
When a structural change in the document occurs that affects the numbers of sectioning headers and floats, be sure to recompile twice so that all cross-references are fully updated. For a general discussion of LaTeX cross-referencing methods see, e.g., tex.stackexchange.com/a/36312/5001. –  Mico Mar 3 '13 at 19:55

1 Answer 1

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:

\documentclass{article}
\begin{document}
\begin{table}
  \centering%
  \begin{tabular}{ll}
    Some & text
  \end{tabular}
  \caption{The caption of the table}\label{table:somename}
\end{table}
In text, I can reference the Table~\ref{table:somename} like this.
\end{document}

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.