Discussion:
table and subtable reference
(too old to reply)
Surendra Singhi
2005-02-14 00:36:22 UTC
Permalink
Hello,
I have a question about tables and subtables, I have created
subtables but when I refer them I get wrong reference number, the
table is referred to as 0(c) when it should be 1(c). Can anyone
please tell me what mistake am I making?

The code for creating table is:
\begin{table}[t]
\centering
\label{table:group}
\subtable[Training Set]{
\label{table:training}
{\scriptsize
\begin{tabular}{|c|c|c|c|} \hline
\multicolumn{3}{|c|}{ \em Attributes} &\em Class \\\cline{1-3}
\em $A_{1}$ &\em $›¼.$ &\em $A_{m}$ & \\\hline
$x_{1,1}$ &$...$ &$x_{1,m}$ & a \\
$x_{2,1}$ &$...$ &$x_{2,m}$ & b \\
$...$ &$...$ &$...$ &$...$ \\
$x_{n,1}$ &$...$ &$x_{n,m}$ & a \\\hline
\end{tabular}
}
}
\caption {Illustration of training $n$ set.}
\end{table} %

%and for referring it
\ref{table:training}


Thanks.
--
Surendra Singhi

www.public.asu.edu/~sksinghi/
Surendra Singhi
2005-02-14 01:32:17 UTC
Permalink
Post by Surendra Singhi
Hello,
I have a question about tables and subtables, I have created
subtables but when I refer them I get wrong reference number, the
table is referred to as 0(c) when it should be 1(c). Can anyone
please tell me what mistake am I making?
FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref . Put
\label after \caption.
Thanks for pointing that, but the original error is still there with the
new code:

The code for creating table is:
\begin{table}[t]
\centering
\subtable[Training Set]{
\label{table:training}
{\scriptsize
\begin{tabular}{|c|c|c|c|} \hline
\multicolumn{3}{|c|}{ \em Attributes} &\em Class \\\cline{1-3}
\em $A_{1}$ &\em $›¼.$ &\em $A_{m}$ & \\\hline
$x_{1,1}$ &$...$ &$x_{1,m}$ & a \\
$x_{2,1}$ &$...$ &$x_{2,m}$ & b \\
$...$ &$...$ &$...$ &$...$ \\
$x_{n,1}$ &$...$ &$x_{n,m}$ & a \\\hline
\end{tabular}
}
}
\caption {Illustration of training $n$ set.}
\label{table:group}
\end{table} %

%and for referring it
\ref{table:training}


Thanks.
--
Surendra Singhi

www.public.asu.edu/~sksinghi/
David Kastrup
2005-02-14 01:43:45 UTC
Permalink
Post by Surendra Singhi
Post by Surendra Singhi
Hello,
I have a question about tables and subtables, I have created
subtables but when I refer them I get wrong reference number, the
table is referred to as 0(c) when it should be 1(c). Can anyone
please tell me what mistake am I making?
FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref . Put
\label after \caption.
Thanks for pointing that, but the original error is still there with
Label(s) may have changed. Rerun to get cross-references right.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
UKTUG FAQ: <URL:http://www.tex.ac.uk/cgi-bin/texfaq2html>
Surendra Singhi
2005-02-14 05:43:47 UTC
Permalink
Post by David Kastrup
Post by Surendra Singhi
Post by Surendra Singhi
Hello,
I have a question about tables and subtables, I have created
subtables but when I refer them I get wrong reference number, the
table is referred to as 0(c) when it should be 1(c). Can anyone
please tell me what mistake am I making?
FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref . Put
\label after \caption.
Thanks for pointing that, but the original error is still there with
Label(s) may have changed. Rerun to get cross-references right.
I reran everything multiple times, but still the same problem. The funny
thing is that the reference for the main table appears correctly, but it
is the subtable whose reference is messed up.

I have one more question, this is about subtable caption, how can I make
it come below the sub-table ?

Thanks
--
Surendra Singhi

www.public.asu.edu/~sksinghi/
Surendra Singhi
2005-02-14 05:59:58 UTC
Permalink
Post by Surendra Singhi
Post by David Kastrup
Post by Surendra Singhi
Post by Surendra Singhi
Hello,
I have a question about tables and subtables, I have created
subtables but when I refer them I get wrong reference number, the
table is referred to as 0(c) when it should be 1(c). Can anyone
please tell me what mistake am I making?
FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref . Put
\label after \caption.
Thanks for pointing that, but the original error is still there with
Label(s) may have changed. Rerun to get cross-references right.
I reran everything multiple times, but still the same problem. The funny
thing is that the reference for the main table appears correctly, but it
is the subtable whose reference is messed up.
I have one more question, this is about subtable caption, how can I make
it come below the sub-table ?
I also get this warning:
LaTeX Warning: no tag name for the subtable at 509 on input line 509.

Thanks
--
Surendra Singhi

