0

I need roman numbers for chapters header but in the table of contents I still want arabic numbers for the chapter. Is it possible?

For the chapter header I used this tag:

\renewcommand{\thechapter}{\ \Roman{chapter}}

Thanks a lot

  • 2
    Welcome to LaTeX! Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Moriambar May 17 '17 at 19:23
  • 1
    Is the \ really necessary there? – user31729 May 17 '17 at 19:33
1

With the following code, the \renewcommand you're using now is not needed (and should in fact be omitted to obtain arabic numbers in the table of contents).

\documentclass{book}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\@makechapterhead}{\thechapter}{\Roman{chapter}}{}{}
\makeatother

\begin{document}

\tableofcontents

\chapter{Test}

\end{document}

The code works by patching specifically the command LaTeX uses internally to typeset the chapter title, while leaving the entry to the table of contents intact.

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.