Shortly put, the links in table of contents do not work the way I'd like. For the second subsection, Subsection B, all subsubsection links lead instead to the subsubsections in the first subsection, Subsection A.
So, for instance, the link for "subsubsection x" leads instead to "subsubsection b".
Here is a small copyable example to replicate the issue.
\documentclass{article}
\usepackage[pdftex]{graphicx}
\usepackage[colorlinks=true, linkcolor=blue]{hyperref}
\begin{document}
\tableofcontents
\subsection*{Subsection A}
\addcontentsline{toc}{subsection}{Subsection A}
\setcounter{subsubsection}{0}
\subsubsection{subsubsection a}
\newpage
\subsubsection{subsubsection b}
\newpage
\subsubsection{subsubsection c}
\newpage
\subsubsection{subsubsection d}
\newpage
\subsection*{Subsection B}
\addcontentsline{toc}{subsection}{Subsection B}
\setcounter{subsubsection}{0}
\subsubsection{subsubsection a}
\newpage
\subsubsection{subsubsection x}
\newpage
\subsubsection{subsubsection y}
\end{document}
The problem appears to be the simultaneous usage of subsection* (i.e the starred version) and setcounter{subsubsection}{0} twice. If your solution to this problem does not use these commands, it is perfectly fine. However, it must still be true that
- "Subsection A" and "Subsection B" appear without numbers in the document;
- "Subsection A" and "Subsection B" show up in the table of contents;
- the numbering for subsubsections starts again from 0.0.1 in both subsections.
The file was compiled multiple consecutive times with pdflatex.
How do I fix this problem?

