Skip to content

Incompatibility between thmtools and hyperref packages in Tex Live 2024 and 2025 #396

@si-me

Description

@si-me

Packages involved:
TL-2024 {thmtools}[2023/05/04 v0.76], {hyperref}[2024-11-05 v7.01l]
TL-2025 {thmtools}[2023/05/04 v0.76], {hyperref}[2025-07-12 v7.01o]

Links to theorem-like environments defined by thmtools, that are produced by hyperrref-packages [2024-11-05 v7.01l] in TeXLive-2024 and [2025-07-12 v7.01o] in TeXLive-2025, do not work correctly.

Here is an `almost' minimal working example:


% !TEX TS-program = pdflatex

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheoremstyle[%
headfont=\color{blue}\normalfont\bfseries,
bodyfont=\color{black}\normalfont\itshape,
]{coloredtm}
\declaretheorem[%
style=coloredtm,
name=Theorem,
numberwithin=section
]{tm}
\declaretheoremstyle[%
headfont=\color{blue}\normalfont\bfseries,
bodyfont=\color{black}\normalfont,
]{coloreddef}
\declaretheorem[%
style=coloreddef,
name=Example,
sibling=tm
]{exa}
\declaretheorem[%
style=coloreddef,
name=Definition,
sibling=tm
]{dfn}

\usepackage[colorlinks]{hyperref}

\begin{document}

\section{Section 1}
\begin{exa} \label{IntroExa1}
This is Example 1.1, \emph{not} 2.1,!
\end{exa}

\subsection{}
\begin{dfn}\label{def:1.1}
This is Definition 1.2.
\end{dfn}
\begin{exa}\label{ExaLMS}
This is Example 1.3.
\end{exa}

\subsection{}
\begin{exa}\label{rate}
This is Example 1.4, \emph{not} 2.4,!
\end{exa}

\subsection{}
\begin{exa}
This is Example 1.5.
\end{exa}
\begin{exa}[Yet another example] \label{Elaine}
This is Example 1.6.
\end{exa}

%%%%%%%%%%%%%%%%%%%%%%%

\section{Section 2}
\begin{exa}\label{ExaLip1}
This is Example 2.1.
\end{exa}

\subsection{}
\begin{exa}\label{ExaLip2}
This is indeed Example 2.2.
\end{exa}
\begin{exa}\label{ExaLip3}
This is Example 2.3
\end{exa}
\begin{exa}\label{ExaLip4}
This is Example 2.4
\end{exa}

See Examples~\ref{ExaLip1}, \ref{ExaLip2}, and~\ref{ExaLip4}.

\end{document}


Until TeXLive-2023, including
TL-2023 {thmtools}[2023/05/04 v0.76], {hyperref}[2023-11-26 v7.01g]
all the way down to TL-2015, these links work as they should.

Same with "numberwithin=chapter" in case of \documentclass{book}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions