如何减少章节标题前的间距?

如何减少章节标题前的间距?

我想减少页面顶部和章节标题之间的垂直空间。我尝试按照说明操作,titlesec但没有成功。我尝试了以下两种设置,但没有任何变化。

第一的:

\documentclass[12pt]{report}  
\usepackage[compact]{titlesec}  
\begin{document}  
\chapter{Characters}

The origin of the group determinant begins with Richard Dedekind in the late 1800's. He began to explore the idea after studying the discriminant in a normal field [A]. He made several observations about the group determinant, but was only able to prove some of them. 

\end{document}

第二:

\documentclass[12pt]{report}  
\usepackage{titlesec}  
\titleformat{\chapter}[display]  
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}  
\titlespacing{\chapter}{0pt}{0pt}{0pt}  
\begin{document}  
\chapter{Characters}  

The origin of the group determinant begins with Richard Dedekind in the late 1800's. He began to explore the idea after studying the discriminant in a normal field [A]. He made several observations about the group determinant, but was only able to prove some of them. 

\end{document}

答案1

由于多种原因,在章节样式为 时titlesec继续使用默认宏来排版章节标题。因此\@makechapterheaddisplay

\documentclass[12pt]{report}
\usepackage{titlesec}
\titleformat{\chapter}[display]   
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}   
\titlespacing*{\chapter}{0pt}{-50pt}{40pt}
\begin{document}
\chapter{Characters}

The origin of the group determinant begins with Richard Dedekind in the late 1800's. He began to explore the idea
after studying the discriminant in a normal field [A]. He made several observations about the group determinant, but
was only able to prove some of them.

\end{document}

可以,因为\@makechapterhead在标题上方添加了 50pt 空间,并在标题后添加了 40pt 空间。

一个不同的策略可能是重新定义\@makechapterhead自己:

\documentclass[12pt]{report}

\makeatletter
\def\@makechapterhead#1{%
  %%%%\vspace*{50\p@}% %%% removed!
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\def\@makeschapterhead#1{%
  %%%%%\vspace*{50\p@}% %%% removed!
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother

\begin{document}
\chapter{Characters}

The origin of the group determinant begins with Richard Dedekind in the late 1800's. He began to explore the idea
after studying the discriminant in a normal field [A]. He made several observations about the group determinant, but
was only able to prove some of them.

\end{document}

答案2

回忆录的小更新(基于书籍,因此应该适用于两者):

简单的线条\setlength{\beforechapskip}{20pt}就像一个魔咒,不需要额外的包装。\beforechapskip被使用\chapterheadstart,而反过来又被使用,\makechapterhead\vspace{...}标题上方所示。

相关内容