Re: Referencing Tables in Latex?
paul.huygen@huygen.nl wrote:
> Andrew Holmes <andy@proxima.force9.co.uk> wrote:
>
> > However when I try to [reference with the \label/\ref mechanism]] with
> > a reference to a table, it prints the section the table is in, instead
> > of the number of the table.
>
> What you want to achieve can only be done if you put the table in a
> "table float", e.g.
>
> \begin{table}
> \begin{tabular} ...
> ...
> ...
> \end{tabular}
>
> \label{tab:a-table}
> \caption{blablabla}
> \end{table}
I think that's wrong. Have you tried it?
The \label needs to be in a \caption.
---------------------------------
\documentclass{article}
\begin{document}
\section{test}
\section{test}
\begin{table}
\begin{tabular}{ll}
s & l \\
s & ll
\end{tabular}
\caption{
\label{tab:a-table}
blablabla}
\end{table}
See table~\ref{tab:a-table}.
\end{document}
---------------------------------
In the example, table 1 is in section 2. The output should say
``See table 1.''.
--
Peter Galbraith, research scientist <GalbraithP@dfo-mpo.gc.ca>
Maurice Lamontagne Institute, Department of Fisheries and Oceans Canada
P.O. Box 1000, Mont-Joli Qc, G5H 3Z4 Canada. 418-775-0852 FAX: 775-0546
6623'rd GNU/Linux user at the Counter - http://counter.li.org/
Reply to: