新しいレポートの章の前の空白ページを削除するにはどうすればよいですか?

新しいレポートの章の前の空白ページを削除するにはどうすればよいですか?

この問題は、大きくて太字で派手な、あまり好きではない章タイトルの既定のフォント (次のコードでは「INTRODUCTION」) を既定の通常のテキスト フォントに設定するために、次のコードを序文に追加した後に発生しました。

\usepackage[rm,tiny]{titlesec} %added this to change the chapter title's font as default regular text font.
\titleformat{\chapter}{\normalfont\centering}{}{0pt}{}
\titlelabel{}
\titlespacing*{\chapter}{0pt}{-20pt}{4pt}

何が起こったかというと、章のフォントを変更できたのですが、「はじめに」ページの前に空白ページ (ヘッダーにページ番号 1 がある) が表示されました。はじめにページのフッターには、書式設定したヘッダーではなく、ページ番号 2 が表示されています。その他のページ番号はすべてヘッダーにあります。

この傾向は、コマンドを使用して他の章 (文献レビュー、方法論など) をフォーマットするたびに続きます\chapter{}。空白ページが作成され、新しいセクションが 1 ページ下に移動され、ページ番号はヘッダーではなくフッターに表示されます。

より完全なコードは次のとおりです。

\documentclass[12pt]{report}
\usepackage[left=1.5in, right=1in, top=1in, bottom=1.5in]{geometry}
\usepackage{setspace}
\usepackage{amsbsy}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{textcomp}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{calc}
\newlength{\depthofsumsign}
\setlength{\depthofsumsign}{\depthof{$\sum$}}
\newlength{\totalheightofsumsign}
\newlength{\heightanddepthofargument}

\usepackage[rm,tiny]{titlesec} %added this to change the chapter title's font as default regular text font.

\usepackage{pdflscape,booktabs}
\usepackage[flushleft]{threeparttable}
\renewcommand\TPTtagStyle{\textit} 
\usepackage[font=it,skip=0.5\baselineskip]{caption}

%to put page numbers in the header
\fancyhf{}
\fancyhead[C]{\thepage}
\pagestyle{fancy}

\titleformat{\chapter}{\normalfont\centering}{}{0pt}{}
\titlelabel{}
\titlespacing*{\chapter}{0pt}{-20pt}{4pt}

\begin{document}
\setlength{\headheight}{50pt} %to note where the header lies.
\setlength{\headsep}{15pt} %to set the distance between header and the first line after it.

\renewcommand{\headrulewidth}{0pt}
\doublespacing
\thispagestyle{empty}
\begin{center}
\vspace*{0.2in}
MY TITLE\\
\vspace*{0.4in}
by\\
My name\\\

\vspace*{1.4in}
\singlespacing
A thesis submitted in partial fulfillment\\
of the requirements for the degree\\
\doublespacing
of\\
My degree\\
in\\
My discipline\\\

\vspace*{1in}
MY UNIVERSITY\\
University, Location\\
\vspace*{0.2in}
April 2019
\end{center}
\pagebreak

\pagenumbering{gobble}
\begin{center}
\vspace*{1in}
\textcopyright COPYRIGHT\\
by\\
My name\\
2019\\
All Rights Reserved
\end{center}
\pagebreak

\pagenumbering{arabic}
\setcounter{page}{1}
\begin{center}
\chapter{INTRODUCTION}
\end{center}

My introduction section's first paragraph...

\end{document}

最初の 2 ページは問題ありません (1 ページ目は論文名などが記載された表紙、2 ページ目は著作権セクションです)。これらのページにはページ番号がありません (したがって\pagenumbering{gobble}2 ページ目にはコードがありません)。

編集: コードを削除して空白ページの問題を解決しました\begin{center} ... \end{center}が、章のあるページのページ番号はヘッダーではなくフッターにまだ表示されています。他のすべてのページのヘッダーには番号があります。これを修正する方法はありますか?

答え1

章ページでは、plainデフォルトでページ スタイルが使用されます。両方のスタイルを調整したい場合はplain、代わりにfancypagestyle を使用します。一部のヘッダー フィールドやフッター フィールドの内容が異なる場合は、 を使用します。fancyplainfancy\fancyplain{<content for plain style>}{<content for fancy style>}

\documentclass[12pt]{report}
\usepackage[left=1.5in, right=1in, top=1in, bottom=1.5in]{geometry}
\usepackage{setspace}
\usepackage{amsbsy}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{textcomp}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{calc}
\newlength{\depthofsumsign}
\setlength{\depthofsumsign}{\depthof{$\sum$}}
\newlength{\totalheightofsumsign}
\newlength{\heightanddepthofargument}

\usepackage[rm,tiny]{titlesec} %added this to change the chapter title's font as default regular text font.

