# Removing gap above “Chapter X” introduces problems with the text formatting

I am trying to get the page layout of my thesis sorted out. I am using fancyhdr to give me the page number in the top right and chapter name in the top left with a horizontal rule under, and sectsty to give me sans-serif font for all my section/subsection/etc headings.

I don't like the large gap above the words "Chapter X" with the horizontal rule under the header, so I'd like to reduce this. I have implemented the answer to this question: How to decrease spacing before chapter title? but I am rather unsatisfied: as you can see from my MWE below I have to redefine all of the ToC/LoF/LoT/Bibliography commands, and chapter* seems to have reverted to the serif font also.

In short, it seems very cumbersome. Is there really not a more elegant way? And if not, could someone with more knowhow than me explain how to get the chapter* heading into sffamily?

\documentclass[12pt, a4paper, oneside, fleqn]{report}

\usepackage{lmodern}       % gives bold italic font

\usepackage[toc]{glossaries} % add a glossary
\makeindex
\makeglossaries

%------------------------
\usepackage{fancyhdr}
\fancypagestyle{plain}{  %
\fancyhf{} %clear all header/footer fields

\usepackage{appendix}               % allow formatting of appendix titles

\usepackage{sectsty}          % put section headings in sans-serif font
\allsectionsfont{\sffamily}
\chapterfont{\LARGE\sffamily}

\makeatletter                                   % remove hideous gap from above the chapter title
%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\LARGE\sffamily\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\LARGE\sffamily\bfseries #1\par\nobreak
\vskip 40\p@
}}
%%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries  #1\par\nobreak
\vskip 40\p@
}}
\makeatother

%reformat some of the page titles
\renewcommand{\abstractname}{\textsf{Abstract}}
\renewcommand{\appendixpagename}{\textsf{Appendices}}
\renewcommand{\bibname}{\textsf{Bibliography}}
\renewcommand{\listfigurename}{\textsf{List of Figures}}
\renewcommand{\listtablename}{\textsf{List of Tables}}

\makeatletter
\newcommand*{\myappendixpage}{%remove page number from the Appendix page
\begingroup
\let\ps@plain\ps@empty
\appendixpage
\endgroup}
\makeatother

\begin{document}

\pagenumbering{gobble}
\pagestyle{empty}

%title page stuff
\begin{center}
\sffamily{\Huge{\textbf{This is the full title of my Thesis}}}
\end{center}
%end title page

%This stuff at the front with roman numbering
%--------------------------------------------
\pagestyle{plain}
\pagenumbering{roman}

\newpage

\begin{abstract}
here is my abstract
\end{abstract}

\chapter*{Acknowledgements}
I'd like to acknowledge some help from some people here.

\tableofcontents
\listoffigures
\listoftables
\newglossaryentry{Term}
{
name={Term},
description={Description of my term}
}
\printglossary[title=\textsf{Glossary}]

%Main thesis text with arabic numbering
%--------------------------------------

\pagenumbering{arabic}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily{\MakeUppercase{\thechapter.\ #1}}}{}}
\fancyfoot{}

\chapter{Introduction with some \textit{italic text}}
Here is my chapter

%Appendices and bibliography
%---------------------------

\appendix

\myappendixpage

\chapter{My appendix}
some stuff here

\end{document}

• Your redefinition of the plain page style causes the main chapter pages to have a header (typically this is not the case). Is this what you want? – Werner Feb 12 '14 at 16:20
• fancyhdr controls the content of the header and footer. geometry controls the location on the page (margins). Or just use \setlength{\topmargin}{.2in} \setlength{\headheight}{.15in} \setlength{\headsep}{.05in} – John Kormylo Feb 12 '14 at 16:23
• @Werner yes I am happy with that, I think it looks better to have it on all the pages than just some of them. Personal preferences and all. I just want to know about the chapter heading fonts please! – FionaSmith Feb 12 '14 at 16:26
• Actually, \setlenfth{\topmargin}{-.5in} by itself will do. – John Kormylo Feb 12 '14 at 16:33
• @JohnKormylo I don't understand what your suggestion is trying to fix? I had a go at using titlesec as in the question linked above, but egreg's answer told me why it didn't work. – FionaSmith Feb 12 '14 at 16:36

You can remove all your definitions

%reformat some of the page titles
\renewcommand{\bibname}{\textsf{Bibliography}}
\renewcommand{\listfigurename}{\textsf{List of Figures}}
\renewcommand{\listtablename}{\textsf{List of Tables}}


and simply add \sffamily to the definition of \@makeschapterhead:

\def\@makeschapterhead#1{%
%%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge\sffamily\bfseries  #1\par\nobreak
\vskip 40\p@
}}


Some of them are not sectioning commands (abstract and \appendixpage) so you have to redefine them manually.

I would also replace \LARGE with \Huge in the definition of \@makechapterhead for consistency with starred chapters:

\def\@makechapterhead#1{%
%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\LARGE\sffamily\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge\sffamily\bfseries #1\par\nobreak
\vskip 40\p@
}}


Moreover, replace the line

\printglossary[title=\textsf{Glossary}]


with simply

\printglossary


otherwise you will have the entry in the ToC in sans serif.

In the following MWE you have all starred and non-starred chapters in sans serif:

