Referring to a table in LaTeX

Léo Léopold Hertz 준영 picture Léo Léopold Hertz 준영 · Aug 30, 2009 · Viewed 355.6k times · Source

How can you refer to a table number such that you get Table 7 for instance?

Sample data

Table \ref{table:questions} lorem lorem ipsun.

\begin{table}
\label{table:questions}
\begin{tabular}{| p{5cm} | p{5cm} | p{5cm} |}
  -- cut --
\end{tabular}
\end{table}

I get

Table 2.5 lorem lorem ipsun.

where 2.5 is the chapter number.

Answer

dreamlax picture dreamlax · Aug 30, 2009

You must place the label after a caption in order to for label to store the table's number, not the chapter's number.

\begin{table}
\begin{tabular}{| p{5cm} | p{5cm} | p{5cm} |}
  -- cut --
\end{tabular}
\caption{My table}
\label{table:kysymys}
\end{table}

Table \ref{table:kysymys} on page \pageref{table:kysymys} refers to the ...