\usepackage{pdflscape,booktabs}
\usepackage[flushleft]{threeparttable}
\renewcommand\TPTtagStyle{\textit} 
\usepackage[font=it,skip=0.5\baselineskip]{caption}

%to put page numbers in the header
\fancyhf{}
\fancyhead[C]{\thepage}
%\fancyfoot[C]{\fancyplain{plain style}{fancy style}}% <- to show the usage of \fancyplain
\pagestyle{fancyplain}% <- changed

\titleformat{\chapter}{\normalfont\centering}{}{0pt}{}
\titlelabel{}
\titlespacing*{\chapter}{0pt}{-20pt}{4pt}

\setlength{\headheight}{50pt} %to note where the header lies.
\setlength{\headsep}{15pt} %to set the distance between header and the first line after it.

\renewcommand{\headrulewidth}{0pt}

\begin{document}
\doublespacing
\thispagestyle{empty}
\begin{center}
\vspace*{0.2in}
MY TITLE\\
\vspace*{0.4in}
by\\
My name\\\

\vspace*{1.4in}
\singlespacing
A thesis submitted in partial fulfillment\\
of the requirements for the degree\\
\doublespacing
of\\
My degree\\
in\\
My discipline\\\

\vspace*{1in}
MY UNIVERSITY\\
University, Location\\
\vspace*{0.2in}
April 2019
\end{center}
\clearpage

\thispagestyle{empty}
\begin{center}
\vspace*{1in}
\textcopyright COPYRIGHT\\
by\\
My name\\
2019\\
All Rights Reserved
\end{center}
\cleardoublepage

\pagenumbering{arabic}
\setcounter{page}{1}

\chapter{INTRODUCTION}
\lipsum

\end{document}

結果

スクリーンショット

答え2

\chapterここでは、コマンドを再定義し、\thispagestyle{fancy}(すべてのバージョンの) 章コマンドの各呼び出しに追加するコードを使用した修正を示します。

\documentclass[12pt]{report}
\usepackage[left=1.5in, right=1in, top=1in, bottom=1.5in]{geometry}
\usepackage{setspace}
\usepackage{amsbsy}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{textcomp}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{calc}
\newlength{\depthofsumsign}
\setlength{\depthofsumsign}{\depthof{$\sum$}}
\newlength{\totalheightofsumsign}
\newlength{\heightanddepthofargument}

\usepackage[rm,tiny]{titlesec} %added this to change the chapter title's font as default regular text font.
\usepackage{lipsum}
\usepackage{pdflscape,booktabs}
\usepackage[flushleft]{threeparttable}
\renewcommand\TPTtagStyle{\textit} 
\usepackage[font=it,skip=0.5\baselineskip]{caption}

%to put page numbers in the header
\fancyhf{}
\fancyhead[C]{\thepage}
\fancyfoot{}
\pagestyle{fancy}

\titleformat{\chapter}{\normalfont\centering}{}{0pt}{}
\titlelabel{}
\titlespacing*{\chapter}{0pt}{-20pt}{4pt}


%koleygr: Redefining chapter to include \thispagestyle{fancy}
\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{fancy}
}
\def\@StarredWithout#1{
\oldchapter*{#1}%
\thispagestyle{fancy}
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
\thispagestyle{fancy}
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
\thispagestyle{fancy}
}
\makeatother


\begin{document}
\setlength{\headheight}{50pt} %to note where the header lies.
\setlength{\headsep}{15pt} %to set the distance between header and the first line after it.

\renewcommand{\headrulewidth}{0pt}
\doublespacing
\thispagestyle{empty}
\begin{center}
\vspace*{0.2in}
MY TITLE\\
\vspace*{0.4in}
by\\
My name\\\

\vspace*{1.4in}
\singlespacing
A thesis submitted in partial fulfillment\\
of the requirements for the degree\\
\doublespacing
of\\
My degree\\
in\\
My discipline\\\

\vspace*{1in}
MY UNIVERSITY\\
University, Location\\
\vspace*{0.2in}
April 2019
\end{center}
\pagebreak

\pagenumbering{gobble}
\begin{center}
\vspace*{1in}
\textcopyright COPYRIGHT\\
by\\
My name\\
2019\\
All Rights Reserved
\end{center}
\pagebreak

\pagenumbering{arabic}
\setcounter{page}{1}
%\begin{center}

\chapter{INTRODUCTION}
%\end{center}

My introduction section's first paragraph...
\lipsum[1-5]

\chapter{Another Chapter}
\lipsum[1-5]
\end{document}

追記:以前の回答を引用しましたここ章コマンドを再定義するには、@GonzaloMedinaの回答を使用することができますここ代わりに、私のコードが気に入らない場合は...

関連情報