Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following code:

\usepackage{hyperref}
\newtheorem{thm}{Theorem}

\begin{thm} \label{mythm}
   \begin{enumerate}
      \item 
   \end{enumerate}
\end{thm}

\ref{mythm}

The ref prints the right number. However, when I click on it, it will lead me to a wrong page (basically, to the beginning of the document). pdflatex also has some warning. If I add $ $ between \begin{thm} and \begin{enumerate}, the problem disappears, but now, the enumeration starts a new line. Is there any way to fix this?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

You can use the \phantomsection command from hyperref:

\documentclass{book}
\usepackage{amsthm}
\usepackage{hyperref}

\newtheorem{thm}{Theorem}

\begin{document}

\begin{thm}\phantomsection \label{mythm}
   \begin{enumerate}
      \item 
   \end{enumerate}
\end{thm}

\ref{mythm}

\end{document}

Another option would be to use the ntheorem package instead of amsthm:

\documentclass{book}
\usepackage{ntheorem}
\usepackage{hyperref}

\newtheorem{thm}{Theorem}

\begin{document}
\mbox{}\newpage
\begin{thm}
\label{mythm}
   \begin{enumerate}
      \item
   \end{enumerate}
\end{thm}

\newpage
\ref{mythm}

\end{document}
share|improve this answer
    
For ntheorem, do I need to also define the proof environment? –  brian Mar 21 '11 at 21:27
    
@brian: if you load the package with the standard option, then some predefined theorem-like environments become available, proof amongst them (you'll also need the thmmarks package option to activate the endmark). If you don't load those options, you'll have to define your own proof environment. –  Gonzalo Medina Mar 21 '11 at 21:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.