我正在寻找一个可以像 parskip 包一样控制段落间距的环境,例如
\begin{document}
Here's a paragraph with regular indentation.
Another, etc.
\begin{parskip}
The paragraphs in this block
will have single space and no indent,
and will not have weird spacing issues with lists.
\end{parskip}
\end{document}
有这样的东西吗?
答案1
您可以直接复制相关更改形式parskip.sty
并将其包装在环境中。我将其命名为Parskip
(大写P
!),因为\parskip
已经定义为长度,因此不能有名为parskip
(小写p
) 的环境。
\documentclass{article}
\makeatletter
\newenvironment{Parskip}{%
\par
\parskip=0.5\baselineskip \advance\parskip by 0pt plus 2pt
\parindent=\z@
\def\@listI{\leftmargin\leftmargini
\topsep\z@ \parsep\parskip \itemsep\z@}
\let\@listi\@listI
\@listi
\def\@listii{\leftmargin\leftmarginii
\labelwidth\leftmarginii\advance\labelwidth-\labelsep
\topsep\z@ \parsep\parskip \itemsep\z@}
\def\@listiii{\leftmargin\leftmarginiii
\labelwidth\leftmarginiii\advance\labelwidth-\labelsep
\topsep\z@ \parsep\parskip \itemsep\z@}
\partopsep=\z@
}{\par}
\makeatother
\usepackage{lipsum}%just for demonstration
\begin{document}
Here's a paragraph with regular indentation.
\lipsum[1-3]
\begin{Parskip}
The paragraphs in this block will have single space and no indent
and will not have weird spacing issues with lists.
\lipsum[2]
\begin{itemize}
\item One
\item Two
\item Three
\end{itemize}
\lipsum[3-4]
\end{Parskip}
\lipsum[2]
\begin{itemize}
\item One
\item Two
\item Three
\end{itemize}
\lipsum[3-4]
\end{document}
\makeatletter
/-是作为宏名称的一部分other
来激活或取消激活。我曾经为这个演示添加了一些文本,但这对于您的实际文档来说并不是必需的。@
lipsum