章が始まるフッターにのみページ番号を配置する方法

章が始まるフッターにのみページ番号を配置する方法

これまでのところ、章が始まるページを除くすべてのページのヘッダーにページ番号が付けられています (これは希望どおりです)。章が始まるページにはページ番号が付けられず、空白のままになっています。

章が始まるページのフッターにページ番号を表示したいのですが、それは可能ですか?

これまでのところ、ヘッダーのページ番号付けには非常にうまく機能していますが、章のページにはページ番号が付いていません。

\pagestyle{fancy}                       % Sets fancy header and footer
\fancyfoot{}                            % Delete current footer settings


\fancyhf{}

\fancyhead[LE,RO]{\bfseries\thepage}    % Page number (boldface) in left on even
% pages and right on odd pages
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}

\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}      % Chapter in the right on even pages
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}\chaptermark}     % Section in the left on odd pages

\fancypagestyle{plain}{
\fancyhf{}
  \fancyhead{}
  \fancyfoot{}
    \renewcommand{\headrulewidth}{0pt}
}

ここに画像の説明を入力してください

ここに画像の説明を入力してください

ここに画像の説明を入力してください

答え1

標準クラスを使用していると仮定すると (質問には MWE はありません)、 fancypagestyle の定義を削除できますplain。すると、plain標準クラスによって提供されるデフォルトのスタイルが章のページで使用されます。そして、このデフォルトのplainスタイルが目的のスタイルのようです。

例:

\documentclass{book}
\usepackage{blindtext}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}}
\begin{document}
\blinddocument
\end{document}

結果:

ここに画像の説明を入力してください

答え2

次のコードをプリアンブルに追加できます:

\let\oldchapter\chapter
\makeatletter
\def\chapter{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}      
\def\@StarredWith[#1]#2{%
\oldchapter*{#2}%
\thispagestyle{plain}
}
\def\@StarredWithout#1{
\oldchapter*{#1}%
\thispagestyle{plain}
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
\thispagestyle{plain}
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
\thispagestyle{plain}
}
\makeatother

これにより、章のデフォルトの動作が変更されます(pagestyle{empty}コマンドを含む)

関連情報