1

This is my preamble that im using to format my document


% Package Inclusions
\usepackage{graphicx}
\usepackage{times}
\usepackage{geometry}
\usepackage[style=ieee,backend=biber]{biblatex}
\usepackage{tabularx}
\usepackage{float}
\usepackage{listings}
\usepackage{setspace}
\usepackage{titlesec}
\usepackage{ragged2e}
\usepackage{caption}
\usepackage{tocloft} % To customize the table of contents

% Images
\graphicspath{{/home/siddharthakhanal/MEGA/College/4th Semester/Operating System/case study/linux case study/images}}

% Page Formatting
\geometry{a4paper,portrait,top=1in,bottom=1in,right=1in,left=1.25in}

% References
\addbibresource{citations.bib}

% Set line spacing
\setstretch{1.5}

% Title formatting
\titleformat{\chapter}[display]
  {\normalfont\fontsize{16}{18}\bfseries}{\chaptertitlename\ \thechapter}{0pt}{\huge}
\titleformat{\section}
  {\normalfont\fontsize{14}{16}\bfseries}{\thesection}{1em}{}

% Configure figure caption formatting
\DeclareCaptionFormat{figureformat}{\centering\bfseries\fontsize{12}{14}\selectfont#1#2#3}
\captionsetup[figure]{format=figureformat, justification=centering, singlelinecheck=false}

% Configure table caption formatting
\DeclareCaptionFormat{tableformat}{\centering\bfseries\fontsize{12}{14}\selectfont#1#2#3}
\captionsetup[table]{format=tableformat, justification=centering, singlelinecheck=false, position=above}

% Setting up spacing between header and top
\titlespacing{\chapter}{0pt}{-32pt}{1cm}

% Set section heading formats
\titleformat{\chapter}{\centering\fontsize{16pt}{18pt}\bfseries\uppercase}{Chapter \thechapter}{1em}{}
\titleformat{\section}{\fontsize{14pt}{16pt}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\fontsize{12pt}{14pt}\bfseries}{\thesubsection}{1em}{}

% Set figure and table captions
\captionsetup{font={bf,small},labelfont=bf,labelsep=period}


% For setting paragraph spacing
\setlength{\parskip}{1.5ex}
\setlength{\parindent}{0in}


% \renewcommand{\contentsname}{\centering\bfseries\normalfont\Large Table of Contents}


This is my main.tex file

\documentclass[12pt]{report}
\input{preambles/preambles.tex}


\begin{document}

\include{chapters/coverpage}

\tableofcontents

% \pagenumbering{roman}
\include{chapters/1.introduction}
\include{chapters/2.overview}
\include{chapters/3.process_and_treads}
\include{chapters/4.memory_management}
\include{chapters/5.io}
\include{chapters/6.filesystem}
\include{chapters/7.security}

\printbibliography[title=refrences]
\addcontentsline{toc}{chapter}{Refrences}


\end{document}

Im new to latex and I don't know what is going wrong here,when im rendering the toc it's adding extra white space of the top of it but it doesn't add extra spaces in the chapters

enter image description here

enter image description here

enter image description here

2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Jul 29, 2023 at 14:24
  • Off-topic: The times font package is obsolete and deprecated. Don't use it. In its place, do load the newtxtext and newtxmath font packages.
    – Mico
    Jul 29, 2023 at 15:27

1 Answer 1

0

Your problem will be solved if you don't load the tocloft package and you use \MakeUppercase command instead of \uppercase. Try the following MWE:

\documentclass{report}
\usepackage{times}
\usepackage{titlesec}
\titlespacing{\chapter}{0pt}{-32pt}{1cm}
\titleformat{\chapter}{\filcenter\fontsize{16pt}{18pt}\bfseries\MakeUppercase}{Chapter \thechapter}{1em}{}

\begin{document}

\tableofcontents
\chapter{Title}
\chapter{Title}

\end{document}
2
  • It is not necessary to stop loading the tocloft package. Instead, just load it with the option titles, i.e., run \usepackage[titles]{tocloft}.
    – Mico
    Jul 29, 2023 at 15:28
  • It's working thank you Jul 29, 2023 at 17:06

You must log in to answer this question.

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