0

How can I label a table and then refer it to my latex file?

1 Answers1

0

You can use caption for the \caption, \label{xy} and \ref{xy}. See Wikibook

A working example:

\documentclass[10pt,a4paper]{article}
\usepackage{hyperref}
\begin{document}
\section{Animals}
 Table \ref{table:animals} <my text>
    \begin{table}[h]
        \centering
        \begin{tabular}{|c|c|}
            \hline 
            Animals & Results \\ 
            \hline 
            Dog & 4 \\ 
            \hline 
            Cat & 9 \\ 
            \hline 
            Bird & 15 \\ 
            \hline 
        \end{tabular}
        \caption{Animals}
        \label{table:animals}
    \end{table}
\end{document}

enter image description here

For a correct reference counting use \ref after \caption.
optional: The package hyperref produce hypertext links for cross-referencing (a clickable link is also created). hyperref reference

pipoli
  • 1