LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
David Kastrup <[log in to unmask]>
Sat, 15 May 2004 16:09:42 +0200
text/plain (47 lines)
Frank Mittelbach <[log in to unmask]> writes:

> \documentclass{article}
> \makeatletter
> \def\@float#1{%
>   \def\@currentlabel{\@latexerr{ref to misplaced label}{explain}}%
>   \@ifnextchar[%
>     {\@xfloat{#1}}%
>     {\edef\reserved@a{\noexpand\@xfloat{#1}[\csname fps@#1\endcsname]}%
>      \reserved@a}}
> \makeatother
> \begin{document}
> \begin{figure} \label{foo} \end{figure}
> Hallo \ref{foo}
> \end{document}
>  > Or does _anybody_ know of _any_ intentional use
>  > of a \label _inside_ of a figure, _not_ referring to the figure but
>  > to its section?
> no and any env or command that would allow for labels would change
> \@currentlabel anyway

Ok, your proposal has the disadvantage that the error occurs only when
referring to the label (and at the point of reference instead of
definition).  And it has the advantage that if you are only out for a
\pageref in the first place, this will still be legal.

>  > I mean, this must be the candidate for the most frequently asked
>  > question on LaTeX, ever.
> well it keeps people busy
> any suggestion for a good text?

\label{whatever} without preceding or enclosing \caption.
Labels must follow the item they are referencing.

David Kastrup, Kriemhildstr. 15, 44793 Bochum