# [pdftex] Automatic custom equation numbers, hyperref and \ref*

Heiko Oberdiek oberdiek at uni-freiburg.de
Tue Feb 21 18:26:19 CET 2006

On Tue, Feb 21, 2006 at 09:48:54AM -0500, Victor Ivrii wrote:

> On 2/21/06, Heiko Oberdiek <oberdiek at uni-freiburg.de> wrote:
> > On Tue, Feb 21, 2006 at 06:19:27AM -0500, Victor Ivrii wrote:
> >
> > > I have equation which is numbered automatically, currently as (2.12)
> > > (for example)
> > > and labeled by \label{A}.
> > >
> > > Now, I want to create equation numbered as (2.12)^* and changing its
> > > number automatically as number of equation labeled by A changes.
> > > The logical and working construction is
> > >
> > > 1+1=2
> > > \tag*{$(\ref{A})^*$}
> > > \label{B}
> > >
> > >
> > > however with hyperref it would create a nested hyperlink which behaves
> > > in funny way:
> > >
> > > (\ref{B}) blah-blah-blah
> > >
> > > looks as (2.12)^* blah-blah-blah  and (2.12)^* is clickable (a correct
> > > link) but blah-blah-blah becomes clickable too with the link to the
> > > first page.
> >
> > A minimal example would have shown your problem, e.g. about
>
> Well, I found some warnings of this type
>
> ! pdfTeX warning (ext4): destination with the same identifier (name{equation.2.
> 14}) has been already used, duplicate ignored
>
> \@EveryShipout at Output ... at Org@Shipout \box \@cclv
>
>
> but it is about very innocent equation rather than with the one I used
> of this type
>
>
> >
> > I wouldn't use equation and eqnarray with amsmath. Because of
> > compatibility issues they aren't too well supported.
>
> Ouch! What about multline, align and split?

Use amsmath environment with amsmath.

> while it is easy to
> substitute {equation}
> with {gather} there seem to be no easy substitution for other.

eqnarray also have problems with spacing that are not fixed
even in LaTeX because of compatibility. Also the amsmath
environments are much more powerful than eqnarray. A substitution
should not be too difficult.

> However, if I type
>
> \begin{multline}     % It was actually multline
> 1+1=2
> \label{A}
> \end{multline}
>
> and then
>
> \begin{multline}     % It was actually multline
> 1+2=3
> \tag*{(\ref*{A})\textsuperscript{\textasteriskcentered}}
> \label{B}
> \end{multline}
>
> and then
>
> (\ref{B}) blah-blah-blah
>
> then everything is printinted fine but  (2.12)^*   is linked to the
> first page, not to
> the actual equation \label{B} [exactly the same effect in the mathmode]

It's possible that there is a problem with the automatically
generated label names. But I haven't time for testing.

> However if I replace \ref*{A} by \ref{A} in the tag, again  everything
> is printinted fine,
> and  (2.12)^*   is linked to the correct equation but appears a
> parasite link: from blah-blah-blah (until the end of the outputline)
> to the first page.

pdfTeX has problems with nested links, see bug 479.

> PS In completely different topic and in the response to the third
> person you mentioned attachfile2. I am rather interested in it

In the next days I will upload and update packages of mine.
I haven't not yet decided how to proceed with the attachfile2 stuff.

Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
--