2

I'm writing a report and I've used the following line in the preamble

\rfoot{Page \thepage \hspace{1pt}/\hspace{1pt}$11$}   

Everything is great except when I use \chapter, because it turns it into the ordinary number of page, without writing page blabla/blabla

Coule you explain to me how i could correct this and make it write Page blabla / blabla even when i use a chapter ?

As requested the code :

\documentclass[12pt, openany]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[frenchb]{babel}
\usepackage{libertine}
\usepackage[pdftex]{graphicx}
\usepackage{amsfonts,amsmath,amssymb,amsxtra}
\usepackage{mathrsfs}
\usepackage[T1]{fontenc}
\usepackage{pst-all}
\usepackage{pstricks-add}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}

\rfoot{Page \thepage \hspace{1pt}/\hspace{1pt}$11$}

\begin{document}
text
\newpage
\chapter{text}
\end{document}
3
  • You need to change the page style used for chapter pages... can you give us a complete (but minimal) example file?
    – Thruston
    Sep 9, 2018 at 21:54
  • Does this help? tex.stackexchange.com/q/4543/15036
    – Thruston
    Sep 9, 2018 at 21:59
  • @Thruston It did not help sadly :/
    – Atmos
    Sep 9, 2018 at 22:18

2 Answers 2

2

In standard classes, \chapter sets the chapter page page style to plain, so you have to redefine it:

\documentclass[12pt, openany]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[frenchb]{babel}
\usepackage{libertine}
\usepackage[pdftex]{graphicx}
\usepackage{amsfonts,amsmath,amssymb,amsxtra}
\usepackage{mathrsfs}
\usepackage[T1]{fontenc}
\usepackage{pst-all}
\usepackage{pstricks-add}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage{lipsum}

\fancypagestyle{plain}{%
\fancyhf{} %
 \rfoot{Page \thepage \hspace{1pt}/\hspace{1pt}$11$}
 \renewcommand{\headrulewidth}{0pt}}

\pagestyle{fancy}
\fancyhf{}
\rfoot{Page \thepage \hspace{1pt}/\hspace{1pt}$11$}

\begin{document}
text
\newpage
\chapter{text}
\lipsum

\end{document} 

enter image description here

0

You could use page style fancyplain. Then it is easy to use the same content for plain and other pages using a fancyhdr page style:

\documentclass[12pt, openany]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[frenchb]{babel}
\usepackage{libertine}
\usepackage{graphicx}% option pdftex removed
\usepackage{amsfonts,amsmath,amssymb,amsxtra}
\usepackage{mathrsfs}
%\usepackage[T1]{fontenc}% do not load packages twice
\usepackage{pst-all}
\usepackage{pstricks-add}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{lastpage}% <- added

\pagestyle{fancyplain}
\fancyhf{}
\fancyhead[C]{\fancyplain{plain page}{other page}}% different contents for plain and other pages
\fancyfoot[R]{\thepage \hspace{1pt}/\hspace{1pt}\pageref{LastPage}}

\begin{document}
text
\newpage
\chapter{text}
\lipsum
\end{document}

Result:

enter image description here

You must log in to answer this question.

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