# 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 yo', clemens, egreg, bloodworks, Martin SchröderJan 16 '13 at 23:06

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. –  yo' Jan 16 '13 at 22:50

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