# How to repeat chapter numbers

I'm writing my Ph.D. thesis, and I have to write the Introduction both in English and in Spanish. Since the content is the same, I want to repeat the number of this first chapter:

1. Introducción.
2. Introduction.
3. Next Chapter, etc.

If I simply reset the counter by calling \setcounter{chapter}{0} I obtain the desired numbering, but the table of contents that appears in the left margin of pdf viewers looks odd:

All the chapters are nested into the first one. On the other hand, the links in the \tableofcontents page don't behave properly, i.e. if I click on the link corresponding to the spanish introduction, I'm sent to the english (the last) one.

I guess I should create a special kind of chapter for the spanish introduction in order to obtain a repeated number that do not interfere with the \tableofcontents or associate a new counter to \chapter in order to separate the two versions. Any help?

• What \documentclass are you using? What about the bookmark package...are you using that or only hyperref? What other sectional packages are you using to format your document. These are all important things that could affect a possible solution. Ideally we'd like to see a minimal working example (MWE) that highlights and reproduces your problem. It'll make solution come your way much easier, and help the community work on your problem much faster. – Werner Nov 21 '13 at 20:17
• With the book class your little hack works perfectly... – Ruben Nov 21 '13 at 20:35
• I wasn't using the bookmark package: that solved the problem. Thanks! – I.O. Nov 22 '13 at 1:46

Try using the bookmark package to see whether this fixes your problems. bookmark implements bookmarks in documents in a more modern (less restrictive) way, and only requires a single compile. hyperref requires at least two compiles (assuming something changes in the ToC), since it uses auxiliary files during compiles to assemble the bookmarks.

If you're only using hyperref, the following would correct the hyperlinks and is cheapest:

• Add \renewcommand{\theHchapter}{S\arabic{chapter}} before your Spanish chapter \chapter{Introducción}; and
• \renewcommand{\theHchapter}{\arabic{chapter}} after the Spanish chapter

\theHchapter is used as an anchor for the hyperlink to a chapter, and depends on the chapter number. If you reset the chapter number, then the hyperlink reference will be ambiguous, causing a jump to the same location. The above fixes that temporarily by prepending S to the Spanish chapter anchor, and the subsequently removing it.

Perhaps a more generic way of approaching this would be to define a macro that you can switch between, allowing you to insert similar-numbered chapters as needed. The following MWE allows for that:

\documentclass{report}
\usepackage[utf8]{inputenc}% http://ctan.org/pkg/inputenc
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\newcommand{\chaptype}{}
\renewcommand{\theHchapter}{\chaptype\arabic{chapter}}
\begin{document}
\tableofcontents

\chaptertype{Spanish}
\chapter{Introducción}

\setcounter{chapter}{0}
\chaptertype{}
\chapter{Introduction}

\chapter{Next Chapter}
\end{document}


\chaptertype{<stuff>} is the user-level interface which updates \chaptype to be <stuff>. This is then used as a prefix for the hyperref anchor in \theHchapter. You can switch back to the regular "prefix" using \chaptertype{}.

The motivation behind this solution stems from the hyperref documentation (specifically section 3.2 Options for destination names):

It is very important that the destination names are unique, because two destinations must not share the same name. The counter value \the<counter> is not always unique for the counter. For example, table and figures can be numbered inside the chapter without having the chapter number in their number. Therefore hyperref has introduced \theH<counter> that allows a unique counter value without messing up with the appearance of the counter number. For example, the number of the second table in the third chapter might be printed as 2, the result of \thetable. But the destination name table.2.4 is unique because it has used \theHtable that gives 2.4 in this case.

• Thanks! As I said above, the inclusion of the bookmark package solve the problem. But the modification on \theHchapter also works (without the bookmark package). – I.O. Nov 22 '13 at 1:49
• @I.O.: If this solved your problem, perhaps consider accepting it as such. See How do you accept an answer? – Werner Nov 22 '13 at 2:33

You can exploit the fact that you're going to write your Introducción in Spanish, so inside an environment.

\documentclass{report}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish,english]{babel}

\usepackage{hyperref,bookmark}

\begin{document}
\tableofcontents

\begin{otherlanguage}{spanish}
\renewcommand{\theHchapter}{SpanishIntro} % keep bookmark quiet
\chapter{Introducción}

Introducción in Español.

\end{otherlanguage}


If you still want “Chapter 1” instead of “Capítulo 1”, then use otherlanguage* in place of otherlanguage.