\section{This is the first section}\label{this-is-the-first-section}

\subsection{Exercises}\label{exercises}

\hypersetup{linkcolor=black}\makeatletter\@starttoc{exercise:1_}\makeatother

\subsection{Theorems}\label{theorems}

\hypersetup{linkcolor=black}\makeatletter\@starttoc{theorem:1_}\makeatother

\protect\hypertarget{exercise:1}{}{\phantomsection\addcontentsline{exercise}{figure}{Exercise 1}\phantomsection\addcontentsline{exercise:1}{figure}{Exercise 1}\phantomsection\addcontentsline{exercise:1_}{figure}{Exercise 1}\phantomsection\addcontentsline{exercise:1.2}{figure}{Exercise 1}\phantomsection\addcontentsline{exercise:1.2_}{figure}{Exercise 1}\textbf{Exercise
1}}

This is the first exercise.

\protect\hypertarget{theorem:1}{}{\phantomsection\addcontentsline{theorem}{figure}{Theorem 1}\phantomsection\addcontentsline{theorem:1}{figure}{Theorem 1}\phantomsection\addcontentsline{theorem:1_}{figure}{Theorem 1}\phantomsection\addcontentsline{theorem:1.2}{figure}{Theorem 1}\phantomsection\addcontentsline{theorem:1.2_}{figure}{Theorem 1}\textbf{Theorem
1}}

This is the first theorem.

\protect\hypertarget{exercise:2}{}{\phantomsection\addcontentsline{exercise}{figure}{Exercise 2}\phantomsection\addcontentsline{exercise:1}{figure}{Exercise 2}\phantomsection\addcontentsline{exercise:1_}{figure}{Exercise 2}\phantomsection\addcontentsline{exercise:1.2}{figure}{Exercise 2}\phantomsection\addcontentsline{exercise:1.2_}{figure}{Exercise 2}\textbf{Exercise
2}}

This is the second exercise.

\section{This is the second section}\label{this-is-the-second-section}

\subsection{Exercises}\label{exercises-1}

\hypersetup{linkcolor=black}\makeatletter\@starttoc{exercise:2_}\makeatother

\subsection{Theorems}\label{theorems-1}

\hypersetup{linkcolor=black}\makeatletter\@starttoc{theorem:2_}\makeatother

\protect\hypertarget{exercise:3}{}{\phantomsection\addcontentsline{exercise}{figure}{Exercise 3}\phantomsection\addcontentsline{exercise:2}{figure}{Exercise 3}\phantomsection\addcontentsline{exercise:2_}{figure}{Exercise 3}\phantomsection\addcontentsline{exercise:2.2}{figure}{Exercise 3}\phantomsection\addcontentsline{exercise:2.2_}{figure}{Exercise 3}\textbf{Exercise
3}}

This is the third exercise.

\protect\hypertarget{theorem:2}{}{\phantomsection\addcontentsline{theorem}{figure}{Theorem 2}\phantomsection\addcontentsline{theorem:2}{figure}{Theorem 2}\phantomsection\addcontentsline{theorem:2_}{figure}{Theorem 2}\phantomsection\addcontentsline{theorem:2.2}{figure}{Theorem 2}\phantomsection\addcontentsline{theorem:2.2_}{figure}{Theorem 2}\textbf{Theorem
2}}

This is the second theorem.

\section{List of exercices}\label{list-of-exercices}

\hypersetup{linkcolor=black}\makeatletter\@starttoc{exercise}\makeatother

\section{List of theorems}\label{list-of-theorems}

\hypersetup{linkcolor=black}\makeatletter\@starttoc{theorem}\makeatother

\section{Unchanged}\label{unchanged}

\{theorem\}
