# labels with tabular

The code is:

\documentclass{article}
\begin{document}
Critical temperature for different Type I superconductors is given in Table \ref{Tab:Tcr}:
\begin{center}
\begin{tabular}{l l}
material  & T [K]\\
\hline
Sn                     & 3,7 \\
Pb                     & 7,2 \\
Al                     & 1,2\\
\end{tabular}
\label{Tab:Tcr}
\end{center}
\end{document}


The output is

The table reference is missing in the text. How to display the table reference?

You can't \label a tabular, because a tabular does not receive an intrinsic ordering scheme (aka a number) that can be referenced. But if you place the tabular inside of a table, you can \label that.

\documentclass{article}
\begin{document}
Critical temperature for different Type I superconductors is given in Table~\ref{Tab:Tcr}
\begin{table}[ht]
\caption{My Table}
\centering
\begin{tabular}{l l}
material  & T [K]\\
\hline
Sn                     & 3,7 \\
Pb                     & 7,2 \\
Al                     & 1,2\\
\end{tabular}
\label{Tab:Tcr}
\end{table}
\end{document}


Now I will add an version that defies my earlier assertion. With the caption package, the \captionof macro is provided to emulate a table without the use of the floating table environment. And \captionof can take a label. So, technically, you still are not \labeling the tabular, but only the \captionof.

\documentclass{article}
\usepackage{caption}
\begin{document}
Critical temperature for different Type I superconductors is given in Table~\ref{Tab:Tcr}
\begin{center}
\captionof{table}{My Table\label{Tab:Tcr}}
\begin{tabular}{l l}
material  & T [K]\\
\hline
Sn                     & 3,7 \\
Pb                     & 7,2 \\
Al                     & 1,2\\
\end{tabular}
\end{center}
\end{document}

• If I may, loading caption would be useful here. Jun 21, 2017 at 15:38
• @Bernard Would that be because it provides \captionof or did you have another reason in mind? I modified to make use of the \captionof approach. Jun 21, 2017 at 16:44
• No, it's only because basic LaTeX forgets to swap the values of \abovecaptionskip (10pt by default, if I remember well) and \belowcaptionskip (0pt by default) when the caption is above table, whereas caption does. Jun 21, 2017 at 16:58