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.

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}
share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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}
share|improve this answer
    
Thanks, it works. –  dbrettschneider Aug 8 '11 at 13:31
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.