我在这里找到了这个问题的答案:减少引文和标题之间的间距。但由于某种原因,结果高度依赖于代码格式,因此容易出错,如下例所示:
\documentclass{article}
\usepackage{setspace}
\doublespacing
\usepackage{etoolbox}
\BeforeBeginEnvironment{quotation}{\begin{singlespace*}}
\AfterEndEnvironment{quotation}{\end{singlespace*}}
\begin{document}
double double double double double double double double double double double double double double double double double double double double double double double
\begin{quotation}
quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote
\end{quotation}
single single single single single single single single single single single single single single single single single single single single single single single single
\begin{quotation}
quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote
\end{quotation}
\end{document}
“双”段落的间距与“单”段落的间距不同(前者按预期双倍行距,而后者单倍行距)。这是 etoolbox 中的错误还是我犯了一个错误?
答案1
为了有适当的基线跳过,您需要结束该段落:
\BeforeBeginEnvironment{quotation}{\par\begin{singlespace*}}
完整示例:
\documentclass{article}
\usepackage{setspace}
\doublespacing
\usepackage{etoolbox}
\BeforeBeginEnvironment{quotation}{\par\begin{singlespace*}}
\AfterEndEnvironment{quotation}{\end{singlespace*}\par}
\begin{document}
double double double double double double double double double double double double double double double double double double double double double double double
\begin{quotation}
quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote
\end{quotation}
single single single single single single single single single single single single single single single single single single single single single single single single
\begin{quotation}
quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote
\end{quotation}
\end{document}