我一直在寻找以下问题的解决方案: - 如何更改目录 (TOC) 的字体大小(例如简介、第 1 章等...),我尝试了很多命令,但都没有用,
以下命令不起作用:
\renewcommand\cftchapfont{\fontsize{12}{12}\selectfont}
\renewcommand\cftsecfont{\fontsize{12}{12}\selectfont}
我正在用报告类和包来写作
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{tocloft}
希望尽快收到任何人的回复。
代码如下:
\documentclass[a4paper,12pt]{report}
%% Include packages
\usepackage{times} % timesnew roman font type setting
\usepackage{titling} %
%\usepackage{indentfirst}
\usepackage{setspace} % Line spaceing
\usepackage{titlesec} % centering titles
\usepackage{sectsty}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{tocloft}
\usepackage{lipsum}
%%
%% For paragraph indent
\setlength{\parindent}{4em} % Paragraph indent
%%%%%%
\renewcommand\cftchapfont{\fontsize{12}{12}\selectfont}
\renewcommand\cftsecfont{\fontsize{20}{12}\selectfont}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{section}} %% Similarly for subsection, figure... as you wish
\renewcommand{\cftdot}{}
\renewcommand{\cftchapfont}{\fontsize{12}{12}}
\renewcommand\cftsecfont{\fontsize{12}{12}\selectfont}
%%%%%
\makeatletter
\renewcommand{\@chapapp}{\fontsize{43}{0}\selectfont Chapter}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\input{titlepage} % Title page
%\clearpage\mbox{}\clearpage % for the blank page
\thispagestyle{empty}
\vspace*{\fill}
{ \centering THIS PAGE IS INTENTIONALLY LEFT BLANK.\par} % For intentionally left blank
\vspace{\fill}
\newpage
\pagenumbering{roman}
\begin{center}
Geometrical Effect on the Energetic Size Effect Law\\
\vspace{7mm}
by\\
\vspace{7mm}
\vspace{7mm}
Submitted to the Department of Mechanical Engineering\\
On September 21, 2017 in Partial Fulfillment of the Requirements for the\\
\end{center}
\input{abstract} % Abstract
\newpage
\begin{flushleft}
Acknowledgement
\end{flushleft}
\par
I would like to thank so many. xxxxxxx.\newpage
%Table of Contents
\hypersetup{hidelinks}
\tableofcontents
%\newpage
%\listoffigures
%\newpage
%\listoftables
%\newpage
%\listofAcronyms
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{0pt}{\huge}
\titlespacing*{\chapter}{0pt}{200pt}{40pt}
\include{chapter_one}
\chapter{exp}
\chapter{\fontsize{43}{1}\selectfont exp2}\clearpage
\section{example}
\chapter{\fontsize{43}{1}\selectfont hey}\clearpage
\chapter{\fontsize{43}{1}\selectfont Final}\clearpage
\section{finale}
\end{document}
谢谢,
答案1
问题是,所有字体大小语句都缺少单位。下面将章节标题设置为 43pt 大小的 Times 字体。目录条目的大小为 12 pt。
\documentclass[a4paper,12pt]{report}
%% Include packages
%\usepackage{times}% Obsolete for years
\usepackage{tgtermes} %
\usepackage{titling} %
%\usepackage{indentfirst}
\usepackage{setspace} % Line spaceing
\usepackage{titlesec} % centering titles
\usepackage{sectsty}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{tocloft}
\usepackage{lipsum}
%%
%% For paragraph indent
\setlength{\parindent}{4em} % Paragraph indent
%%%%%%
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{section}} %% Similarly for subsection, figure... as you wish
\renewcommand{\cftdot}{}
\begin{document}
\hypersetup{hidelinks}
\tableofcontents
\titleformat{\chapter}[display]
{\normalfont\fontsize{43pt}{50pt}\selectfont\bfseries\centering}{\chaptertitlename\ \thechapter}{0pt}{}
\titlespacing*{\chapter}{0pt}{200pt}{40pt}
\include{chapter_one}
\chapter{Capybara}
\chapter{Wombat}
\section{Ant}
\chapter{Bee}\clearpage
\chapter{Termite}\clearpage
\section{Duck}
\end{document}