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}

\section{Section with links}

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

\newpage
\section{Section with no links}


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


\newpage

Le premier est \autoref{protocol:firstProtocol} et le deuxième est \autoref{protocol:secondProtocol}.

\end{document}


Related Questions






\listoftheorems Not actually displaying

Updated January 24, 2018 01:23 AM