\documentclass[12pt, a4paper, oneside, fleqn]{report}

\usepackage{lmodern}       % gives bold italic font

\usepackage[toc]{glossaries} % add a glossary
\makeindex
\makeglossaries

%------------------------
\usepackage{fancyhdr}
\fancypagestyle{plain}{  %
\fancyhf{} %clear all header/footer fields

\usepackage{appendix}               % allow formatting of appendix titles

\usepackage{sectsty}          % put section headings in sans-serif font
\allsectionsfont{\sffamily}
\chapterfont{\LARGE\sffamily}

\makeatletter                                   % remove hideous gap from above the chapter title
%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\LARGE\sffamily\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge\sffamily\bfseries #1\par\nobreak
\vskip 40\p@
}}
%%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge\sffamily\bfseries  #1\par\nobreak
\vskip 40\p@
}}
\makeatother

%reformat some of the page titles
\renewcommand{\abstractname}{\textsf{Abstract}}
\renewcommand{\appendixpagename}{\textsf{Appendices}}

\makeatletter
\newcommand*{\myappendixpage}{%remove page number from the Appendix page
\begingroup
\let\ps@plain\ps@empty
\appendixpage
\endgroup}
\makeatother

\begin{document}

\pagenumbering{gobble}
\pagestyle{empty}

%title page stuff
\begin{center}
\sffamily{\Huge{\textbf{This is the full title of my Thesis}}}
\end{center}
%end title page

%This stuff at the front with roman numbering
%--------------------------------------------
\pagestyle{plain}
\pagenumbering{roman}

\newpage

\begin{abstract}
here is my abstract
\end{abstract}

\chapter*{Acknowledgements}
I'd like to acknowledge some help from some people here.

\tableofcontents
\listoffigures
\listoftables
\newglossaryentry{Term}
{
name={Term},
description={Description of my term}
}
\printglossary

%Main thesis text with arabic numbering
%--------------------------------------

\pagenumbering{arabic}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily{\MakeUppercase{\thechapter.\ #1}}}{}}
\fancyfoot{}

\chapter{Introduction with some \textit{italic text}}
Here is my chapter

%Appendices and bibliography
%---------------------------

\appendix

\myappendixpage

\chapter{My appendix}
some stuff here

\end{document}


• OK thanks, I see what I missed: namely I needed to change the font in the section beginning \def\@makeschapterhead#1 to \sffamily. Pretty simple really. The LARGE was not an accident by the way! But now I've changed the starred version too. Have removed numerous lines of renewcommand now. So, accepting this answer as it pointed me in the right direction – FionaSmith Feb 14 '14 at 12:15

With titlesec:

\documentclass[12pt, a4paper, oneside, fleqn]{report}

\usepackage{lmodern}       % gives bold italic font

\usepackage[toc]{glossaries} % add a glossary
\makeindex
\makeglossaries

%------------------------
\usepackage{fancyhdr}
\fancypagestyle{plain}{  %
\fancyhf{} %clear all header/footer fields

\usepackage{appendix}               % allow formatting of appendix titles

\usepackage{sectsty}          % you can do this with titlesec too.
\allsectionsfont{\sffamily}
%\chapterfont{\LARGE\sffamily}

\usepackage{titlesec,showframe}
\titleformat{name=\chapter}[display]
{\Huge\sffamily\bfseries\filright}
{\chaptertitlename\ \thechapter.}
{1ex}
{}

\titleformat{name=\chapter,numberless}[display]
{\Huge\sffamily\bfseries\filright}
{}
{0pt}
{}

\titlespacing*{name=\chapter}{0pt}{-20pt}{40pt}
\titlespacing*{name=\chapter,numberless}{0pt}{-40pt}{40pt}

%reformat some of the page titles
\renewcommand{\abstractname}{\textsf{Abstract}}
\renewcommand{\appendixpagename}{\textsf{Appendices}}

\makeatletter
\newcommand*{\myappendixpage}{%remove page number from the Appendix page
\begingroup
\let\ps@plain\ps@empty
\appendixpage
\endgroup}
\makeatother

\begin{document}

\pagenumbering{gobble}
\pagestyle{empty}

%title page stuff
\begin{center}
\sffamily{\Huge{\textbf{This is the full title of my Thesis}}}
\end{center}
%end title page

%This stuff at the front with roman numbering
%--------------------------------------------
\pagestyle{plain}
\pagenumbering{roman}

\newpage

\begin{abstract}
here is my abstract
\end{abstract}

\chapter*{Acknowledgements}
I'd like to acknowledge some help from some people here.

\tableofcontents
\listoffigures
\listoftables
\newglossaryentry{Term}
{
name={Term},
description={Description of my term}
}
\printglossary

%Main thesis text with arabic numbering
%--------------------------------------

\pagenumbering{arabic}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily{\MakeUppercase{\thechapter.\ #1}}}{}}
\fancyfoot{}

\chapter{Introduction with some \textit{italic text}}
Here is my chapter

%Appendices and bibliography
%---------------------------

\appendix

\myappendixpage

\chapter{My appendix}
some stuff here

\end{document}


• Thanks, I am sure this works just fine, but the other answer did what I wanted without me having to go back to titlesec. Cheers. – FionaSmith Feb 14 '14 at 12:15