[Tex/LaTex] Chapter 0/Roman numerals

chaptersnumberingroman numerals

I'm using the book document class, together with subfiles and fancyhdr. For pedagogical reasons, my document starts with Chapter 0. I've managed to get the headers formatted as I want, with one notable exception: there's no roman numeral 0!

Using

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

makes the headers all roman (e.g., "Chapter VI") — but leaves a blank for the Chapter zero number. I tried an \ifnum statement in the main file, but it doesn't seem to recognize a statement like

\ifnum\value{chapter}=0

Nor do explicit \renewcommand{\thechapter} statements in the subfiles seem to work. Any ideas?

Best Answer

Use \ZeroRoman as defined below:

enter image description here

\documentclass{book}
\newcommand{\ZeroRoman}[1]{% 0 + \Roman
  \ifcase\value{#1}\relax 0\else% Chapter 0
  \Roman{#1}\fi}% All other chapters
\renewcommand{\thechapter}{\ZeroRoman{chapter}}
\setcounter{chapter}{-1}% To start chapter numbering from 0
\begin{document}

\tableofcontents

\chapter{First chapter}
\chapter{Second chapter}
\chapter{Last chapter}

\end{document}