定理环境之后 对齐环境之前 神秘的垂直空间

定理环境之后 对齐环境之前 神秘的垂直空间

关于定理和对齐环境前后的跳过控制有很多问题,请看,使用定理环境 hack 的解决方案对齐环境的通用解决方案然而意想不到的神秘Skip又回来了。

作为 MWE,我们可以使用给定的 MWE 的混合这里这里

只有白棋\hrule才能稍微改善这种情况,但是这种解决方案有点丑陋。

问题是如何简单合理的避免出现意外跳过?

以下是 MWE:

MisteriousSkip.tex

\documentclass[11pt,a4paper]{report}

\usepackage{amsmath,amssymb,amsthm,xpatch}

\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt plus 0pt minus 0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\makeatletter
\xpatchcmd{\proof}{\topsep6\p@\@plus6\p@\relax}{}{}{}
\makeatother

\begin{document}
    \setlength{\abovedisplayskip}{0pt}%
    \setlength{\belowdisplayskip}{0pt}%
    \setlength{\abovedisplayshortskip}{0pt}%
    \setlength{\belowdisplayshortskip}{0pt}%
Some normal text goes here, with a lemma immediately below.
\begin{lemma}
This is the statement of the lemma.
\end{lemma}
%\hrule % if we \hrule, the skip becomes smaller!
\begin{align*}
x_1+x_2+x_3+x_4 &\leq 10 \\
x_5+x_5         &\leq 8 \\
x_7+x_8         &\leq 5 
\end{align*}
\begin{proof}
This is the proof of the lemma, with a mysterious space above.
\end{proof}
Some normal text goes here, with a mysterious space above. \par
The next paragraph comes immediately below.

\end{document}

MysteriousSkip.pdf 的截图如下:

在此处输入图片描述

答案1

由于align是证明的一部分,因此请将其包含在该环境中。此外,建议不是用一个方程开始证明,特别是因为设置 - 它Proof.默认设置,必然将对齐放在下一行。相反,在它之前添加一些非正式的描述性文本:

在此处输入图片描述

\documentclass{report}

\usepackage{amsmath,amsthm}

\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\AtBeginDocument{%
  \setlength{\abovedisplayskip}{0pt}%
  \setlength{\belowdisplayskip}{0pt}%
  \setlength{\abovedisplayshortskip}{0pt}%
  \setlength{\belowdisplayshortskip}{0pt}%
}

\begin{document}
Some normal text goes here, with a lemma immediately below.

\begin{lemma}
This is the statement of the lemma.
\end{lemma}
\begin{proof}
It is possible to derive the following:
\begin{align*}
  x_1 + x_2 + x_3 + x_4                        &\leq 10 \\
                         x_5 + x_6             &\leq 8 \\
                                    x_7 + x_8  &\leq 5 
\end{align*}
This is the proof of the lemma, with a mysterious space above.
\end{proof}

Some normal text goes here, with a mysterious space above.

The next paragraph comes immediately below.

\end{document}

答案2

这不是跳过。在 TeX 中,如果您无法使用显示数学开始一个段落,如果您尝试这样做,则会生成一个仅由缩进和 parfillskip 组成的虚假白色段落。这不仅看起来像额外的垂直空间,而且是段落行而不是垂直空间,如果分页符发生在该点,它也不会被丢弃。

如果你添加一些文本,你就可以看到这一点

\documentclass[11pt,a4paper]{report}

\usepackage{amsmath,amssymb,amsthm,xpatch}

\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt plus 0pt minus 0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\makeatletter
\xpatchcmd{\proof}{\topsep6\p@\@plus6\p@\relax}{}{}{}
\makeatother

\begin{document}
    \setlength{\abovedisplayskip}{0pt}%
    \setlength{\belowdisplayskip}{0pt}%
    \setlength{\abovedisplayshortskip}{0pt}%
    \setlength{\belowdisplayshortskip}{0pt}%
Some normal text goes here, with a lemma immediately below.
\begin{lemma}
This is the statement of the lemma.
\end{lemma}
%\hrule % if we \hrule, the skip becomes smaller!
xxx
\begin{align*}
x_1+x_2+x_3+x_4 &\leq 10 \\
x_5+x_5         &\leq 8 \\
x_7+x_8         &\leq 5 
\end{align*}
\begin{proof}
This is the proof of the lemma, with a mysterious space above.
\end{proof}
Some normal text goes here, with a mysterious space above. \par
The next paragraph comes immediately below.

\end{document}

在此处输入图片描述

显示屏没有移动,但其上方的一行段落现在有可见的文本。

解决方法是写一些有意义的东西来代替,或者将引理内部xxx移动align

在此处输入图片描述

\documentclass[11pt,a4paper]{report}

\usepackage{amsmath,amssymb,amsthm,xpatch}

\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt plus 0pt minus 0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\makeatletter
\xpatchcmd{\proof}{\topsep6\p@\@plus6\p@\relax}{}{}{}
\makeatother

\begin{document}
    \setlength{\abovedisplayskip}{0pt}%
    \setlength{\belowdisplayskip}{0pt}%
    \setlength{\abovedisplayshortskip}{0pt}%
    \setlength{\belowdisplayshortskip}{0pt}%
Some normal text goes here, with a lemma immediately below.
\begin{lemma}
This is the statement of the lemma.
\begin{align*}
x_1+x_2+x_3+x_4 &\leq 10 \\
x_5+x_5         &\leq 8 \\
x_7+x_8         &\leq 5 
\end{align*}
\end{lemma}
\begin{proof}
This is the proof of the lemma, with a mysterious space above.
\end{proof}
Some normal text goes here, with a mysterious space above. \par
The next paragraph comes immediately below.

\end{document}

相关内容