以下是 MWE:
\documentclass[a4paper]{article}
\usepackage[adobefonts]{ctex}
\usepackage{tocloft}
\usepackage{titlesec}
\begin{document}
\title{Hello, \LaTeX !}
\author{[email protected]}
\date{\today}
\maketitle
\renewcommand{\cftsecfont}{\tiny\heiti}
\renewcommand{\cftsubsecfont}{\tiny\heiti}
\tableofcontents
\section{\Huge\heiti Hello, Section!}
Google is a great company!
\subsection{\huge\heiti Hello, SubSection!}
tex.stackoverflow.com is a good site!
\end{document}
结果表明\cftsecfont
,即使我将字体大小设置为微小的。
为何以及如何?
答案1
绝不将手动格式化命令放入诸如 等命令的参数中。\title
格式化\section
应与内容分开。节的名称是内容。用于排版节标题的大小和字体是格式,不应放在 的参数中\section{}
。形式和内容应该区分。
\documentclass[a4paper]{article}
% \usepackage[adobefonts]{ctex}
\let\heiti\sffamily
\usepackage{tocloft}
\usepackage{titlesec}
\titleformat*{\section}{\Huge\heiti}
\titleformat*{\subsection}{\huge\heiti}
\begin{document}
\title{Hello, \LaTeX !}
\author{[email protected]}
\date{\today}
\maketitle
\renewcommand{\cftsecfont}{\tiny\heiti}
\renewcommand{\cftsubsecfont}{\tiny\heiti}
\tableofcontents
\section{Hello, Section!}
Google is a great company!
\subsection{Hello, SubSection!}
tex.stackoverflow.com is a good site!
\end{document}