请考虑以下示例:
\documentclass{article}
\newenvironment{eparskip} {
\parindent0pt
\setlength{\parskip}{1em}
}{
\vspace{1em}
}
\begin{document}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not
The paragraphs in this block will have single space and no indent, and will not
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not have weird spacing issues.
\end{eparskip}
\end{document}
生成结果:
我知道调整参数会招致一些非议parskip
,但 parskip 包本身也会出现这种情况。有解决方案吗?
答案1
第三个例子以
<space><space>\vspace{1em}<bookkeeping business><space>\par
由<bookkeeping business>
完成\end{eparskip}
且与问题无关。
相关的是,之前的水平空格\vspace
不会被删除,而是成为段落中的第三行。
它们从哪里来的?第一个来自环境定义中的 之后的行尾not
;第二个来自环境定义中的 之前的行尾\vspace
。还有一个来自 之后的行尾\end{eparskip}
,它位于\par
空行生成的 之前。这个被 删除\par
,其他的没有。
\documentclass{article}
\newenvironment{eparskip}
{\par\setlength{\parindent}{0pt}\setlength{\parskip}{1em}}
{\par\vspace{1em}}
\begin{document}
\begin{eparskip}
The paragraphs in this block will have single space and no
indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no
indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not
The paragraphs in this block will have single space and no indent, and will not
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no
indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no
indent, and will not have weird spacing issues.
\end{eparskip}
\end{document}
注意定义中的行尾;还要确保\vspace
发布之间段落,除非您有特殊需要。
答案2
多余的行包含您在环境定义中添加的虚假空格。删除它们,您将得到:
\documentclass{article}
\newenvironment{eparskip} {%
\parindent0pt
\setlength{\parskip}{1em}%
}{%
\par
\vspace{1em}
}
\begin{document}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not
The paragraphs in this block will have single space and no indent, and will not
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not have weird spacing issues.
\end{eparskip}
\begin{eparskip}
The paragraphs in this block will have single space and no indent, and will not have weird spacing issues.
\end{eparskip}
\end{document}