Referencing tables potential bug?

29 views
Skip to first unread message

Hamid Bazzaz

unread,
Apr 3, 2011, 5:41:19 PM4/3/11
to ucsd-...@googlegroups.com
Hi folks,

I'm using the 2010-03-0 template and when trying to reference (e.g., /ref{...}) some tables that I have created I face some issues. Specifically, although the table number is generated correctly ("Table 4.1") but in the referenced tex the table number is wrong (e.g., "Table 4.2.4", which is the section number). I'm wondering what is the source of this problem; is it a bug in the template or I have missed something? Appreciated.

Thanks,
--Hamid

mir amicitas

unread,
Apr 3, 2011, 10:16:54 PM4/3/11
to ucsd-...@googlegroups.com
Harnid,

I seem to remember running into this before, and it was a Latex issue
and not specific to the UCSD template. Had something to do with
exactly where you placed the \label command . . . . Could you send a
minimal example, or at least the tex you are using to define your
table?


Novimir

> --
> You received this message because you are subscribed to the Google Groups
> "ucsd-thesis" group.
> To post to this group, send email to ucsd-...@googlegroups.com.
> To unsubscribe from this group, send email to
> ucsd-thesis...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ucsd-thesis?hl=en.
>

mir amicitas

unread,
Apr 3, 2011, 10:17:35 PM4/3/11
to ucsd-...@googlegroups.com
Oops, sorry for the typo in your name, sitting too far back from the
monitor . . . .

Hamid

unread,
Apr 4, 2011, 6:26:45 PM4/4/11
to ucsd-thesis
Hi Novimir,

Here is the way I am inserting the table:

\begin{table}[htbp]
\label{tbl:XXX}
\centering
\caption{YYYY}
\begin{tabular}{|l|c|c|}
\hline
Blah blah blah
\hline
Blah blah blah
...
\hline
\end{tabular}
\end{table}

Then later on I refer to the table by Tables~\ref{tbl:XXX}. Any idea
what is wrong?

Thanks,
--Hamid

On Apr 3, 7:17 pm, mir amicitas <amici...@gmail.com> wrote:
> Oops, sorry for the typo in your name, sitting too far back from the
> monitor . . . .
>

mir amicitas

unread,
Apr 4, 2011, 9:31:07 PM4/4/11
to ucsd-...@googlegroups.com
Hamid,

All you need to do is to place the \label statement after or inside
the \caption statement.


From the LeTeX wikibook:
"The command \label must appear after (or inside) \caption. Otherwise,
it will pick up the current section or list number instead of what you
intended."
https://secure.wikimedia.org/wikibooks/en/wiki/LaTeX/Labels_and_Cross-referencing#Fixing_wrong_labels


Novimir

Hamid Bazzaz

unread,
Apr 4, 2011, 9:56:40 PM4/4/11
to ucsd-...@googlegroups.com, mir amicitas
Yes, you are right! Thanks Novimir!

--Hamid
Reply all
Reply to author
Forward
0 new messages