Re: Referencing Tables in Latex?

1999-04-20 Thread Wojciech Zabolotny


On Mon, 19 Apr 1999, Peter S Galbraith wrote:

 The \label needs to be in a \caption.
Or at least AFTER the \caption, because the \caption modifies counters
etc.

Wojtek Zabolotny
[EMAIL PROTECTED]


Referencing Tables in Latex?

1999-04-19 Thread Andrew Holmes
Hi all,

Sorry if this is a bit off topic, but with the recent converstaion about
latex I was wondering if someone could help me? I'm writing a document in
latex and I can use \ref and \label to identify figures fine. So if I put
\ref{something}, it will print the number of the figure called using
\label{something}

However when I try to do the same thing with a reference to a table, it
prints the section the table is in, instead of the number of the table. I can
show the number of tables with \arabic{table}, but when I put \ref{a_table},
it prints the section number of the table instead of the table's number. Eg
2.3.4 instead of 3.

Please help, I'm sure I'm just missing something simple but the documentation
doesn't help :-(

Thanks :-)
-- 
Andy Holmes

[EMAIL PROTECTED]

The path of my life is strewn with cow pats from the devil's own satanic 
herd!, Edmund Blackadder


Re: Referencing Tables in Latex?

1999-04-19 Thread John Maheu
On Mon, 19 Apr 1999, Andrew Holmes wrote:

 Hi all,
 
 Sorry if this is a bit off topic, but with the recent converstaion about
 latex I was wondering if someone could help me? I'm writing a document in
 latex and I can use \ref and \label to identify figures fine. So if I put
 \ref{something}, it will print the number of the figure called using
 \label{something}
 
 However when I try to do the same thing with a reference to a table, it
 prints the section the table is in, instead of the number of the table. I can
 show the number of tables with \arabic{table}, but when I put \ref{a_table},
 it prints the section number of the table instead of the table's number. Eg
 2.3.4 instead of 3.
 
It's hard to know what the problem is unless you show us some code or the 
log file. Is the label inside the table environment? Check to see if the
label definition is unique, ie. you didn't use it for the section label
also.


John

John Maheuphone  (780) 492-2049
University of Alberta fax(780) 492-3300
Dept. of Economicsemail  [EMAIL PROTECTED] 
Edmonton, Alberta
Canada, T6G 2H4



Re: Referencing Tables in Latex?

1999-04-19 Thread paul . huygen
Andrew Holmes [EMAIL PROTECTED] 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}

Paul Huygen


Re: Referencing Tables in Latex?

1999-04-19 Thread Peter S Galbraith

[EMAIL PROTECTED] wrote:

 Andrew Holmes [EMAIL PROTECTED] 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  [EMAIL PROTECTED]
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/ 


Re: Referencing Tables in Latex?

1999-04-19 Thread Andrew Holmes
Hi,

Here is some of the doc

This is the end of one of my tables...

---
$y$  0.00027 0.00034 0.00042 0.00050 0.00057 0.00065\\
\hline
\end{tabular}
\label{tab:dec}
\caption{Decimal Search Values}
\end{table}
--

and this is where I try to reference it

--
These are included in table~\ref{tab:dec}
--

Doing it like this seems ok to me, and works with figures, but in this case the
reference prints the section/location of the table instead of it's number.

Thanks.

On Mon, Apr 19, 1999 at 10:34:06AM -0600, John Maheu wrote:
 On Mon, 19 Apr 1999, Andrew Holmes wrote:
 
  
 It's hard to know what the problem is unless you show us some code or the 
 log file. Is the label inside the table environment? Check to see if the
 label definition is unique, ie. you didn't use it for the section label
 also.
 
 
 John
 
 John Maheuphone  (780) 492-2049
 University of Alberta fax(780) 492-3300
 Dept. of Economicsemail  [EMAIL PROTECTED] 
 Edmonton, Alberta
 Canada, T6G 2H4
 
 

-- 
Andy Holmes

[EMAIL PROTECTED]

The path of my life is strewn with cow pats from the devil's own satanic 
herd!, Edmund Blackadder


Re: Referencing Tables in Latex?

1999-04-19 Thread Andrew Holmes
Hi,

Thanks for the help. It's working fine now :-).
Should I nest the labels like this when I do figures as well, or is it not
important?
-- 
Andy Holmes

[EMAIL PROTECTED]

The path of my life is strewn with cow pats from the devil's own satanic 
herd!, Edmund Blackadder


Re: Referencing Tables in Latex?

1999-04-19 Thread Paul Huygen
Peter S Galbraith [EMAIL PROTECTED] wrote (about my
suggestion on how to put a \label in in a table):

   \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.

Well, actually I haven't tried right before writing the
answer. Sorry. On the other hand, the way I described how to do it is
the way my Emacs editor prompts me how to do it. The following works
for me:

\documentclass[11pt]{artikel3}
\begin{document}
In table~\ref{tab:tabel1} we see blablabla, while in
table~\ref{tab:tabel2} we see bliblibli.
\begin{table}[htbp]
  \begin{tabular}{ll}
bla  bla \\
bla  bla \\
bla  bla \\
bla  bla \\
  \end{tabular}
  \caption{De blablabla tabel}
  \label{tab:tabel1}
\end{table}

\begin{table}[htbp]
  \begin{tabular}{ll}
bli  bli \\
bli  bli \\
bli  bli \\
bli  bli \\
  \end{tabular}
  \caption{De bliblibli tabel}
  \label{tab:tabel2}
\end{table}
\end{document}


Re: Referencing Tables in Latex?

1999-04-19 Thread Åsmund Ødegård
Mon, 19 Apr skrev Andrew Holmes:
 However when I try to do the same thing with a reference to a table, it
 prints the section the table is in, instead of the number of the table. I can
 show the number of tables with \arabic{table}, but when I put \ref{a_table},
 it prints the section number of the table instead of the table's number. Eg
 2.3.4 instead of 3.

The \label command must be placed after the \caption, or inside it's argument.
So my documentation say, so maybe you have the wrong docs... Lamport's LaTeX
book is among the best on this topic.

Sincerly
-- 
Åsmund Ødegård
http://www.ifi.uio.no/~aasmundo/sider/main.html
--
2PE 1 5 så legg og just derfor all vinn på i eders tro å vise dyd, og
  i dyden skjønnsomhet,


Re: Referencing Tables in Latex?

1999-04-19 Thread Andrew Holmes
Hi,

I'd like to say thanks for all the great info I've had in such a short space
of time. It seems to work fine when I embed the \label inside the \caption,
but I'll try with the \label afterwards to see what happens. 

Back to writing bad maths coursework :-)
-- 
Andy Holmes

[EMAIL PROTECTED]

The path of my life is strewn with cow pats from the devil's own satanic 
herd!, Edmund Blackadder