Text FormattingEnotez + hyperref: Endnote links do nothing when using custom chapter-based headings (TeX Live 2024)

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Jongomez
Posts: 52
Joined: Tue Nov 28, 2023 9:29 pm

Enotez + hyperref: Endnote links do nothing when using custom chapter-based headings (TeX Live 2024)

Post by Jongomez »

Hello,

I’m working on a book project with endnotes grouped by chapter using the enotez package in TeX Live 2024.
The goal is:
  • Endnotes grouped by chapter

    Chapter names replaced with custom titles (e.g. “KAPITULUA 1”, “HITZAURREA”, etc.)

    Hyperlinks working in both directions:
      • Clicking the superscript in the text → jump to the note

        Clicking the note number → jump back to the reference in the text
        • ❗ Current issue

          With the code below:
          • The custom endnote headers work perfectly (the generic “Notes for chapter X” text disappears).

            But hyperlinks stop working completely: clicking the superscript number in the text does nothing.
            It doesn’t jump to the note, nor to the AMAI-OHARRAK chapter.
            • This happens consistently on TeX Live 2024.

              MWE

              (Uploaded here: main_nuevo_actualizado.tex — but reduced below for clarity.)

              [\newcommand{\GetChapterTitle}[1]{%
              \ifcsname ChapterTitle@#1\endcsname
              \csname ChapterTitle@#1\endcsname
              \else
              Chapter #1
              \fi
              }

              % Custom mapping
              \expandafter\gdef\csname ChapterTitle@1\endcsname{HITZAURREA}
              \expandafter\gdef\csname ChapterTitle@2\endcsname{SARRERA}
              \expandafter\gdef\csname ChapterTitle@3\endcsname{KAPITULUA 1}
              % (… and so on)

              % Custom header override
              \makeatletter
              \renewcommand*\enotez@heading@chapter[1]{%
              \par\bigskip
              {\centering\Large\bfseries \GetChapterTitle{#1}\par}
              \medskip
              }
              \makeatother


              Effects:
              Feature Works?
              Custom chapter titles in endnotes ✔ Works
              Correct grouping of notes per chapter ✔ Works
              Hyperlinks to notes ❌ Broken
              Hyperlinks back to text ❌ Broken

              ❓ Question

              Is there a way to keep the custom chapter-based endnote headings and preserve the hyperlink functionality?

              It seems that redefining \enotez@heading@chapter disables something internal related to hyperref anchors, but I don’t know how to restore it.

              Any hint, workaround, or correct approach is greatly appreciated.

              Thank you!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply