# thmtools breaks links to algorithms

by tobiasBora   Last Updated May 13, 2019 13:23 PM - source

I don't know why, but loading thmtools breaks the links to the algorithm. Just removing this package, or loading after the \numberwithin stuff seems to fix the compilation, but I'm wondering if it is a known issue, and if removing/moving it at a random different line is the correct way to fix this issue.

MWE: (to test, just click on the second link on the last page: you'll go to the wrong theorem)

\documentclass{article}

\usepackage{hyperref}
\usepackage{mathtools}
\usepackage{amssymb, amsthm, amsmath}

%% thmtools is the problem with numberwithin{algorithm}{section}!
\usepackage{thmtools}

\usepackage{algorithm, algorithmicx, algpseudocode}
\floatname{algorithm}{Protocol}
\providecommand*\algorithmautorefname{Protocol}
\numberwithin{algorithm}{section}

\begin{document}

\begin{algorithm}[H]
\caption{I am an algorithm that attracts all the links} \label{protocol:firstProtocol}
\end{algorithm}

\newpage

\begin{algorithm}[H]
\caption{Nobody wants to link me :(} \label{protocol:secondProtocol}