[tex-eplain] Warnings about redefinition of xref labels

Dorai Sitaram dorai at ccs.neu.edu
Mon Apr 10 20:51:43 CEST 2006


Oleg wrote:
> > Specifically, \href{#somelabel}{link-text} (note the #) makes link-text a
> > hyperlink to wherever \label{somelabel} was placed in the current document.
> 
> If this is so then I doubt we should use the name `\href',
> unless we implement the same functionality in Eplain.  But
> this shouldn't be too difficult, so I think I'll be able to
> do it.
> 
> OK, so we would have our own \href.  But do we need \label?

Oh no, I didn't mean that.  I only meant that eplain's proposed \href
should do something analogous to the LaTeX \href.  I.e.,
\href{#somelabel}{...} should point to wherever
\definexref{somelabel}{somevalue}{whatever} is in the current document.

LaTeX \label does something extra that isn't really very eplainesque.  It
depends on there being numbered sections, which eplain considers user
territory.

By the way, here's a quick-and-dirty def of \href in terms of \hlstart that
seems to work OK.

\def\href{\bgroup\uncatcodespecials
  \catcode`\{=1 \catcode`\}=2
  \hrefI}

\def\hrefI{\egroup
  \def\hrefII{#1}%
  \hrefIII}

\def\hrefIII#1{\hlstart{url}{}{\hrefII}#1\hlend}

> > I don't know what the several labels in eplain translate to in terms of
> > hyperlink anchor names in the PDF output (i.e., the PDF equivalent of <a
> > name="...">).
> 
> Label names (including cross-reference labels for the
> implicit hyperlinks) are used for PDF anchor names without
> any mangling.

Very good.  See below. 
 
> > I take it that eplain massages the label name somewhat differently
> > depending on what category it is in, as it seems possible to have the same
> > user-supplied label for various label categories.
> 
> Did this work for you?!  I'd be really surprised, because
> the second definition of the label just overwrites the
> previous one.  What's more, the next version of Eplain will
> give warnings about the redefinitions (it's in CVS already).

Ah.  My misperception.  I actually like the labels being "non-typed", and
it appears that eplain does indeed not type them.  The experiment that
misled me was as follows.  I had placed

  \definexref{pageone}{1};

in the first page, and then called

  \hlstart{url}{}{#pageone} page one\hlend

in a subsequent page.  Eplain yelled and screamed, but it turns out that
was only because of the #.  I manually changed #'s catcode to 11 just
before the \hlstart, and the hyperlink was then made correctly.

In any case, this is certainly a bug, and an easily fixed one at that.
\hlstart's third argument (the URL) should be read within a group that does
\uncatcodespecials.

Sorry for barking up the wrong tree...,

Dorai


More information about the tex-eplain mailing list