5

Possible Duplicate:
Incorrect target of \label link produced by hyperref

Labeling and linking in LaTeX confuses me.

I have something like the following:

\section{main section}
\label{sec:mainsection}
 %lots of text
\label{SomethingDescribedButNotDocumentElement}
%more text

I want to be able to link to the second label, but it seems those labels are associated with the previous document element (in this case a main section)

So something like:

\hyperref[SomethingDescribedButNotDocumentElement]{link to 2nd label}

But this jumps up to the sec:mainsection label.

  • How do I link to an arbitrary section of my document (which may be not described by section or figure etc)?
enderland
  • 1,644

1 Answers1

10

You can generate a new anchor by \phantomsection. The syntax of \hyperref with optional argument can be used to link an arbitrary text to this location:

\phantomsection
\label{SomethingDescribedButNotDocumentElement}

\hyperref[SomethingDescribedButNotDocumentElement]{Something}
Heiko Oberdiek
  • 271,626
  • Perfect! This is exactly what I needed. – enderland Jan 16 '13 at 22:42
  • 3
    It is not a bad question. However, we all know that it has been asked many times here. In my opinion, instead of answering it, the duplicate should be found and the question closed. – yo' Jan 16 '13 at 22:46