我在换行时遇到了有关项目两行之间间距的问题。
以下是 MWE:
\documentclass[a4paper, 12pt]{article}
\begin{document}
\noindent
Some text some text some text some text some text some text some text.
Some wrapped text some wrapped text some wrapped text some wrapped text:
\begin{enumerate}
\item Some other text some other text some other text some other text some other text some other text.
Here lies the problem.
\item Some other text some other text some other text some other text some other text some other text.
\end{enumerate}
Some boring text again some boring text again some boring text again.
\end{document}
输出结果如下:
可以看出,顶部文本行之间的垂直空间与第一项行之间的垂直空间不同。
我可以通过使用enumitem
包和设置来修复它parsep=0pt
,但这样做也会改变两个项目之间的间距,这是由给出的\itemsep + \parsep
,我不想要这样。
另一种方法是使用命令在换行前设置负垂直空间\vspace{}
,但我无法找到要删除的正确垂直空间值,而且我觉得有点草率。
如何通过保持所有其他间距相同来获得项目换行的正确行距?
谢谢您抽出时间,我们非常感激。
答案1
您可以设置\parsep
为 0pt,并增加 的值,\itemsep
使其大于 \parsep 的默认值(5pt)。还可以在列表内添加段落缩进。使用 包,这一切都很容易实现enumitem
。
\documentclass[a4paper, 12pt]{article}
\usepackage{enumitem}
\begin{document}
\noindent
Some text some text some text some text some text some text some text.
Some wrapped text some wrapped text some wrapped text some wrapped text some wrapped text:
\begin{enumerate}[parsep = 0pt, listparindent=1em, itemsep=10pt]
\item Some other text some other text some other text some other text some other text some other text.
A problem? What problem?
\item Some other text some other text some other text some other text some other text some other text.
\end{enumerate}
Some boring text again some boring text again some boring text again.
\begin{enumerate}
\item Some other text some other text some other text some other text some other text some other text.
Here lies the problem.
\item Some other text some other text some other text some other text some other text some other text.
\end{enumerate}
\end{document}