LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

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

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

Print Reply
Subject:
From:
David Kastrup <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Mon, 17 May 2004 08:50:17 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (81 lines)
Donald Arseneau <[log in to unmask]> writes:

> Frank Mittelbach <[log in to unmask]> writes:
>
> >  > It was supposed to hit at \label time.  But since putting a label
> >
> > i still don't see how that would work
>
> You did analyze it already: it is a confusing undefined control
> sequence  error, where the "real" error message is the csname.  The
> \csname must be constructed in a way that does not equate it to \relax.
>
> Url.sty contains:
>
> \def\Url@movingtest{\begingroup
>  \ifx\let\HyPsd@LetCommand % we are already in a pdf string!
>   \expandafter\Url@unmove \fi % give the argument and hope for the best
>  \let\Url@moving\relax\relax\relax
>  \ifx\Url@moving\relax\else \expandafter\Url@unmove \fi
>  \endgroup}
> \long\def\Url@unmove#1\Url@y{\endgroup \ifx\protect\relax\else\protect\Url\fi}
> \edef\Url@moving{\csname Url Error\endcsname}
> \expandafter\edef\Url@moving
>  {\csname url used in a moving argument.\endcsname}
> \expandafter\expandafter\expandafter \let \Url@moving\@undefined
>
> Note the last line!  This gives error messages like:
>
> ! Undefined control sequence.
> \Url Error ->\url used in a moving argument.
>
> l.104 \section{\url{moving}}
>
>
> Anyway, We should still allow \label for purposes of \pageref, so the
> error should indeed be encoded to occur at \ref.  It would be nice if
> \label would put the current \inputlineno into the error message, but
> that requires altering the definition of \label.

No, it doesn't.  I seem to be talking against the wall here.  Here
are the relevant definitions:

\def\label#1{\@bsphack
  \protected@write\@auxout{}%
         {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
  \@esphack}

\long\def \protected@write#1#2#3{%
      \begingroup
       \let\thepage\relax
       #2%
       \let\protect\@unexpandable@protect
       \edef\reserved@a{\write#1{#3}}%
       \reserved@a
      \endgroup
      \if@nobreak\ifvmode\nobreak\fi\fi
}

As you can see, putting \the\inputlineno into \currentlabel will
expand to the input line number at the time where \label is called.

I have to admit to Frank that without changing the definition of
\label, we won't get the label name itself for reference in the
message.  Unless we wanted to play _very_ dirty tricks and
use something like
\def\@currentlabel{\noexpand\pickapart\noexpand\reserved@a}

And the \pickapart breaks up \reserved@a into its constituents.

However, if we are going to change \@float, there is little harm in
changing \label to include a
\def\@labelname{#1}%
\@onelevelsanitize\@labelname
into the definition of \label.

I can't see \label working in a context where the above would have
problems.

--
David Kastrup, Kriemhildstr. 15, 44793 Bochum

ATOM RSS1 RSS2