4

My problem is when you click on the reference to the first definition from chapter 2 you will return to the first definition from chapter 1. Of course, I want to see definition 1 from the second chapter. (Those wrong references happen to the all definitions having number that's been already mentioned in the previous chapters)

I guess that something in "\thedefn" causes this effect, but I don't know how to solve this problem.

And I don't want to change how it looks like, just correct reference.

  %document information
\documentclass[10pt,a4paper]{book}

% packages
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{amsmath,amsthm,amssymb}                                                                  
\newtheorem{defn}{Definition}
\numberwithin{defn}{chapter}
\renewcommand{\thedefn}{\arabic{defn}}

\usepackage{hyperref}   

\begin{document}

\chapter{one}
\begin{defn}
1
\end{defn}

\chapter{two}
\begin{defn}
\label{exp}
1
\end{defn}

 CLICK ME: \ref{exp}
\end{document}
  • Just put your \newtheorem command after loading hyperref. – Dan Feb 22 '16 at 23:03
3

Even if you don't want the chapter number in the visible defn counter you can use it in the internal hyperref links so that hyperref has unique identifiers to link to.

\documentclass[10pt,a4paper]{book}

% packages
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{amsmath,amsthm,amssymb}                                                                  
\newtheorem{defn}{Definition}[chapter]

\renewcommand{\thedefn}{\arabic{defn}}
\newcommand{\theHdefn}{\thechapter.\arabic{defn}}

\usepackage{hyperref}   

\begin{document}

\chapter{one}
\begin{defn}
1
\end{defn}

\chapter{two}
\begin{defn}
\label{exp}
1
\end{defn}

 CLICK ME: \ref{exp}
\end{document}
| improve this answer | |

Your Answer

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