8

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?

1 Answer 1

11

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.

2
  • \renewcommand* worked like a charm! (I did not try the alternatives) Only a backslash is missing: \renewcommand*{\theHsection}{\thepart.\thesection}
    – Matthias
    Jul 5, 2011 at 13:19
  • @Matthias: good, corrected!
    – Stefan Kottwitz
    Jul 5, 2011 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .