1

I have to put the table of contents into the table of contents. I do this with the following code. But the entry in the toc must have a roman section number and this section number appears in the toc of the pdf. Is there a way to add "II. Inhaltsverzeichnis" to the latex toc and "Inhaltsverzeichnis" to the pdf toc? In the pdf toc or bookmarks window I see:

  • Abstract
  • II. Inhaltsverzeichnis <-- Should be only Inhaltsverzeichnis
  • Test

The code:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[pdfpagelabels=true]{hyperref}
\begin{document}
% roman
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\theHsection}{\Roman{section}}
\section{Abstract}
    Abstract.
% add toc to toc with section number
\renewcommand{\contentsname}{II. Inhaltsverzeichnis}
\addcontentsline{toc}{section}{II. Inhaltsverzeichnis}
\tableofcontents
% arabic and start with 1
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\theHsection}{\arabic{section}}
\setcounter{section}{0}
\section{Test}
    Test.
\end{document}
3

You can use \texorpdfstring as in:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[bookmarks,pdfpagelabels=true]{hyperref}
\begin{document}
% roman
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\theHsection}{\Roman{section}}
\section{Abstract}
    Abstract.
% add toc to toc with section number
\renewcommand{\contentsname}{II. Inhaltsverzeichnis}
\addcontentsline{toc}{section}{\texorpdfstring{II. Inhaltsverzeichnis}{Inhaltsverzeichnis}}
\tableofcontents
% arabic and start with 1
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\theHsection}{\arabic{section}}
\setcounter{section}{0}
\section{Test}
    Test.
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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