这是我用来格式化文档的序言
% 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}
这是我的 main.tex 文件
\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}
我是乳胶新手,我不知道这里出了什么问题,当我渲染目录时,它会在顶部添加额外的空白,但不会在章节中添加额外的空格
答案1
如果您不加载tocloft
包并使用\MakeUppercase
命令而不是\uppercase
,您的问题将得到解决。尝试以下 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}