1

The relevant parts of my code are as follows:

\documentclass[a4paper, 12pt, twoside]{report}

\usepackage{fancyhdr}

\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\sffamily\huge\bfseries}
  {\thechapter}{20pt}{\Huge}

\titleformat{\section}
  {\sffamily\Large\bfseries}
  {\thesection}{1em}{}

\titleformat{\subsection}[block]
{\large\bfseries\sffamily}%
{\thesubsection}{5mm}{}
  
\titleformat{\subsubsection}[block]
  {\sffamily\bfseries}
  {\thesubsubsection}{1em}{}


% abbreviations package
\renewcommand{\glsnamefont}[1]{\textsf{#1}} %Change acronym name font   

% \makenomenclature
\usepackage[acronym, nopostdot]{glossaries}
\newacronym{eg}{e.g.}{example abbreviation}
\makeglossaries

\usepackage[a4paper, 
            left=30mm, right=30mm,
            top=20mm, bottom=20mm]{geometry}


\makeatletter
\def\@makechapterhead#1{%
  \vspace*{10\p@}%
  {\parindent \z@ \raggedright \normalfont
    \interlinepenalty\@M
    \LARGE \bfseries \sffamily
    \ifnum \c@secnumdepth >\m@ne
      \thechapter.\nobreakspace
    \fi
    #1\par\nobreak
    \vskip 20\p@
  }}
\makeatother


\begin{document}
\sffamily


\tableofcontents
\addcontentsline{toc}{chapter}{List of Contents}

\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}

\listoftables
\addcontentsline{toc}{chapter}{List of Tables}

\printglossary[type=\acronymtype,title=Abbreviations,nonumberlist]
\addcontentsline{toc}{chapter}{Abbreviations}


\include{Introduction/Introduction}
\include{main/main}

\emergencystretch=1em
\addcontentsline{toc}{chapter}{Bibliography}
\printbibliography

\end{document}

I want all fonts to be \sffamily which they currently are. I also want the space above main headings such as contents and table list to be smaller (matching what I've set for the chapters (10pt +margin)).

I tried

\usepackage{etoolbox}
\patchcmd{\tableofcontents}{\@starttoc}{\vspace{-1cm}\@starttoc}{}{}

But that didn't work on my abbreviations and only moved content rather than the titles (that is, it reduced the space after the titles and I want to reduce the space before)

I also tried adding

\usepackage[titles]{tocloft}
\titleformat{\chapter}[hang]{\huge\bfseries\sffamily}{\thechapter.}{1em}{}
\titlespacing*{\chapter}{10pt}{-1.5em}{1.1\parskip}
\titlelabel{\thetitle\quad} 

Which is prefect for the spacing but has changes some of the font back to default (for example in the contents page not the chapter headings but all the subheadings).

Is there a way to get the spacing I want and keep my fonts? Thank you

5
  • Please make your example self contained.
    – daleif
    May 21 at 9:40
  • @daleif What do you mean by self contained? Do you mean that I need to include the text in the Introduction.tex and main.tex files?
    – tsv
    May 21 at 11:17
  • As your example is now there are files we do not have access to. You should be able to replace the \include's by something more relevant.
    – daleif
    May 21 at 11:38
  • Note that your example has no chance of even compiling as \printbibliography is undefined as your example does not load biblatex. And \glsnamefont is undefined at the time you're trying to change it. It might be an idea to start over with this example instead.
    – daleif
    May 21 at 11:40
  • It should be mentioned that you can achieve the same results as titlesec or tocloft by directly modifying \@makechapterhead etc. The source code in book.cls is simple by comparison. May 21 at 13:33
0

In book class a lot changed when I used \usepackage{tocloft,etoolbox}% instead of \usepackage{etoolbox}. I then inserted

\renewcommand{\cftbeforetoctitleskip}{-0.25in} % Title is 1in from top

and

\renewcommand{\cftaftertoctitleskip}{1.0\baselineskip}% 1 double space after title

and the same for the 'lot' (instead of 'toc').

In the title formats I repeated the desired font:

\titleformat{\chapter}[hang]{\Large\bf}{\thechapter{.~}}{0pt}{\Large\bf\lineskiplimit=-\maxdimen}%

Maybe this helps in report class as well.

0

The ToC etc., titles are set with a \chapter* command. You have redefined your code for \chapter so you also need to redefine \chapter* code.

After this you can use tocloft commands like

\addtolength{\cftbeforetoctitleskip}{-30pt}

to move the ToC title upwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.