下面的 MWE 表明,尽管我采用了自定义标题中的一致行距。
此 MWE 与链接的问题/答案中提供的 MWE 之间的有意义区别在于包含setspace
和parskip
。我最初通过使用两种不同的点大小来解决这个问题,但这限制了我的最小分离距离,而且它不是最优雅的解决方案,所以我想正确地解决这个问题,即使这意味着我不应该使用这些包(但如果是这种情况,我希望得到一些帮助来弄清楚为什么会这样,这样我就可以尝试弄清楚我是否可以使用 renew 命令修复不兼容性,或者我是否必须在共享此 cls 文件的所有文档中删除这两个包提供的所有命令)。
\documentclass{report}
\usepackage{setspace}
\usepackage{parskip}
% CONFIGURE PAGE AND PERIOD SPACING
\onehalfspacing
%\doublespacing
%\singlespacing
\frenchspacing
% CONFIGURE HYPHEN RESTRICTION CRITERION
\righthyphenmin=6
\lefthyphenmin=6
\usepackage[small,md,explicit]{titlesec}
\makeatletter
%http://zoonek.free.fr/LaTeX/LaTeX_samples_chapter/0.html
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}%
\def\@makechapterhead#1{%
{ \begin{singlespacing}%
\parindent \z@ \centering \reset@font%
\thickhrulefill\quad%
\large \bfseries \@chapapp{} \thechapter%
\quad \thickhrulefill%
\par\nobreak%
\vspace*{6\p@}%
\interlinepenalty\@M%
\hrule%
\vspace*{2\p@}%
\Large \bfseries \strut#1\strut\par\nobreak%
\par\nobreak%
\vspace*{2\p@}%
\hrule%
\vskip 20\p@%
\end{singlespacing}%
}}%
\def\@makeschapterhead#1{%
{ \begin{singlespacing}%
\parindent \z@ \centering \reset@font%
\thickhrulefill%
\par\nobreak%
\vspace*{6\p@}%
\interlinepenalty\@M%
\hrule%
\vspace*{2\p@}%
\Large \bfseries \strut#1\strut \par\nobreak%
\par\nobreak%
\vspace*{2\p@}%
\hrule%
\vskip 20\p@%
\end{singlespacing}%
}}%
\makeatother
\begin{document}
\chapter{Text Here for Chapter Title}
\end{document}
更新:关于不对称
将以下内容替换为章节标题应该会重现不一致的间距。我将使用短标题,这样对称性就不会因标题行之间的间距而变得复杂。Strut 在这里似乎非常有必要,以确保这些行是一致的,但当将同样的逻辑应用于绘制水平线之前的最后一行上的悬挂字符时,它看起来很奇怪。我会演示。
答案1
这是使用 的版本titlesec
。在标题中,我们将 make \parskip
as 0.0pt plus 1.0pt
(如果没有包就会是这种情况parskip
)。parskip
将其更改为6.0pt plus 2.0pt
。
\documentclass{report}
\usepackage{setspace}
\usepackage{parskip}
% CONFIGURE PAGE AND PERIOD SPACING
\onehalfspacing
%\doublespacing
%\singlespacing
\frenchspacing
% CONFIGURE HYPHEN RESTRICTION CRITERION
\righthyphenmin=6
\lefthyphenmin=6
\usepackage{titlesec}
\makeatletter
%http://zoonek.free.fr/LaTeX/LaTeX_samples_chapter/0.html
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}%
\makeatother
\titleformat{\chapter}[display]
{\filcenter\bfseries\Large\singlespacing\setlength{\parskip}{0.0pt plus 1.0pt}}
{\thickhrulefill{\quad\large\bfseries\chaptertitlename{} \thechapter\quad} \thickhrulefill}
{6pt}
{\titlerule%
\vspace{2pt}%
}
[\vspace{2pt}%
\titlerule]
\titleformat{name=\chapter,numberless}[display]
{\filcenter\bfseries\Large\singlespacing\setlength{\parskip}{0pt}}
{\thickhrulefill}
{6pt}
{\titlerule%
\vspace{2pt}%
}
[\vspace{2pt}%
\titlerule]
\titlespacing*{\chapter} {0pt}{50pt}{20pt}
\begin{document}
\chapter{Text Here for Chapter Title Text Here for Chapter Title Text Here for Chapter Title}
Some text for this chapter. Some text for this chapter. Some text for this chapter. Some text for this chapter.
\chapter*{Some un numbered chapter Some un numbered chapter Some un numbered chapter}
Some text for this chapter. Some text for this chapter. Some text for this chapter. Some text for this chapter.
\end{document}
与您的版本相同。
\documentclass{report}
\usepackage{setspace}
\usepackage{parskip}
% CONFIGURE PAGE AND PERIOD SPACING
\onehalfspacing
%\doublespacing
%\singlespacing
\frenchspacing
% CONFIGURE HYPHEN RESTRICTION CRITERION
\righthyphenmin=6
\lefthyphenmin=6
\usepackage[small,md,explicit]{titlesec}
\makeatletter
%http://zoonek.free.fr/LaTeX/LaTeX_samples_chapter/0.html
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}%
\def\@makechapterhead#1{%
{ \begin{singlespacing}%
\setlength{\parskip}{0.0pt plus 1.0pt}%
\parindent \z@ \centering \reset@font%
\thickhrulefill\strut\quad%
{\large \bfseries \@chapapp{} \thechapter}%
\quad \thickhrulefill%
\par\nobreak%
\vspace*{6\p@}%
\interlinepenalty\@M%
\hrule%
\vspace*{2\p@}%
\Large \bfseries \strut#1\strut\par\nobreak%
\par\nobreak%
\vspace*{2\p@}%
\hrule%
\vskip 20\p@%
\end{singlespacing}%
}}%
\def\@makeschapterhead#1{%
{ \begin{singlespacing}%
\setlength{\parskip}{0.0pt plus 1.0pt}%
\parindent \z@ \centering \reset@font%
\strut\thickhrulefill%
\par\nobreak%
\vspace*{6\p@}%
\interlinepenalty\@M%
\hrule%
\vspace*{2\p@}%
\Large \bfseries \strut#1\strut \par\nobreak%
\par\nobreak%
\vspace*{2\p@}%
\hrule%
\vskip 20\p@%
\end{singlespacing}%
}}%
\makeatother
\begin{document}
\chapter{Text Here for Chapter Title Text Here for Chapter Title Text Here for Chapter Title}
Some text for this chapter. Some text for this chapter. Some text for this chapter. Some text for this chapter.
\chapter*{Some un numbered chapter Some un numbered chapter Some un numbered chapter}
Some text for this chapter. Some text for this chapter. Some text for this chapter. Some text for this chapter.
\end{document}
注意:由于您正在\thickhrulefill
使用 来定义1ex
,因此诸如 之类的字体大小命令\large
将影响线条的粗细。因此,不要忘记在定义中使用括号来限制这些命令的范围,例如 `{\large...}。