[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#432745: /usr/share/texmf-texlive/tex/latex/preprint/figcaps.sty: Breaks \label and \ref with figures



Ralf Stubner wrote:
> On Fri, Jul 13, 2007 at 23:36 -0700, Josh Triplett wrote:
>> Atsuhito Kohda wrote:
>>> Hi Josh,
>>>
>>> On Wed, 11 Jul 2007 11:03:18 -0700, Josh Triplett wrote:
>>>
>>>> This makes \label and thus \ref not work in combination with
>>>> \usepackage[printfigures]{figcaps}.  Removing the \def of \label solves this
>>>> problem; the labels and refs then work perfectly.
>>> I'm not sure but I've an impression that this could be
>>> a feature.  I don't understand an intention of figcaps package
>>> so well yet but its manual tells me:
>>>
>>> The contents of all the figure and table environments are written to aux-
>>> iliary les .lof and .lot respectively, and then these are read in again at
>>> the end of the paper. Since these auxiliary les are normally used to write
>>> information for the lists of gures and tables, this capability is lost.
>>>
>>> I might be wrong but are you sure that it's a bug?
>> Yes, quite sure.  This doesn't relate to the inability to have lists of
>> figures and lists of tables.  By gutting the \label macro, figcaps breaks the
>> ability to say "see figure~\ref{fig:myfigure}" and get "see figure 1".
>> Commenting out this change to the label macro makes such references work
>> perfectly.
> 
> It still would not work together with \usepackage{figcaps}, though. I
> have the impression that the author of figcaps.sty prefers to put
> \label inside of \caption like this:
>        \caption{Foo bar.\label{fig:foobar}}
> If one does this, figure references work without changes to the code. 
> 
> Indeed the sources for figcaps contains the following comment:
> 
> ,----[ figcaps.dtx ]
> | % The page(s) of figures are much like those for the tables, except that
> | % the |\label| command must be switched off. This is because the labels
> | % have already been defined during the list of captions.
> `----
> 
> If one does not switch of \label, then one would end up with two
> different definitions for that particualr label in the aux file.

That makes sense; if you define your labels inside your captions, you would
certainly end up with duplicate labels.  However, if you define your labels
outside your captions, you end up with no labels at all.  Both seem perfectly
valid ways to label figures, and I've seen examples of both.  One solution
that might make figcaps work with both styles: how about making \caption set a
flag during the evaluation of its body, and then redefine \label for the pages
of figures to have its normal behavior *only if not inside \caption*?  That
should work in both cases.

- Josh Triplett

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: