# How do I associate a label with a non-section document element? [duplicate]

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)?
-

## marked as duplicate by tohecz, cgnieder, egreg, bloodworks, Martin SchröderJan 16 '13 at 23:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

maybe you want to use \pageref instead of \ref? –  cmhughes Jan 16 '13 at 22:25
is there another section or do you have 2 labels in the same section? –  Rico Jan 16 '13 at 22:29
there are some good ideas in this question: When do I need to invoke \phantomsection?. –  barbara beeton Jan 16 '13 at 22:40
@Timebandit this would not be a problem if I did not have two labels in the same section/subsection/etc –  enderland Jan 16 '13 at 22:43
@enderland It is not really a mistake to ask something that has been here before, as long as you don't mind getting it closed. –  tohecz Jan 16 '13 at 22:50

## 1 Answer

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}

-
Perfect! This is exactly what I needed. –  enderland Jan 16 '13 at 22:42
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. –  tohecz Jan 16 '13 at 22:46