# part with setcounter — destination with the same identifier

When using two parts in my document and resetting the counter for the second one, I get the following warning:

destination with the same identifier (name{section.1}) has been already used, duplicate ignored

A minimal example:

\documentclass{scrartcl}

\usepackage{hyperref}

\begin{document}

\tableofcontents

\newpage
\part{Part 1}
\section{Section 1-1}
\newpage
\setcounter{section}{0}
\part{Part 2}
\section{Section 2-1}

\end{document}


How can I get rid of this warning?

-

Redefining the internal presentation of the section counter for hyperref helps, for example:

\renewcommand*{\theHsection}{\thepart.\thesection}


The error came because the section counter is not unique, you have two sections with the number 1, one in each part. The redefinition above makes the internal presentation to 1.2 and 2.1, thus unique and allowing unique hyperlinks, not visible in the output.

The error would also go away if you number section per part, for example

\usepackage{amsmath}% perhaps you already use it
\numberwithin{section}{part}


or

\usepackage{chngcntr}
\counterwithin{section}{part}


So if you refer to section 1 it's clear if the one of Part 1 or Part II is meant.

-
@Matthias: good, corrected! –  Stefan Kottwitz Jul 5 '11 at 14:21