自定义章节样式的间距问题

自定义章节样式的间距问题

我自定义了章节样式,例如(book类):

在此处输入图片描述

章节标题 ( 1 row) 和行之间留出更多空间

在此处输入图片描述

章节标题 ( 2 or more rows) 和行之间的间距较小

如何解决这个问题呢?

代码:

\usepackage{titlesec,microtype}

\newcommand{\thicktitlerule}{\titlerule[0.5 ex]}
\titleformat{\chapter}[display]
 { \vspace{ -1 em } \large } %\normalsize
 {\flushright \sffamily {\chaptNum\thechapter \vspace{1 ex}} \\\thicktitlerule}
 {-24 pt}
 {\titlerule\vspace{1 ex} \flushright \huge \bfseries}  
 [\vspace{1ex}] %\vspace{.2 em} \titlerule \vspace{0.5 em}

\titleformat{name=\chapter,numberless}[display]
 {\vspace{ -1 em } \bfseries \normalsize}
 {\makebox[\textwidth]{\thicktitlerule}}
 {-2 pt}
 {\titlerule\vspace{1 ex}\flushright \huge}  
 [\vspace{1ex}]

答案1

我想这就是你想要的。

\newcommand{\thicktitlerule}{\titlerule[0.5 ex]}

\titleformat{name=\chapter,numberless}[display]
{\bfseries\Large}
{}
{0ex}
{\thicktitlerule
\vspace{1pt}%
\titlerule
\vspace{2ex}%
\filleft\huge}
[\vspace{2ex}%
]

\titleformat{\chapter}[display]
{\bfseries\Large}
{\filleft\Huge\sffamily\thechapter }
{1ex}
{\thicktitlerule
\vspace{1pt}
\titlerule
\vspace{2ex}%
\filleft\huge}
[\vspace{2ex}%
]

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

要进一步调整间距,请输入

\titlespacing{\chapter}{0pt}{0pt}{3cm}
\titlespacing{name=\chapter,numberless}{0pt}{22pt}{3cm}

在序言中并根据您的喜好进行调整。

代码:

\documentclass{book}
\usepackage{titlesec,microtype,showframe}

\newcommand{\thicktitlerule}{\titlerule[0.5 ex]}

\titleformat{name=\chapter,numberless}[display]
{\bfseries\Large}
{}
{0ex}
{\thicktitlerule
\vspace{1pt}%
\titlerule
\vspace{2ex}%
\filleft\huge}
[\vspace{2ex}%
]

\titlespacing{name=\chapter,numberless}{0pt}{22pt}{3cm}

\titleformat{\chapter}[display]
{\bfseries\Large}
{\filleft\Huge\sffamily\thechapter }
{1ex}
{\thicktitlerule
\vspace{1pt}
\titlerule
\vspace{2ex}%
\filleft\huge}
[\vspace{2ex}%
]
\titlespacing{\chapter}{0pt}{0pt}{3cm}
\begin{document}
  \chapter{Introduction}
  \chapter{Particles interaction with multiphase fluid and the applications}
  \chapter*{Introduction}
  \chapter*{Particles interaction with multiphase fluid and the applications}
\end{document}

相关内容