为 \part 页面添加样式

为 \part 页面添加样式

我使用\part来定义我的“书”的各个部分。问题是,该部分占据了整整一页。我使用\documentclass[12pt]{book}

我希望\part以某种方式对其进行样式设计,使其看起来像fncychap样式Conny但不占用整个页面。

我怎样才能做到这一点?

答案1

这是使用titlesec包。我把\part和的chapter样式做得相同,并粗略地模仿了Conny样式。您可能不想完全这样做,但这应该足以让您入门。

\documentclass{book}
\usepackage{lipsum}% for dummy text
\usepackage{titlesec}

\titleclass{\part}{top} % make part like a chapter
\titleformat{\part}
[display]
{\centering\normalfont\Huge\bfseries}
{\titlerule[5pt]\vspace{3pt}\titlerule[2pt]\vspace{3pt}\MakeUppercase{\partname} \thepart}
{0pt}
{\titlerule[2pt]\vspace{1pc}\huge\MakeUppercase}
%
\titlespacing*{\part}{0pt}{0pt}{20pt}
%
\titleclass{\chapter}{straight} % make chapter like a section (no newpage)
\titleformat{\chapter}
[display]
{\centering\normalfont\Huge\bfseries}
{\titlerule[5pt]\vspace{3pt}\titlerule[2pt]\vspace{3pt}\MakeUppercase{\chaptertitlename} \thechapter}
{0pt}
{\titlerule[2pt]\vspace{6pt}\huge\MakeUppercase}

\titlespacing*{\chapter}{0pt}{0pt}{40pt}



\begin{document}
\part{A part}
\chapter{A chapter}
\lipsum[1-2]
\end{document}

代码输出

相关内容