enumitem 和段落间距:parskip 之间为空行,常规换行之间为无线条

enumitem 和段落间距:parskip 之间为空行,常规换行之间为无线条

我本质上想在列表和段落之间设置两个间距,用于两个不同的目的。如果列表位于段落中间,则使用常规行距。如果列表是段落的最后一部分,则在列表前使用常规行距,在列表后使用段落间距。我想通过使用空白行来实现此行为,就像我进行正常的段落输入一样。请参阅下面的 MWE,它描述了我想要实现的目标。

PS:如果这是不好的印刷习惯,请批评,但要提供理由和推荐的做法:)


\documentclass[parskip=full]{scrartcl}
%\usepackage{scrhack}% is this required with enumitem?

\usepackage{setspace}
\usepackage{enumitem}
\setlist{nosep}
\setlist[itemize]{topsep=-\parskip}


\begin{document}

\section{List embedded in paragraph}
A paragraph to demonstrate full parskip.

Here is a paragraph.
\begin{itemize}
    \item This is an item; and%
    \item this is another one.
\end{itemize}
I want to continue the pararaph, and therefore have no spacing between this line and the one above.

\section{List ending a paragraph}

\subsection{The syntax I want, but the result I do not}
Here is another paragraph.
\begin{itemize}
    \item This is an item; and
    \item this is another one, ending the paragraph.
\end{itemize}

I want to start a new paragraph, and write it in LaTeX by specifying the blank line (above), as I would for separating bodies of text.

\subsection{The result I want, but hacky syntax}
Here is another paragraph.
\begin{itemize}
    \item This is an item; and
    \item this is another one, ending the paragraph.
\end{itemize}

\vspace{\parskip}
Unfortunately I have to use vspace. Is it possible to automatically detect the blank line so I don't have to use vspace?

Bonus: is it possible to achieve this result for a blank line above a list? i.e. if there is a blank line, use paragraph spacing before the list?

\end{document} 

相关内容