Article View: comp.text.tex
Article #2106Re: hangcaption.sty; works but not with \label
From: Rainer Schoepf
Date: Wed, 12 Aug 1992 10:03
Date: Wed, 12 Aug 1992 10:03
52 lines
3093 bytes
3093 bytes
"George D. Greenwade" writes:
> This is related, believe me. In
> <1992Aug11.194154.6366@alchemy.chem.utoronto.ca> (comp.text.tex, Tue, 11
> Aug 1992 19:41:54 GMT) mroussel@alchemy.chem.utoronto.ca (Marc Roussel)
> posted:
> > In article <0095EBB9.4825C640.13366@SHSU.edu> "George D. Greenwade"
> > <bed_gdg@SHSU.edu> writes:
> > >With respect to b) [I haven't tried this, but it's a good guess], try:
> > > \caption{\label{fig:tree} A tree grows in Brooklyn.\protect\cite{BugsBunny}}
> > > ^^^^^^^^
> > [...]
> > >(i.e., it might be wise to include \protect\label as well
> > >if you insist on including the \label in the \caption).
> >
> > The first bit of advice (\protect\cite{}) is sound, but
> > \protect\label is not necessary because \label is specifically kludged
> > to work correctly inside of \caption{}. I have no idea if unnecessary
> > \protect declarations have any harmful effects.
>
> Except that they create ``invisible space'' and the kludge is far less than
> perfect. The apparently-superfluous \protect does matter for a few
> interesting applications. As Andrew and I experimented on this, it became
> apparent that moving the \label outside (but adjacent to) the \caption was
> the fix, i.e., changing \caption{\label{something}This is the caption text}
> to \caption{This is the caption text}\label{something} worked and fixed the
> problem above.
This is a tricky issue, since there are several different mechanisms
involved.
- Normally, \index reads its argument with the category codes of all
special characters excpet braces set to other. Of course, this won't
work when \index occurs inside the argument of another command.
- If executed \index takes precautions so that the spacing is not
affected by its presence. If it is preceded by \protect, it is not
necessarily executed at the time it is read. In the case of caption,
I would expect that with the \protect the \label command is executed
another time when the \listoffigures is typeset. Without the
\protect this doesn't happen.
In short, George's solution is the best: Put \label immediately after
the \caption command.
Rainer Schoepf
Konrad-Zuse-Zentrum ,,Ich mag es nicht, wenn
fuer Informationstechnik Berlin sich die Dinge so frueh
Heilbronner Strasse 10 am Morgen schon so
W-1000 Berlin 31 dynamisch entwickeln!''
Federal Republic of Germany
<Schoepf@sc.ZIB-Berlin.de> or <Schoepf@sc.ZIB-Berlin.dbp.de>
Technical Details
Message-ID:
<9208121003.AA29469@sc.zib-berlin.dbp.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!news.claremont.edu!ucivax!noiro.acs.uci.edu!unogate!mvb.saic.com!info-texShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!news.claremont.edu!ucivax!noiro.acs.uci.edu!unogate!mvb.saic.com!info-tex From: schoepf@sc.ZIB-Berlin.DE (Rainer Schoepf) Newsgroups: comp.text.tex Subject: Re: hangcaption.sty; works but not with \label Message-ID: <9208121003.AA29469@sc.zib-berlin.dbp.de> Date: Wed, 12 Aug 92 12:03:10 +0200 Organization: Konrad-Zuse-Zentrum fuer Informationstechnik Berlin X-Gateway-Source-Info: Mailing List Lines: 52