这是我第一次在这里发帖,所以希望我能提供解决我的问题所需的所有必要信息。
我正在用 Latex 写我的论文,我的目录需要一种特定的格式(见图 1),我已经尝试了在不同威胁中发现的很多选项,但无法以适合我的方式将它们拼接在一起。
因此我的问题包括:
- “第十章”之后没有页码。
- 章节名称为正常且较小的字体而 Chapter 保持加粗且更大(!但仅限于目录中,因为两者都需要在实际章节中保持粗体!)
- 减少间距章节与章节名称之间,但章节之间仍然增加了一个。
我希望你能帮助我,因为几个月来我一直无法独自解决这个问题。
\documentclass[11pt, twoside]{report}
\linespread{1.5} %line spacing 1.5
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\setlength{\headheight}{15pt}% ...at least 14.49998pt
%Font and Language
\usepackage[T1]{fontenc}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial
\usepackage[english]{babel}
%Header & Footer
\usepackage{fancyhdr} %for header and footer
\usepackage{titlesec} %center heading and title
%Chapters
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries}{\centering\chaptertitlename\ \thechapter}{10pt}{\centering\LARGE}
\titlespacing{\chapter}{0pt}{-15pt}{25.5pt}
%Table of Content
\usepackage{tocloft}
\renewcommand\numberline[1]{}
\usepackage{subfiles} % For subfiling; best loaded last in the preamble
\newcommand*{\myfont}{\fontfamily{pzc}\selectfont}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{tocdepth}{0}
\tableofcontents{} %Table of Contents
\pagenumbering{gobble}
\newpage
%%%%%%%%%%%%%%
\chapter[Chapter 1]{\centering General Introduction}
\addcontentsline{toc}{chapter}{General Introduction}
subfile{Chapters/Chapter1_Introduction}
%%%%%%%%%%%%%%
\chapter[Chapter 2]{\centering Chapter 2}
\addcontentsline{toc}{chapter}{Chapter 2 Name}
%subfile{Chapters/Chapter2)
%%%%%%%%%%%%%%
etc...
%%%%%%%%%%%%%%
\end{document}
答案1
尝试一下您对 MWE 的这种修改,谢谢。它本质上使用了tocloft
功能。
% thesistocprob.tex SE 597856
\documentclass[11pt, twoside]{report}
\usepackage{lipsum}
\linespread{1.5} %line spacing 1.5
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\setlength{\headheight}{15pt}% ...at least 14.49998pt
%Font and Language
\usepackage[T1]{fontenc}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial
\usepackage[english]{babel}
%Header & Footer
\usepackage{fancyhdr} %for header and footer
\usepackage{titlesec} %center heading and title
%Chapters
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries}{\centering\chaptertitlename\ \thechapter}{10pt}{\centering\LARGE}
\titlespacing{\chapter}{0pt}{-15pt}{25.5pt}
%Table of Content
\usepackage{tocloft}
\renewcommand\numberline[1]{}
\renewcommand{\cftchappagefont}{\phantom} % hides the page number
\newcommand*{\myfont}{\fontfamily{pzc}\selectfont}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{tocdepth}{0}
\tableofcontents{} % Table of Contents
%\pagenumbering{gobble} % this stops ALL page numbering
\newpage
%%%%%%%%%%%%%%
\chapter[Chapter 1]{\centering General Introduction} \label{intro}
\addtocontents{toc}{General Introduction \hfill \pageref{intro}\par}
\lipsum[1]
This chapter starts on page \pageref{intro}.
\chapter[Chapter 2]{\centering Chapter 2} \label{name}
\addtocontents{toc}{Name \hfill \pageref{name}\par}
\lipsum[2]
This chapter starts on page \pageref{name}.
%%%%%%%%%%%%%%
etc...
%%%%%%%%%%%%%%
\end{document}
正如您所做,它将可选\chapter
参数放入目录中并清空页码。addtocontents
宏只是将其文本放入目录中,目录基本上是章节名称加上章节开始的页码;这是通过标准\label
和\pageref
机制获得的。
您可能需要更改代码以适合您的特定字体、工作风格和其他要求(请参阅@DavidCarlisle 的评论)。