1

I am using the book class and I need to change the numbering of the first pages from lower case Roman numbers to upper case Roman numbers. I am using something like this:

\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Title of the book}
\chead{}
\rhead{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}

I believe I should use something like

\renewcommand{\pagenumbering}{Roman}

However, I am not able to access the page numbering of the preamble (I mean the first pages that include basically the table of contents.

Edit: [Minimal working example]

\documentclass[oneside,final,portrait,10pt]{book}

\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{To do}
\chead{}
\rhead{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\pagenumbering{Roman}

\makeindex

\begin{document}

%\doublespace
\title{This book}
\author{Myself} \maketitle

\pagebreak

\frontmatter
\tableofcontents
\mainmatter

\chapter{Introduction}\label{capitulo_introducao}
%
%
This is my introduction

\end{document}
7
  • 1
    No, \pagenumbering{Roman} is sufficient, but this has nothing to do with fancyhdr ;-) The \renewcommand is wrong!
    – user31729
    Nov 24, 2014 at 16:33
  • @ChristianHupfer, thank you! However, when I use \pagenumbering{Roman} nothing happens. It was my first attempt. Nov 24, 2014 at 16:39
  • Please show us a MWE in order to give us some insight.
    – user31729
    Nov 24, 2014 at 16:40
  • @ChristianHupfer, sorry, what do you mean about MWE? Nov 24, 2014 at 16:41
  • minimal working example (MWE)
    – user31729
    Nov 24, 2014 at 16:42

1 Answer 1

2

\frontmatter switches to roman (lower case) numbers, and \mainmatters switches back to arabic numbers, so if this should be prevented, it means either dropping \frontmatter and \mainmatter or patch this behaviour out of those macros using xpatchcmd from egreg's xpatch package.

I was a little bit lazy about the success/failure test of the command \xpatchcmd ;-)

\documentclass[oneside,final,portrait,10pt]{book}

\usepackage{xpatch}%

\xpatchcmd{\frontmatter}{\pagenumbering{roman}}{\pagenumbering{Roman}}{}{}%
\xpatchcmd{\mainmatter}{\pagenumbering{arabic}}{\pagenumbering{Roman}}{}{}%

\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{To do}
\chead{}
\rhead{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\pagenumbering{Roman}

\makeindex


\begin{document}

%\doublespace
\title{This book}
\author{Myself} \maketitle

\pagebreak

\frontmatter
\tableofcontents
\mainmatter

\chapter{Introduction}\label{capitulo_introducao}
%
%
This is my introduction

\end{document}
7
  • thank you again! However, after the first page, the page number arises in two places in the botton and in the right position of the head. I know how to remove the one in the one in the head, but I should keep this one (editorial format)! Nov 24, 2014 at 17:32
  • @DanielTheRocketMan: Please don't edit answers -- You gave that MWE, I concentrated on the Roman page number stuff, not on bottom/header positions
    – user31729
    Nov 24, 2014 at 17:34
  • sorry I made a mistake. I was trying to edit the question, since the minimal example does not consider the pages where there is the head. Nov 24, 2014 at 17:36
  • @DanielTheRocketMan: Then change your MWE, but try not to change the whole initial question ;-)
    – user31729
    Nov 24, 2014 at 17:45
  • Your solution works well if I include \lfoot{} \cfoot{} \rfoot{}. Maybe You want to modify your answer for future reference! Thank u (:-) Actually the problem was with my question that was too minimal! Nov 24, 2014 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .