# Referencing Multiple Tables in Paragraphs

I am trying to reference multiple tables in a latex text document. I am trying to have two table numbered and within the text can reference the table number so if they are ever rearranged/reordered the text in the table would reference the correct table. I noticed that the two function used for referencing

\ref{table:somename}


and

\label{table:somename}


My question: How do I designate in the function which reference\ref{table:somename} refers to in the table?

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

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

• Use a unique label for each table. Jan 26 at 6:07
• I did that problem is I get Table ?? instead of Table 1 or Table 2. Instead I get Table ???, with the two question marks
– Jess
Jan 26 at 19:09
• Never mind I got it to work but I did exactly what you wrote before and I would get the ?? instead.
– Jess
Jan 26 at 19:13

The \label should be unique, otherwise TeX will tell you that you have "multiply defined" labels as a warning when you compile.

In your case, use some descriptive label for each table that is independent of their numbering, perhaps

\begin{table}
\caption{First table caption}\label{tab:measurements}
\end{table}

\begin{table}
\caption{Second table caption}\label{tab:details}
\end{table}


Now you would be able to refer to Table~\ref{tab:measurements} and Table~\ref{tab:details} and the \references will follow any layout changes. You will have to compile twice with every change of the layout in order to let the references settle. See Understanding how references and labels work for a discussion on this.