0

so my question is just a general question about the hyperref which was left unanswered after checking the documentation.

When using the hyperref package, upon clicking a reference in the pdf output, it links to the top of the page. Is there a way to make it link to the specific line where the label \label{the label} of the reference is.

What I mean is, for example, in the pdf produced by the following code, clicking the ref in the second page gets you to the top of the first page, because the theorem it links to is on the first page. But is it possible to change something so that upon clicking the reference it displays the theorem specifically and not just the page where the theorem appears.

\documentclass{article}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}     
\usepackage{lipsum}
\usepackage[french]{babel}  
\usepackage{hyperref}
\usepackage{amsthm}
\newtheorem{theor}{Théorème}[section]

\begin{document}

\section{First Section}

\begin{theor}\label{first theorem}
This is my first theorem. 
\end{theor}

\lipsum[2-4]

\begin{theor}\label{second theor}
 this is theor 2.
\end{theor}

\newpage

This is a reference to the second theorem \ref{second theor}.
\end{document}
  • Could this be viewer related? Upon using the built in pdf viewer of TeXmaker, the link takes me to the top of the page. When using adobe reader instead, the link takes me to the corresponding theorem. – leandriis Mar 9 at 21:58
  • @leandriis Oh I'll check right away, had not thought of that, thanks. EDIT: Indeed, it seems to be viewer related, when using another pdf viewer it links to the corresponding theorem. – T_Kln Mar 9 at 22:03
3

Load hyperref after amsthm:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[french]{babel}
\usepackage{amsthm}

\usepackage{hyperref}

\newtheorem{theor}{Théorème}[section]

\begin{document}

\section{First Section}

\begin{theor}\label{first theorem}
This is my first theorem.
\end{theor}

\lipsum[2-4]

\begin{theor}\label{second theor}
 this is theor 2.
\end{theor}

\newpage

This is a reference to the second theorem \ref{second theor}.
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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