4

I'm currently creating a big document with multiple TeX-files and used dozens of links to parts I put into theorem-environments. However, some of the links do not work, they just take me to the first page of the document.

It seems like using an 'enumerate-environment' at the beginning of the content of the thm-environment will cause the link associated to that thm-environment to take me to the first page (maybe I was not able to use '\label' correctly in this case).
Here is the code, after deleting most of the content and clearing the header:

\documentclass[12pt, a4paper]{article}


% font, language
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}


%maths
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}


%general formatting  
\usepackage{enumitem}     


%environments
\theoremstyle{definition}
\newtheorem{rem}[thm]{Bemerkung}



%hyperref
\usepackage[
        colorlinks=true,
        urlcolor=purple,
        linkcolor=purple!87!black,
        pdfborder={0 0 0}
    ]{hyperref}







\begin{document}

\section{This is where the link takes me to}





\subsection{instead of remark 1.2}





\newpage



\begin{rem}\label{broken_ref}
\begin{enumerate}[label=\roman*)]
    \item
    relevant content.

    \item
    relevant content 2.
\end{enumerate}
\end{rem}


\begin{rem}\label{working_ref} 
If I do not begin the content of the remark with an 'enumerate-environment', 
it works...
\begin{enumerate}[label=\arabic*)]
    \item
    relevant content
\end{enumerate}
\end{rem}


\pagebreak


 Link that does not work $\to$ \ref{broken_ref} \reflectbox{$\to$}.\\

 Link that does   work $\to$ \ref{working_ref} \reflectbox{$\to$}.



\end{document}

Can someone explain to me, why it does not work, when I begin the remark with an enumerate environment ?

  • That is not very minimal. Are all of those packages really needed to reproduce the problem? Please delete those which can be deleted while still reproducing the problem. (And although I doubt you need graphicx at all for the MWE, I'm certain you don't need it twice.) – cfr Dec 25 '14 at 18:14
  • I reducid it :) It is for sure not minimal, but far more than before. I used \pagebreak to illustrate, that the link will take you to the first page, not to the second one, where the remark itself will be displayed. – TopologicalFieldTheory - TFT Dec 25 '14 at 18:33
  • This comment is about writing style, not the problem you pose. A label like \label{ex3_5_1} may confuse you (the author) when you move remarks around or add or delete some. You may find it easier to revise your document if you choose labels like \label{rem:broken-link} with semantic significance (for you). – Ethan Bolker Dec 25 '14 at 19:37
  • Thanks Ethan :) It took quite a while, but I finally followed your suggestion to support the reader. – TopologicalFieldTheory - TFT Jul 7 '18 at 13:29
2

This is a minimised example. I think that you need to define new theorems etc. after loading hyperref so that counters are set up correctly to give destination anchors unique names and so that targets of links work correctly. See section 3.2 of the package manual.

\documentclass[ngerman]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{xcolor}
%hyperref
\usepackage[
colorlinks=true,
urlcolor=purple,
linkcolor=purple!87!black,
pdfborder={0 0 0}
]{hyperref}
\usepackage{amsthm}

\newtheorem{thm}{Satz}
\numberwithin{thm}{section}
\newtheorem{rem}[thm]{Bemerkung}


\begin{document}

  \subsection{Auflösbarkeit algebraischer Gleichungen}

  \subsubsection{Auflösbare Gruppen}

    Define something...

  \pagebreak

  %THIS IS THE REMARK I WANT TO CREATE A LINK TO
  \begin{rem}\label{rem:ex3_5_1}
    \begin{enumerate}[label=\roman*)]
      \item
      $[G,G]$ besteht aus allen endlichen Produkten
      von Kommutatoren aus $G$.
      \item
      $[G,G] \triangleleft G$ ist der kleinste Normalteiler $N \subset G$, sodass $G/N$ abelsch ist.
    \end{enumerate}
  \end{rem}

  \pagebreak

  \ref{rem:ex3_5_1}

\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.