1

I have a problem with page numbering. I was given a template for styling chapter titles but apparently this removes the page numbering for all pages except the pages which have chapter title on it.

here is the template:

   \documentclass[a4paper,12pt, oneside, table]{book}
\usepackage[margin=1in,includefoot]{geometry}

%\usepackage[top=2.5cm, bottom=2.5cm, left=3cm, right=2cm]{geometry}
\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[final]{pdfpages}

\usepackage[Sonny]{fncychap}

\usepackage{titlesec}

\usepackage{utf8}

    % Nicer default font than Computer Modern for most use cases
 %   \usepackage{palatino}

 \usepackage{blindtext}
\usepackage[final]{graphicx}
%\usepackage{svg}
\usepackage[francais]{babel}%

\usepackage{lmodern}%
\usepackage{textcomp}%
%\usepackage{lastpage}%
\usepackage{color}%
\usepackage{longtable}%
\usepackage{tabu}%
\usepackage[table]{xcolor}%

\usepackage{subcaption}

\frenchbsetup{StandardLists=true} % à inclure si on utilise \usepackage[french]{babel}
\usepackage{enumitem}
%\usepackage{amssymb}

%\include{boilerpalte}
\setlength{\parindent}{2em}
\renewcommand{\baselinestretch}{1.5}


\def\myformat#1{\centering#1}

%
\definecolor{C3D69B}{HTML}{C3D69B}%
\definecolor{000000}{HTML}{000000}%
%

%%
% chapter style
%%
\titleformat{\chapter}[display]
{\normalfont\Large\filcenter\sffamily}
{\vspace*{\fill}
 \titlerule[1pt]%
 \vspace{1pt}%
 \titlerule
 \vspace{1pc}%
 \LARGE\MakeUppercase{\chaptertitlename}~\thechapter}
{1pc}
{\titlerule\Huge}
[\vspace*{\fill}\newpage]

\titlespacing*{\chapter}{0pt}{0pt}{0pt}

\titleformat{name=\chapter,numberless}[display]
{\normalfont\Large\filcenter\sffamily}
{}
{0pt}
{\titlerule[1pt]\Huge}
[\titlerule]

%%
% part style
%%
\makeatletter
\renewcommand\part{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \thispagestyle{emptyx}%   % Original »plain« replaced by »emptyx
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \null\vfil
  \secdef\@part\@spart}
\makeatother

\begin{document}


\tableofcontents

\chapter{PRÉSENTATION DU
CADRE DU PROJET}
\section{Introduction}\label{introChap1}

xxxxxxxxThis page don't have a number

\section{Cadre du Projet}\label{L1Chap1}

yyyy



\end{document}

my questions are :

  • what's provoking this behavior?
  • and what can I do do fix this?

EDIT: what I want is to enable numbers on all pages.

  • welcome to tex.sx. unfortunately, there's one very important piece of information missing -- the \documentclass. that is where the basic style of running heads is usually defined. please extend your example to be compilable -- starting with \documentclass and ending with \end{document}. you can use dummy text (packages like lipsum and blindtext can help with that) to avoid including private information. then we can answer without having to consult our crustal balls. (mine is usually out of commission.) – barbara beeton Sep 29 '17 at 14:00
  • thx for your welcoming message, you are not like SO you don't crush beginners, appreciate, Edit the code – chedy najjar Sep 29 '17 at 14:07
  • 2
    This issue has come up in several previous queries. Basically, with the book document class, LaTeX issues the directive \thispagesstyle{plain} every time a \part or \chapter directive is encountered. The plain page style is programmed to place a page number at the center of the footer line. Please clarify what you're trying to achieve: (a) suppressing page numbers on pages with chapter headers or (b) re-enabling page numbers on all other pages? – Mico Sep 29 '17 at 14:08
  • thx for the explanation, HOw can I show the numbering for all pages? – chedy najjar Sep 29 '17 at 14:10
  • Since we don't have the files first.tex, dedi.tex, remerciment.tex, etc., it's not possible to compile your code. Please consider editing your code so that it becomes compilable while still generating the issues you're looking to fix. – Mico Sep 29 '17 at 14:13
1

The page numbers on the pages without a chapter heading are in the header.

You can use a package like fancyhdr or scrlayer-scrpage to define the contents of header and footer. Here is a suggestion using scrlayer-scrpage that puts the page number in footer for "normal" pages, too:

\documentclass[a4paper,12pt, oneside, table]{book}
\usepackage[margin=1in,includefoot,
  headheight=21.8pt% as suggested by scrlayer-scrpage
]{geometry}

\usepackage[pagestyleset=standard,automark]{scrlayer-scrpage}% sets pagestyle scrheadings
\ohead{}% remove the page number from header on pages
\cfoot{\pagemark}% add the page number to footer

\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[table]{xcolor}%
\usepackage[final]{graphicx}
\usepackage[final]{pdfpages}% loads also graphicx

\usepackage[Sonny]{fncychap}
\usepackage{titlesec}
\usepackage{utf8}
\usepackage{blindtext}% only for dummy text
\usepackage[french]{babel}%<- changed in french
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{longtable}%
\usepackage{tabu}%

\usepackage{subcaption}
\frenchbsetup{StandardLists=true} % à inclure si on utilise \usepackage[french]{babel}
\usepackage{enumitem}
\setlength{\parindent}{2em}
\renewcommand{\baselinestretch}{1.5}

\def\myformat#1{\centering#1}

\definecolor{C3D69B}{HTML}{C3D69B}%
\definecolor{000000}{HTML}{000000}%

%%
% chapter style
%%
\titleformat{\chapter}[display]
{\normalfont\Large\filcenter\sffamily}
{\vspace*{\fill}
 \titlerule[1pt]%
 \vspace{1pt}%
 \titlerule
 \vspace{1pc}%
 \LARGE\MakeUppercase{\chaptertitlename}~\thechapter}
{1pc}
{\titlerule\Huge}
[\vspace*{\fill}\newpage]

\titlespacing*{\chapter}{0pt}{0pt}{0pt}

\titleformat{name=\chapter,numberless}[display]
{\normalfont\Large\filcenter\sffamily}
{}
{0pt}
{\titlerule[1pt]\Huge}
[\titlerule]

%%
% part style
%%
\makeatletter
\renewcommand\part{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \thispagestyle{empty}%   % Original »plain« replaced by »empty«
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \null\vfil
  \secdef\@part\@spart}
\makeatother

\begin{document}
\tableofcontents
\part{Part}
\blinddocument
\end{document}

Result:

enter image description here

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.