www.public.asu.edu/~sksinghi/
Axel Sommerfeldt
2005-02-14 09:12:17 UTC
Permalink
Post by Surendra Singhi
Post by David Kastrup
Post by Surendra Singhi
Thanks for pointing that, but the original error is still there with
Label(s) may have changed. Rerun to get cross-references right.
I reran everything multiple times, but still the same problem.
So please give us a small example file which we can compile, not just a
code snipped.
Post by Surendra Singhi
I have one more question, this is about subtable caption, how can I make
it come below the sub-table ?
AFAIK with the option "TABBOTCAP", see section "Caption Position Options"
in the subfigure manual.

HTH,
Axel
Surendra Singhi
2005-02-14 19:55:15 UTC
Permalink
Post by Axel Sommerfeldt
Post by Surendra Singhi
Post by David Kastrup
Post by Surendra Singhi
Thanks for pointing that, but the original error is still there with
Label(s) may have changed. Rerun to get cross-references right.
I reran everything multiple times, but still the same problem.
So please give us a small example file which we can compile, not just a
code snipped.
Post by Surendra Singhi
I have one more question, this is about subtable caption, how can I make
it come below the sub-table ?
AFAIK with the option "TABBOTCAP", see section "Caption Position Options"
in the subfigure manual.
HTH,
Axel
Thanks for all the answers.

The problem was with the way Latex \label stores the counter.
Because the caption for the enclosing table(the main table environment)
was below the subtable, the label for the subtable had the counter 0,
and then it accordingly numbered the subtable.
Using the TABBOTCAP option solved the problem. Its primary function is
to tell the label of the subtable that the main table's caption is at
the bottom. It also places the caption below the table.
--
Surendra Singhi

www.public.asu.edu/~sksinghi/
Ulrike Fischer
2005-02-14 09:05:02 UTC
Permalink
Post by Surendra Singhi
FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref . Put
\label after \caption.
Thanks for pointing that, but the original error is still there with
\begin{table}[t]
\centering
\subtable[Training Set]{
\label{table:training}
I don't know where \subtable cames from, but it is quite obvious that
the \label is still before the caption. \label always stores the
number of the last counter that can be referenced.
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
Robin Fairbairns
2005-02-14 10:24:26 UTC
Permalink
Post by Ulrike Fischer
Post by Surendra Singhi
FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref . Put
\label after \caption.
Thanks for pointing that, but the original error is still there with
\begin{table}[t]
\centering
\subtable[Training Set]{
\label{table:training}
I don't know where \subtable cames from, but it is quite obvious that
the \label is still before the caption. \label always stores the
number of the last counter that can be referenced.
if it's the \subtable that comes from the subfig package, the subtable
label is in precisely the correct place (according to the docs,
anyway).

(i expect the rules are the same in the obsolescent subfigure package,
but i've not checked.)
--
Robin (http://www.tex.ac.uk/faq) Fairbairns, Cambridge
Dan Luecking
2005-02-14 21:42:18 UTC
Permalink
Post by Robin Fairbairns
Post by Ulrike Fischer
Post by Surendra Singhi
FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref . Put
\label after \caption.
Thanks for pointing that, but the original error is still there with
\begin{table}[t]
\centering
\subtable[Training Set]{
\label{table:training}
I don't know where \subtable cames from, but it is quite obvious that
the \label is still before the caption. \label always stores the
number of the last counter that can be referenced.
if it's the \subtable that comes from the subfig package, the subtable
label is in precisely the correct place (according to the docs,
anyway).
Probably the subfigure package (subfig tells me \subtable undefined
on the code snippet).

Since our original poster didn't quote any exact error messages nor
say exactly what is wrong with the reference, I will guess that
the \thesubtable produces "(a)" or the like, but \ref produces (for
example) 0(a) from figure 1. This seems to be because \***@subtable is
defined to be \arabic{table}, but the subtable captions come before
the normal table caption.

I think (but then I've never used subfigure or subfig) the solution is
to place the table \caption command at the top, but use the option
tabbotcap (or TABBOTCAP, or both) to get them printed at the bottom.
This might allow the subtable labels to come after the table \caption
command and allow \***@subtable to pick up the correct number.


Dan
--
Dan Luecking Department of Mathematical Sciences
University of Arkansas Fayetteville, Arkansas 72701
To reply by email, change Look-In-Sig to luecking
Robin Fairbairns
2005-02-15 12:58:25 UTC
Permalink
Post by Dan Luecking
Post by Robin Fairbairns
if it's the \subtable that comes from the subfig package, the subtable
label is in precisely the correct place (according to the docs,
anyway).
Probably the subfigure package (subfig tells me \subtable undefined
on the code snippet).
subfig isn't backward compatible with subfigure, out of the box, but
it comes with a config file that makes it so. (mind you, i don't
understand how the file actually works...)
--
Robin (http://www.tex.ac.uk/faq) Fairbairns, Cambridge
Vilar Camara Neto
2005-02-14 02:16:42 UTC
Permalink
Post by Surendra Singhi
Hello,
I have a question about tables and subtables, I have created subtables
but when I refer them I get wrong reference number, the table is
referred to as 0(c) when it should be 1(c). Can anyone please tell
me what mistake am I making?
FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref . Put
\label after \caption.
--
Best regards,

Vilar Camara Neto
Loading...