页码仅出现在包含章节标题的页面上

页码仅出现在包含章节标题的页面上

我对页码编号有疑问。有人给了我一个用于设置章节标题样式的模板,但显然这会删除除带有章节标题的页面之外的所有页面的页码编号。

模板如下:

   \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}

我的问题是:

  • 什么导致了这种行为?
  • 我该如何修复这个问题?

编辑:我想要的是在所有页面上启用数字。

答案1

没有章节标题的页面上的页码位于页眉中。

fancyhdr您可以使用类似或的包scrlayer-scrpage来定义页眉和页脚的内容。以下是使用的建议,scrlayer-scrpage它将页码也放在“普通”页面的页脚中:

\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}

结果:

在此处输入图片描述

相关内容