5

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}

\headheight 28pt
\headsep 24pt

\usepackage{lmodern}       % gives bold italic font

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

%Sectioning and headings
%------------------------
\usepackage{fancyhdr}
\fancypagestyle{plain}{  %
\fancyhf{} %clear all header/footer fields
\rhead{\sffamily{\thepage}}}

\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
\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
    \LARGE\sffamily\bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\def\@makeschapterhead#1{%
  %%%%%\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{\contentsname}{\textsf{Table Of Contents}}
\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}
\renewcommand{\headrulewidth}{0pt}

%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
Copyright statement

\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}
}
\glsaddall
\printglossary[title=\textsf{Glossary}]

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

\pagenumbering{arabic}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily{\MakeUppercase{\thechapter.\ #1}}}{}}
\lhead{\leftmark}
\chead{}
\rhead{\sffamily{\thepage}}
\renewcommand{\headrulewidth}{0.1pt}
\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}
5
  • 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
    Commented Feb 12, 2014 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} Commented Feb 12, 2014 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
    Commented Feb 12, 2014 at 16:26
  • Actually, \setlenfth{\topmargin}{-.5in} by itself will do. Commented Feb 12, 2014 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
    Commented Feb 12, 2014 at 16:36

2 Answers 2

5

You can remove all your definitions

%reformat some of the page titles
\renewcommand{\bibname}{\textsf{Bibliography}}
\renewcommand{\contentsname}{\textsf{Table Of Contents}}
\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}

\headheight 28pt
\headsep 24pt

\usepackage{lmodern}       % gives bold italic font

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

%Sectioning and headings
%------------------------
\usepackage{fancyhdr}
\fancypagestyle{plain}{  %
\fancyhf{} %clear all header/footer fields
\rhead{\sffamily{\thepage}}}

\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
\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@
  }}
\def\@makeschapterhead#1{%
  %%%%%\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}
\renewcommand{\headrulewidth}{0pt}

%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
Copyright statement

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

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

\pagenumbering{arabic}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily{\MakeUppercase{\thechapter.\ #1}}}{}}
\lhead{\leftmark}
\chead{}
\rhead{\sffamily{\thepage}}
\renewcommand{\headrulewidth}{0.1pt}
\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} 

enter image description here

1
  • 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
    Commented Feb 14, 2014 at 12:15
3

With titlesec:

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

\headheight 28pt
\headsep 24pt

\usepackage{lmodern}       % gives bold italic font

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

%Sectioning and headings
%------------------------
\usepackage{fancyhdr}
\fancypagestyle{plain}{  %
\fancyhf{} %clear all header/footer fields
\rhead{\sffamily{\thepage}}}

\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}
\renewcommand{\headrulewidth}{0pt}

%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
Copyright statement

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

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

\pagenumbering{arabic}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily{\MakeUppercase{\thechapter.\ #1}}}{}}
\lhead{\leftmark}
\chead{}
\rhead{\sffamily{\thepage}}
\renewcommand{\headrulewidth}{0.1pt}
\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}

enter image description here

1
  • 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
    Commented Feb 14, 2014 at 12:15

You must log in to answer this question.

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