Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hyperref and pdflatex - no jump for missing targets ?

11 views
Skip to first unread message

Koen Tanghe

unread,
Jun 7, 2000, 3:00:00 AM6/7/00
to
Hi !

I have the following statement in my LaTeX source file:

\hyperlink{Concepts:Concept1}

and i am using pdflatex to produce a pdf file from it.

When i click on the hyperlink in Acrobat Reader, it jumps to the location of
the target Concepts:Concept1.
If the target does not exist, it jumps to the first page of the document.
Is it possible one way or another to specify that if the target does not
exist, the location should not change, so that, if i press a hyperlink of a
target that does not exist, nothing happens ?

I know this sounds rather strange: you could as well remove the hyperlink
from the source, you'll say. In fact, the problem is that the LaTeX source
containing the hyperlinks is generated automatically from some Matlab source
files, without knowing anything of whether a target will exist for the
hyperlink or not.

More precisely, the situation is like this: there is a function reference in
the document, where each function has a hyperlink to a possible conceptual
background part somewhere else in the document. But not all functions have
such a link target...
For example, if there is a function called Sum, there would be a hyperlink
to a target called Concepts:Sum, but this target does not exist, since Sum
does not have a conceptual background part in the document, it's too simple
a function.
Whereas a function like MusicModule would have a hyperlink to a target
Concepts:MusicModule, and that target WOULD exist, because there would be
some elaborated conceptual explanation behind that function somewhere else
in the document.

I could of course rewrite my program that automatically extracts the LaTeX
source file from the Matlab code, so that it knows about what functions have
a conceptual counterpart in the final document, but then i'd have to keep a
table of functions that need a hyperlink or add something in the comments of
the Matlab source code files...

I'd rather know if it's not possible to just change a setting so that
hyperlinks to a non-existing target don't do anything in stead of jumping to
the start of the document...

Any ideas/remarks ?

Koen Tanghe

IPEM - Institute for Psychoacoustics and Electronic Music
Ghent University
Blandijnberg 2
9000 Gent
Belgium
Phone: +32 9 2644141
Fax: +32 9 2644143
Email: Koen....@rug.ac.be
Web: http://www.ipem.rug.ac.be


Heiko Oberdiek

unread,
Jun 7, 2000, 3:00:00 AM6/7/00
to
"Koen Tanghe" <Koen....@rug.ac.be> wrote:

>\hyperlink{Concepts:Concept1}
>
>and i am using pdflatex to produce a pdf file from it.
>
>When i click on the hyperlink in Acrobat Reader, it jumps to the location of
>the target Concepts:Concept1.
>If the target does not exist, it jumps to the first page of the document.

This is an error condition and pdfTeX produces a warning:

!pdfTeX warning (dest): name{Concepts:Concept1} has been referenced
but does not exist, replaced by a fixed one

To change this behaviour, you have to change pdfTeX.

> another to specify that if the target does not
>exist, the location should not change, so that, if i press a hyperlink of a
>target that does not exist, nothing happens ?

This confuses the user, if there is a link in the text, then he
expects that he jumps anywhere, if he activate the link.

Therefore, if the target does not exist, there should not be a link
at all.

>[...] without knowing anything of whether a target will exist for the
>hyperlink or not.

You can overload \hyperlink and \hypertarget and log the targets in
the .aux file. Then at the next run, the targets are known.

Yours sincerely
Heiko <ober...@ruf.uni-freiburg.de>

0 new messages