Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

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.

share|improve this answer
    
\renewcommand* worked like a charm! (I did not try the alternatives) Only a backslash is missing: \renewcommand*{\theHsection}{\thepart.\thesection} –  Matthias Jul 5 '11 at 13:19
    
@Matthias: good, corrected! –  Stefan Kottwitz Jul 5 '11 at 14:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.