当使用 0 长度\parindent
和可扩展长度时\parskip
,我感觉部分标题后的空间太大(见示例)。我是否应该使用其他命令来减少部分标题后的垂直空间,或者我是否应该使用完全不同的方法来实现我想要的效果?
\documentclass[a4paper, twoside, 11pt, onecolumn]{article}
\usepackage{sectsty}
\begin{document}
\allsectionsfont{\sffamily}
\section{Lorem ipsum}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse mollis
ultricies porttitor. Mauris iaculis dignissim magna, sit amet viverra enim
feugiat consectetur. Ut at mauris in felis congue mattis. Nam molestie mattis
erat sit amet eleifend. Nulla volutpat ornare quam.
Pellentesque at varius libero. Nunc quis nunc eget elit congue pulvinar non
sagittis turpis. Fusce mauris lorem, euismod accumsan sollicitudin dictum,
adipiscing dignissim tortor. Aliquam commodo cursus sapien placerat
volutpat. Mauris dignissim sem vitae magna fringilla hendrerit.
\setlength{\parindent}{0 em}
\setlength{\parskip}
{1 \baselineskip plus 0.2 \baselineskip minus 0.2 \baselineskip}
\section{Dolor sit}
Phasellus non odio nec arcu aliquam cursus. Integer at sem id magna
lobortis ultrices. Morbi sed lacus neque, vitae aliquet massa. Aliquam vel
ligula orci. Nam at velit libero. Vivamus ac commodo velit. Mauris cursus
ultricies sapien et egestas. Donec non augue ut nisi luctus pretium.
Vivamus laoreet varius lacus at feugiat. Phasellus condimentum tincidunt
egestas. Aenean eu aliquam sem.
Cras libero nunc, mattis quis aliquet vel, faucibus fringilla nibh. Etiam
commodo sem et arcu eleifend tincidunt. Maecenas pulvinar odio id turpis
feugiat ac sollicitudin nulla sollicitudin. Pellentesque habitant morbi
tristique senectus et netus et malesuada fames ac turpis egestas. Quisque
non felis ligula, in interdum justo.
\end{document}
答案1
这是一个相当普遍的问题,因为\parskip
当存在\par
某个地方时,总是会使用。这通常会产生非常奇怪的副作用,在环境和数学公式之后也是如此。
这memoir
类有一个特殊的长度,称为\abnormalparskip
,可用于在段落之间引入空格,而不是在每个其他对象之后引入空格。它并不完美,但要好得多。
答案2
还有一些包支持设置长度的用户界面。但是,您也可以覆盖现有的定义,例如section
(可以在 article.cls 中找到):
\documentclass[a4paper, twoside, 11pt, onecolumn]{article}
\usepackage{sectsty}
\setlength{\parindent}{0 em}
\setlength{\parskip}
{1 \baselineskip plus 0.2 \baselineskip minus 0.2 \baselineskip}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{0.2ex \@plus.1ex}% <=== space after
{\normalfont\Large\bfseries}}
\makeatother
\begin{document}
\allsectionsfont{\sffamily}
\section{Lorem ipsum}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse mollis
ultricies porttitor. Mauris iaculis dignissim magna, sit amet viverra enim
feugiat consectetur. Ut at mauris in felis congue mattis. Nam molestie mattis
erat sit amet eleifend. Nulla volutpat ornare quam.
\end{document}