如何将部分标题放在纸张顶部

如何将部分标题放在纸张顶部

如何放置部分标题(如章节标题)book班上

梅威瑟:

\documentclass{book}
\usepackage{lipsum}
\usepackage{titlesec}
\titleclass{\part}{top}
\titleformat{\part}[display]{}
{\huge\bfseries Part \thepart} 
{8pt}
{\Huge\scshape}
\pagestyle{plain}
\begin{document}
\part{This is a part}
This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. 
\newpage
\lipsum[1-10]
\end{document}

但是,间距太大——部分标题没有出现在页面顶部,而是出现在(靠近)中心。

在此处输入图片描述

这就是我所寻找的,以最肮脏的方式编码:

\documentclass{book}
\usepackage{lipsum}
\pagestyle{plain}
\begin{document}
\noindent{\huge\bfseries Part 1}\\[8pt]
{\Huge\scshape This is a part}\par\vspace{2cm}
This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. 
\newpage 
\lipsum[1-10]
\end{document}

在此处输入图片描述

我看过如何在 \part 后写入文本例如,但所有的答案都不能帮助我。我必须使用book,并且我的描述可能包含两个或更多短段落,甚至包含一些图形,因此宏不适用。

答案1

你可以加\titlespacing

\documentclass{book}
\usepackage{lipsum}
\usepackage{showframe}% MWE only

\usepackage{titlesec}
\titleclass{\part}{top}
\titleformat{\part}[display]{\pagestyle{plain}\hrule height0pt}% to prevent extra blank line
{\huge\bfseries Part \thepart} 
{0pt}% distance between Part and title (plus normal spacing)
{\Huge\scshape}
\titlespacing*{\part}{0pt}{-\topskip}{2cm}% distance before text

\begin{document}
\part{This is a part}
This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. This is a short description text. 
\newpage
\lipsum[1-10]
\end{document}

相关内容