I am currently working on a document with fixed format, which also includes multiple sections and subsections with the same numbering appearing in it.
\documentclass[12pt,a4paper]{memoir}
\usepackage[usehighlevels]{alnumsec}
\alnumsectionlevels{1}{section,subsection,subsubsection,paragraph}
\alnumsecstyle{aaaa}
\surroundarabic[{.}][]{}{}
\otherseparators{1}
\alnumsecstyle{aaaa}
\usepackage[colorlinks,plainpages]{hyperref}
\hypersetup{urlcolor=blue, citecolor=blue, linkcolor=blue}
\newcommand{\nocontentsline}[3]{}
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup}
\begin{document}
\maxtocdepth{subsubsection}
\tocless\tableofcontents
\clearpage
\section{Introduction}
\subsection{...}
\subsubsection{...}
\subsubsection{...}
\subsection{...}
\subsubsection{...}
\section{Description of the parts}
\section*{Part A}
\phantomsection\addcontentsline{toc}{subsection}{Part A}
\tocless\subsection{On Part A}
\tocless\subsubsection{all the numbers are fixed}
\tocless\subsubsection{I have no power on the numbering}
\tocless\subsubsection{so this has to be 2.1.3}
\tocless\subsubsection{and this has to be 2.1.4}
\setcounter{subsection}{0}
\section*{Part B}
\phantomsection\addcontentsline{toc}{subsection}{Part B}
\tocless\subsection{On Part B}
\tocless\subsubsection{all the numbers are fixed}
\tocless\subsubsection{I have no power on the numbering}
\tocless\subsubsection{so this has to be 2.1.3}
\tocless\subsubsection{and this has to be 2.1.4}
\end{document}
Sadly, hyperref
doesn't like it one bit and complains repeatedly about it:
(./Proposal.out) (./Proposal.out) (./Proposal.toc) [1{/usr/local/texlive/2015/t
exmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2pdfTeX warning (ext4): destinat
ion with the same identifier (name{subsection.0.2.1}) has been already used, du
plicate ignored
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.70 \end{document}
pdfTeX warning (ext4): destination with the same identifier
(name{subsubsection.0.2.1.1}) has been already used, duplicate ignored
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.70 \end{document}
pdfTeX warning (ext4): destination with the same identifier
(name{subsubsection.0.2.1.2}) has been already used, duplicate ignored
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.70 \end{document}
pdfTeX warning (ext4): destination with the same identifier
(name{subsubsection.0.2.1.3}) has been already used, duplicate ignored
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.70 \end{document}
pdfTeX warning (ext4): destination with the same identifier
(name{subsubsection.0.2.1.4}) has been already used, duplicate ignored
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.70 \end{document}
] (./Proposal.aux) )
Is there a way I can get rid of the warning? It appears quite often during compilation in the actual document I am working on, making other warnings far less visible.
From the answers in the other threads there doesn't seem to be a way to manually suppressing that particular warning… 🙁
Best Answer
Either use
hypertexnames=false
or provide a dummy counter to lethyperref
make 'correct' anchors, see the\tocless
command.I try to provide a better version with another setup!