Home > hyperref > Wrong references to another chapters

Wrong references to another chapters

April 15Hits:1
Advertisement

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} 

Answers

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}

Related Articles

  • Reference sections or chapters without labeling?

    Reference sections or chapters without labeling?April 12

    Is it possible to reference chapters and sections of a document without manually labelling every section and subsection ? I have about 8 chapters and dozens of sections/subsections indented inside of them, labelling each single section is pretty tedi

  • Wrong references to another chaptersApril 15

    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 defi

  • Comparing reference numbersNovember 12

    I'm using the refcount package to get the reference number associated with a label. I'd like to determine whether two references lay "next" to each other or not, that is: I'd like an expandable command of the form: \comparerefs{refOne}{refTwo} t

  • Manually set reference valuesMarch 19

    I'm working on a large-ish Latex document (my dissertation) in which each chapter has its own .tex file. For various reasons, I have two master files: one that includes all chapters and one that I modify over time to compile whatever chapter I happen

  • I'm using multibib to have references at the end of each chapter but the numbering is wrongMarch 6

    I am using multibib to have references at the end of each chapter but when I have the same reference in multiple chapters, the numbering in the text corresponds to the last chapter that the reference appears in. The numbering in the reference section

  • Cross referencing between chapters of a thesisApril 8

    Hi I am new to the forum and fairly new to Tex, if I miss anything out please let me know and I will be glad to post it. I am writing up my PhD thesis using Texmaker on a windows system. I have my document organised with a main file and a sub-directo

  • enumitem & cref: referencing different exercises with cref for different chapters

    enumitem & cref: referencing different exercises with cref for different chaptersMarch 2

    I am using scrbook along with enumitem for exercises and cref for cross referencing. In my style file, I have set the following new list % Rename enumerate from item to exercise \newlist{exercise}{enumerate}{75} \setlist[exercise]{label*=\arabic*.} %

  • Cross-reference in muliple chapter in multi-file thesisJuly 22

    I want to cross-reference between different chapters. For example I have chap2.tex and chap3.tex as files containing all the theorems and methods, respectively. The following chapters 4,5...7 will extensively rely on cross-referencing from these two

  • Starting a PhD; Any guides to setting up a 'system'?October 10

    I'm starting a PhD and am being overwhelmed with the different possible ways people do things, and how they very rarely mix. I'm (obviously) sold on TeXing it, and have a ViM background I intend on continuing, and am using Mendeley for article tracki

  • Is it possible to use bibunits and multibib simultaneously?May 14

    I'm typesetting a contributed book, which has a whole bunch of chapters written by a different author each. My job is make sure all contributions use more or less the same typesetting conventions and select index words. For the references we wish to

  • biblatex per-chapter bibliography and titlesec

    biblatex per-chapter bibliography and titlesecAugust 31

    This is a follow-up to my previous question Proper way to include unnumbered chapters in a per chapter bibliography using biblatex. The solution proposed by Audrey breaks when I use the titlesec package to modify the chapter headings. Here's a MWE: \

  • How to show symbol § when I refer a chapter

    How to show symbol § when I refer a chapter October 25

    This question already has an answer here: How to reference a paragraph with § symbol and without a dot? 2 answers I'm writing my thesis and I would like that the reference of the chapters, sections, etc... appears with symbol §, e.g.: ...as can be se

  • Referencing appendix returns chapter number instead of letter (memoir class)January 16

    I'm using an adapted version of the memoir class to typeset my thesis. I'm attempting to add an appendix, which I will reference in various chapters. Here is the basic code (to compile, need ukthesis class which can be found here math.as.uky.edu/site

  • How do I refer to a 'part' in a book?March 16

    I have a book where the content table looks like this: PART1: chapter 1 chapter 2 chapter 3 PART2: chapter 4 chapter 5 ... PART3: Appendix A ... I want to reference all the chapters in PART2 (6 chapters + the conclusion chapter of this part = 7). I a

  • How do I get two different chapters with same number, and compatible references (using hyperref)? November 28

    The following MWE produces a PDF whose TOC has two entries: "Foo" and "Bar" with correct page numbers. So far, so good. However, upon clicking on the link to "Bar", I am taken to the page for "Foo" instead. \documen

  • In LyX with classicthesis.sty, cross-references to Chapters don't workMay 1

    I am using classicthesis with some minor (I think) edits. I have child documents for each chapter. Everything renders fine apart from cross references to chapters which pdflatex renders as ?? --------------Solutions------------- I add the same proble

  • Exclude citations from other chapters, but make cross-references workJuly 31

    I'm writing up my PhD dissertation, and I tend to compile each chapter separately. Each chapter is in a separate document, and is included in the main LaTeX file. I use \includeonly to only include the chapter I need, together with the Bibliography (

  • cross references across chapters

    cross references across chaptersFebruary 19

    I renewed my command for chapter/section...etc So I don't see the chapter number in all (sub)sections name. Also the point was that when I'm in a chapter and I use \ref to reference to a section of the current chapter I only see the number of the sec

  • How to ignore undefined references (e.g. when temporarily commenting out whole chapters)?March 31

    I'm working on a fairly large document, and compilation times are somewhat annoying. My general workflow is to use: latexmk in continuous mode to compile the document (pdflatex), and rubber-info on the resulting log file to see warnings/errors. To sp

  • Standalone chapters with separate references and countersJune 19

    I'm looking for a convenient way to integrate standalone chapters in a main.tex (scrbook) file. More specifically, they will be already published papers within a thesis framework text and should each have their own counters for figures, tables, equat

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.361 s.