答案1
我假设如果您想减少(编号)章节标题和下一节标题之间的间距,您还想减少包含章节编号和章节标题的行之间的间距。
这是一个不使用任何包的解决方案(除了etoolbox
,它允许“修补”现有的宏)。
请注意,此解决方案确实不是影响空白的数量多于章节标题。
\documentclass[12pt,a4paper]{report}
\usepackage{etoolbox} % for "\patchcmd" macro
\makeatletter
% No extra space between chapter number and chapter header lines:
\patchcmd{\@makechapterhead} {\vskip 20}{\vskip 0} {}{}
% Reduce extra space between chapter header and section header lines by 50%:
\patchcmd{\@makechapterhead} {\vskip 40}{\vskip 20}{}{}
\patchcmd{\@makeschapterhead}{\vskip 40}{\vskip 20}{}{} % for unnumbered chapters
\makeatother
\begin{document}
\setcounter{chapter}{1} % just for this example
\chapter{Background}
\section{Recurrent Neural Networks}
\end{document}
答案2
\documentclass[pdftex,12pt,a4paper]{report}
\usepackage[english]{babel}
\usepackage{titlesec}
%\titleformat{\chapter}{\bfseries\huge}{\thechapter.}{20pt}{\huge}
\titleformat{\chapter}[display] {\normalfont\Huge\bfseries}{\chaptertitlename\ \thechapter}{0pt}{\Huge}
\titlespacing{\chapter}{1cm}{2cm}{3cm}
\begin{document}
\chapter{Title of Chapter}
\section{Title of Section}
\end{document}
只需要多加一行代码。\titlespacing{\chapter}{1cm}{2cm}{3cm}
调整 1 调整左边距,调整 2 调整标题前的垂直空间,调整 3 调整标题和非分段文本之间的间隔。