3

This problem started after I added the following code in the preamble to set the default chapter title font ("INTRODUCTION" in the following code), which was big, bold and brash that I did not like, into default regular text font.

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

What happened is, I could change the font of my chapter, but a blank page (with page no. 1 on the header) appeared before the "Introduction" page. The introduction page now has page no. 2 on the footer rather than the header that I formatted it to appear. All other page numbers are in the header.

This trend continues whenever I format the other chapters (literature review, methodology, etc.) with the \chapter{} command. A blank page is created and the new section gets pushed one page down, with the page number on the footer rather than on the header.

Here is the more complete code:

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

The first two pages are fine (first page being the cover page with thesis name etc., and the second page being the copyright section). These pages are without page number (and thus the \pagenumbering{gobble} code on the second page).

Edit: I have dealt with the problem of the blank page by removing the \begin{center} ... \end{center} code, but the page number for the page with the chapter is still appearing in the footer rather than the header. All other pages have numbers in the header. Any way to fix this?

3
  • 1
    Just remove \begin{center} and \end{center} commands that include the \chapter command. Your chapter title will be centered anyway and this is what causes the problem... The general appearance of a sectioning command is defined by your \titleformat and \titlespacing commands and will not be affected from environments like center or similar that will just cause problems.
    – koleygr
    Mar 1, 2019 at 6:57
  • @koleygr, Thanks a lot! This worked to remove the blank page. But, the page number for the page with the chapter is still appearing in the footer rather than the header. All other pages have numbers in the header. Any way to fix this?
    – Jerry
    Mar 1, 2019 at 7:13
  • I added a solution as an answer because it was difficult to fit it in a comment... Feel free to ask corrections if something is not already as should be.
    – koleygr
    Mar 1, 2019 at 8:12

2 Answers 2

4

The chapter pages use page style plain by default. If you want to adjust both styles plain and fancy use pagestyle fancyplain instead fancy. If the content should differ in some of the header and/or footer fields use \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}

Result

screenshot

1
  • (+1) I learned something new, and I commenting just to say, that after that I suppose the document will not have separate plain page-style... but possibly the OP doesn't really care about this.
    – koleygr
    Mar 1, 2019 at 8:49
3

Here is a fix by using a code that redefines \chapter command and adds \thispagestyle{fancy} to each call of (every version of) chapter command:

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

PS: I used my old answer from here to redefine chapter command, but you could use the answer of @GonzaloMedina from here instead if you don't like my code...

2
  • Thanks a lot! This works. No reason why I won't like your code (:
    – Jerry
    Mar 1, 2019 at 8:30
  • People doesn't really like commands that redefining \section etc even in the case (like mine) that the code just adds a feature to the command and has no other effects. I can understand this and it is accepted in general. Also, a healthy reaction in code that someone finds difficult or can't really understand, is to not want to use it (my code seems simple to me but someone else could find it complicated or unneeded complicated)...Anyway, @esdd's code solves your problem with less lines of code needed, and I would chose his answer. Feel free to accept his answer.
    – koleygr
    Mar 1, 2019 at 8:47

You must log in to answer this question.

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