[Tugindia] Order of \caption & \label

Manoj Kummini tugindia@tug.org
Thu, 5 Dec 2002 12:19:16 +0000 (GMT)


 --- H S Rai <hsraidce@iitr.ernet.in> wrote: 
> I find that while
> 
> \caption{MyCaption}
> \label{MyLabel}
> 
> works fine in all respect, but on changing order of these two lines
> in
> table environment, writes nothing, where it should write the number
> of
> table at  the place  where label  is referred,  while table  number
> is
> written correctly for the table along with its caption.

\label uses \@currentlabel, which is not set by \begin{<float>}, but
by the \caption inside the <float>. To be precise, it is set while
the <float> counter is incremented. Sectioning commands like
\section, \subsection etc increment their corresponding counters and,
while doing that, set \@currentlabel. That is why we can give a
statement like \section{My Section}\label{sec:mysec}.

Hope this answers your question.

With regards,
Manoj.


=====
--
Manoj Kummini
http://www.geocities.com/kummini/index.html
12 deg 58 min N, 77 deg 35 min E

________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com