使用 sloppypar 避免新段落缩进

使用 sloppypar 避免新段落缩进

我通常会写一个等式,后面跟着一些这样的文字:

  \begin{equation}
     2+1
  \end{equation}
  where...

在这种情况下,where 子句不会缩进。

现在,我需要在带有 where 子句的段落中使用 sloppypar,因为否则内联数学公式将会进入边距,如下所示:

  \begin{equation}
    2+1
  \end{equation}
  \begin{sloppypar}
    where...
    \end{sloppypar}

问题是,当我这样做时,段落会缩进,就像一个新段落一样。如何避免这种情况?

答案1

环境sloppypar基本上定义为

\newenvironment{sloppypar}{\par\sloppy}{\par}

只需定义一个新环境,省略在这种情况下和类似情况下要使用的首字母\par(即,在数学显示之后)。

\documentclass[draft]{article}

\newenvironment{sloppypar*}
 {\sloppy\ignorespaces}
 {\par}

\begin{document}

Some normal paragraph, with text running smooth for justification.
Some normal paragraph, with text running smooth for justification.
Some normal paragraph, with text running smooth for justification.
Some normal paragraph, with text running smooth for justification.
\begin{equation}
    2+1
\end{equation}
\begin{sloppypar*}
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
\end{sloppypar*}

Some normal paragraph, with text running smooth for justification.
Some normal paragraph, with text running smooth for justification.
Some normal paragraph, with text running smooth for justification.
Some normal paragraph, with text running smooth for justification.
\begin{equation}
    2+1
\end{equation}
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$
here many long formulas $aaaaaaaa$ $bbbbbbbb$ $ccccccccccccc$ $dddddddddddddd$

\end{document}

在此处输入图片描述

答案2

这并不优雅,但在 \begin{sloppypar} 之后添加 \noindent 可以解决问题!

相关内容