章节格式

章节格式

我使用报告文档类,我想删除第 x 章短语,在章节标题前添加章节编号,并删除章节名称和页面顶部之间的空白处。例如,通常是这样的:

top of page
blank place
blank place
Chapter 1
Title of chapter
content

最好是这样:

top of page
1. Title of chapter
content

答案1

您可以使用标题安全包;一个小例子:

\documentclass{report}
\usepackage{titlesec}

\titleformat{\chapter}[block]
  {\normalfont\huge\bfseries}{\thechapter.}{1em}{\Huge}
\titlespacing*{\chapter}{0pt}{-19pt}{0pt}

\begin{document}

\chapter{Test chapter}

\end{document}

答案2

默认生成章节标题(以及最终的样子)的宏bookreport文档类别是\@makechapterhead(我添加了一些评论/描述符):

\def\@makechapterhead#1{%
  \vspace*{50\p@}% <----------------- Space from top of page to Chapter #
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter% <-- Chapter #
        \par\nobreak
        \vskip 20\p@% <-------------- Space between Chapter # and title
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak% <------------------ Chapter title
    \vskip 40\p@% <------------------ Space between chapter title and first paragraph
  }}

您可以根据自己的喜好更新这些内容以修改显示内容。例如:

在此处输入图片描述

\documentclass{report}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\makeatletter
\def\@makechapterhead#1{%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \thechapter.\ % <-- Chapter # (without "Chapter")
    \fi
    \interlinepenalty\@M
    #1\par\nobreak% <------------------ Chapter title
    \vskip 40\p@% <------------------ Space between chapter title and first paragraph
  }}
\makeatother
\begin{document}
\chapter{A chapter}\lipsum[1]
\end{document}

在上面的例子中,使用showframe

相关内容