# Roman numbering > setcounter to zero > hyperref confused in pdf bookmarks

I have the following problem:

For my Master thesis I want to create some sections with a \Roman numbering (for toc, lof, lot, appendix...) and some with \arabic numbering (for the main text part). My MWE looks like this:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}

\renewcommand\thesection{\Roman{section}}

\begin{document}

\section{Abstract}

\tableofcontents
\newpage

\section{Acronyms}

\renewcommand\thesection{\arabic{section}}
\setcounter{section}{0}

\section{Intro}
\subsection{Part of Intro}

\section{Outro}
\end{document}


But this will create wrong bookmarks for the PDF:

As you can see, hyperref creates a \subsection for Acronyms while this should be a \section. I think it's confused, because I reset the section counter and use it again.

The linking is wrong too: If I click on Outro I am redirected to Acronyms.

So what would be the right way to achieve this? Thank you a lot!

• Welcome to SE! Select article (scrartcl) is not good idea. Better is select book or scrbook which enables logical division of document on frontmatter and mainmater. Source of your problem is reseting section counter, consequently you in your mainmatter repeat section numbering, what confuse hyperrref. – Zarko Jan 6 '16 at 10:14
• Welcome to Tex SE. Usually the introductory sections have no numbers: List of figures, list of abbreviations/acronyms, abstract, etc... Why are you assigning them a number in the first place? – Alenanno Jan 6 '16 at 11:23
• @Alenanno: Different university, different countries, different personal styles ;-) – user31729 Jan 6 '16 at 11:27
• @ChristianHupfer I understand that, but I've read texts from other countries and styles, and I've never seen them numbered. At least as far as I can remember. :P It just sounds non-standard to me. – Alenanno Jan 6 '16 at 11:31
• @Alenanno: There are worse things being done than to number 'introductory' sections :-P – user31729 Jan 6 '16 at 11:33

Resetting the section number to zero results and using \section again results in a second \section.1 hyperref anchor, which must confuse hyperref and the PDF viewer of course.

The solution is either to use hypertexnames=false as an hyperref option or to switch to some other anchor name, say arabicsection, i.e. redefine \theHsection to be arabicsection.\thesection.

This cures the bookmark levelling problem as well.

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}

\renewcommand\thesection{\Roman{section}}

\begin{document}

\section{Abstract}

\tableofcontents
\newpage

\section{Acronyms}

\renewcommand{\theHsection}{arabicsection.\thesection}
\renewcommand\thesection{\arabic{section}}
\setcounter{section}{0}

\section{Intro}
\subsection{Part of Intro}

\section{Outro}
\end{document}


• Thanks, this solution works for me too! Is is also possible to continue with the Roman numbering system after the arabic part? – Phil Jan 6 '16 at 11:40
• @Phil: Continue with Roman -> sure. Do you want to continue the numbering as if it has not been interrupted? – user31729 Jan 6 '16 at 12:07
• Yes. And I think this shall work: \renewcommand{\thesection}{section.\thesection} right before resetting to arabic – Phil Jan 6 '16 at 12:36
• @Phil: No, \renewcommand{\theHsection}{section.\thesection} – user31729 Jan 6 '16 at 13:09