0

I have a class that contains a descrption of frontmatter and backmatter

You can consult the class by following this link.

How I can put the page number right in the footer, knowing that I tried to change the 'LE' and 'RO' indices, but it doesn't work. In the document, when I use \frontmatter and \backmatter, the page number style becomes roman, and I don't know why.

2
  • 1
    Welcome to TeX.SX. please give us a link to the class/template instead of posting a snippet. And never change a class file.
    – Johannes_B
    Commented May 7, 2020 at 3:28
  • Thank you for your useful comment. I updated my question.
    – bAbdenour
    Commented May 7, 2020 at 10:30

2 Answers 2

1

Instead of fancyhdr, you can use \pagestyle{plain} and

\makeatletter
\def\ps@plain{%
      \let\@oddhead\@empty
      \let\@evenhead\@empty
      \def\@oddfoot{\normalfont\hfil\thepage}%
      \def\@evenfoot{\normalfont\hfil\thepage}}
\makeatother
2
  • It workd! thank you, but can you give more details about what that did? Also I would like to use roman numbers for some pages and arabic for others, how can I make that?
    – bAbdenour
    Commented May 8, 2020 at 9:00
  • I copied the definition of \ps@plain (from letter class) and removed the \hfil on the right side. \renewcommand{\thepage}{\roman{page}} Note that this affects \label and page number stored for use in the TOC. And \makeatletter and \makeatother are used to allow @ symbols in macro names. Commented May 8, 2020 at 13:22
0

If you want page numbers on the right of the pages use

\cfoot{}
\fancyfoot[RE]{\thepage}
\fancyfoot[RO]{\thepage}

and if you want to make the front and back matter use arabic numbers then just toggle \pagenumbering as shown:

\documentclass[a4paper,20pt]{book}
\usepackage{fancyhdr}
\usepackage{lipsum}

\usepackage{etoolbox}
\patchcmd{\chapter}{plain}{empty}{}{}
\patchcmd{\part}{plain}{empty}{}{}

\cfoot{}
\fancyfoot[RE]{\thepage}
\fancyfoot[RO]{\thepage}

\begin{document}
\pagestyle{fancy}
\frontmatter
\pagenumbering{arabic}
\chapter{Some figures}
\section{Some section}
\lipsum[1-10]
\mainmatter
\chapter{Some figures}
\section{Some section}
\lipsum[1-10]
\backmatter
\pagenumbering{arabic}
\chapter{Some figures}
\section{Some section}
\lipsum[1-10]
\end{document}

You must log in to answer this question.

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