不均匀的显示跳过

不均匀的显示跳过

这是对这个问题的又一次尝试。我缩小了 MWE 的范围:

\documentclass{article}
\usepackage{amsmath}
\usepackage[amsmath,standard,thmmarks]{ntheorem}

\begin{document}
Integer suscipit massa et nulla accumsan sed lacinia lacus tincidunt. Aenean nisi lacus, iaculis eu consequat in, fermentum eget urna. Proin augue lacus, euismod eu tempor vel, mollis eget quam. Donec vitae consequat nulla. In cursus sagittis diam, at tristique sem interdum pharetra.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation*}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation*}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Morbi gravida dapibus dapibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris mauris diam, faucibus vitae pretium vitae, volutpat eget velit. Aenean quis vestibulum ante. Duis enim tortor, accumsan eget hendrerit non, pellentesque vel magna. Duis eros turpis, auctor vel aliquam vitae, congue ut dolor.
\begin{equation*}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation*}
Sed a libero mi. Donec cursus dignissim quam tincidunt fermentum. Curabitur ac libero leo, non sagittis nisi. Proin sodales tincidunt ante, in aliquam justo cursus in. Nunc tempus feugiat volutpat. Phasellus porttitor dolor elementum quam suscipit tempus. Donec posuere consectetur turpis sed congue. Sed et nunc dui, sit amet viverra erat. Ut malesuada molestie quam, porta fringilla libero consequat quis.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation*}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation*}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Nullam elementum libero ut erat suscipit cursus non eget nibh. In accumsan rhoncus scelerisque. Sed vel eros et lacus tincidunt laoreet. Etiam molestie metus id tortor euismod vitae bibendum nisi rhoncus.

Pellentesque nec gravida ligula. Curabitur nibh sem, porta in suscipit non, porttitor lobortis arcu. Sed imperdiet, nisi sit amet vehicula lobortis, eros urna aliquam magna, sed auctor sem dui nec turpis. Nulla facilisi. Nam a elit lacus. Etiam vel leo ligula. Donec lectus mi, tristique at lobortis id, viverra nec felis.
\begin{equation*}
  Ax = b \quad\mbox{Uneven skips with equation* and thmmarks?}
\end{equation*}
Etiam vel felis at enim pulvinar lacinia lacinia quis ipsum. Etiam ac elementum tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque sit amet rhoncus tortor.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation*}
      Ax = b \quad\mbox{Uneven skips with equation* and thmmarks?}
    \end{equation*}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}

Nullam sollicitudin nisl ac metus malesuada fermentum. Mauris tellus arcu, porttitor et condimentum ut, commodo pellentesque justo. Nam rutrum, nunc non dictum placerat, dolor metus interdum dui, eu tincidunt libero mauris vel ante.
\begin{equation*}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation*}
Nunc placerat auctor odio, vel ullamcorper massa dapibus eu. Suspendisse luctus, erat at semper pulvinar, velit diam convallis metus, vitae aliquam nibh tortor vitae neque. Morbi venenatis eleifend sapien at pulvinar. Quisque urna leo, molestie ut consequat id, porta vitae neque. Praesent varius convallis justo id tincidunt. Duis nulla elit, euismod sit amet tincidunt ut, sodales eu felis. Phasellus rutrum bibendum urna sit amet iaculis.
\begin{equation*}
  Ax = b \quad\mbox{Uneven skips with equation* and thmmarks?}
\end{equation*}
Nullam vel velit quis nibh volutpat ullamcorper. Pellentesque tempor turpis quis massa tincidunt imperdiet. Nam lobortis, justo quis mollis faucibus, erat enim lobortis massa, sagittis egestas lacus odio sed enim. Morbi pulvinar placerat sem, eget pulvinar risus hendrerit sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed elementum faucibus mi, eget euismod magna convallis vel. Fusce egestas posuere dignissim.
\end{document}

不均匀的显示跳跃是由于ntheorem的自动结束标记放置而出现的,可以使用该thmmarks选项启用。

最后四个等式中有三个在结果文档中似乎分布不均匀。以下是带有该thmmarks选项的摘录:

在此处输入图片描述

并且没有thmmarks选项:

在此处输入图片描述

答案1

equation如果您将环境替换为 amsmath gather(无论如何,这通常是一个好主意),它似乎可以正常工作,因为 amsmath 版本的equation环境实际上不如其他 amsmath 环境工作得好,并且在其他情况下(例如加载 hyperref 时)也可能具有类似的不均匀间距。您可以通过在前言中添加以下内容来做到这一点(在加载 amsmath 和 ntheorem 之后):

\let\equation\gather
\let\endequation\endgather
\expandafter\let\csname equation*\expandafter\endcsname\csname gather*\endcsname
\expandafter\let\csname endequation*\expandafter\endcsname\csname endgather*\endcsname

编辑 1:这是使用amsmath选项的一个很好的解决方法。当不设置标记/结束标记fleqn时,往往会发生不相等的跳过(请参阅文档)。因此,重新定义的替代方法是改为生成一些空格:ntheoremntheorem\SetEndMarkequation\SetEndMark

\makeatletter
\gdef\SetEndMark#1#2{%
   \stepcounter{end#1ctr}%
   \@ifundefined{mark\thm@romannum{curr#1ctr}#1\thm@romannum{end#1ctr}}%
   {\,\relax}% EDIT: Set a thin space instead of nothing
   {#2{\csname mark\thm@romannum{curr#1ctr}#1\thm@romannum{end#1ctr}\endcsname
       \ifdim\rightmargin>\z@\hskip-\rightmargin\fi
       \hbox to 0cm{}}}}
\makeatother

编辑 2:可以使用 CTAN 提供的 1.31 版本制作不均匀跳跃ntheorem。1.32 版本可用直接来自作者包括对跳过处理的一些更改,这些更改似乎可以缓解(并可能解决)该问题。版本 1.33(尚未发布)应该包含直接修复。

答案2

\lipsum产生段落文本。如果您编译\lipsum[1]a,您将看到“a”位于新段落中。因此,您还会\parskip在公式前获得垂直空间。

通常,你不希望在方程式前有段落。因此,你也不应该在方程式前留空行。问题是如何消除方程式后的缩进?还有更多信息。

答案3

等式下方和上方的跳过取决于四个预定义的长度:

\abovedisplayskip
\abovedisplayshortskip
\belowdisplayskip
\belowdisplayshortskip

长度描述为数学模式作者:Herbert Voß(第 31 页,第 11.5.1 节)。

重要提示:amsmath无法使用此长度。amsmath始终使用\belowdisplayskip\abovedisplayskip

答案4

到目前为止还没有完整的答案。我认为,与其评论其他答案,不如以“答案”的形式进行讨论。


我认为这里的根本问题始于ntheorem包装选择thmmarks,正如@Audrey's MWE 所建议的那样:

当启用自动结束标记放置memoir时,会出现不均匀的显示跳跃。ntheorem

通过删除此选项,环境的上下跳跃equation*是合理的 - 我暂时不会取出我的标尺。我的动机源于这样一个事实:ntheorem使用此选项thmmarks可以让用户忘记如何放置定理标记在使用方程式结束环境时会起作用。因此,当thmmarks给出包选项时,ntheorem会重新定义方式\[和操作。以下是重定义\]的摘录(第 83-116 行,v1.31,2011/02/16,TeX Live 2011):ntheoremntheorem.sty

 83: \gdef\[{%
 84:   \relax\ifmmode
 85:     \@badmath
 86:   \else
 87:     \ifvmode
 88:       \nointerlineskip
 89:       \makebox[.6\linewidth]%
 90:     \fi
 91:     $$\stepcounter{end\InTheoType ctr}%
 92:       \@ifundefined{mark\thm@romannum{curr\InTheoType ctr}%
 93:         \InTheoType\thm@romannum{end\InTheoType ctr}}{\relax}%
 94:       {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
 95:         \boxmaxdepth=.5ex\begin{array}[b]{@{}l}%
 96:         \boxmaxdepth=\maxdimen\displaystyle\fi}%
 97:       \addtocounter{end\InTheoType ctr}{-1}%
 98:     %%$$ BRACE MATCH HACK
 99:   \fi}
100: \gdef\]{%
101:   \stepcounter{end\InTheoType ctr}%
102:   \@ifundefined{mark\thm@romannum{curr\InTheoType ctr}%
103:     \InTheoType\thm@romannum{end\InTheoType ctr}}{\relax}%
104:     {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
105:       \end{array}\fi}%
106:     \addtocounter{end\InTheoType ctr}{-1}%
107:     \relax\ifmmode
108:       \ifinner
109:         \@badmath
110:       \else
111:         \PotEndMark{\eqno}\global\@ignoretrue$$%%$$ BRACE MATCH HACK
112:       \fi
113:   \else
114:     \@badmath
115:   \fi
116:   \ignorespaces}

同样,我推测这也会影响环境的运作方式equation*。然而,未加星号的版本equation保持不变,原因很明显:您不会放置定理标记在编号的右侧equation。要查看此内容,请将其替换equation*equation,间距似乎没问题。

这为使用@Lev 的回答- 使用 以外的其他东西equation*;将 重新定义为equation*gather*据我所知,gather(和gather*) 不使用\[\],而是用于$\displaystyle ...$排版,从而避开 的ntheorem重新定义。

我(现在还)还不是 LaTeX 程序员,因此试图弄清楚如何更改/修改代码以使其工作至少可以说是令人生畏的。此外,和的重新定义\[包含\]一些我无法解释的东西。例如,\makebox[.6\linewidth](第 89 行)的使用似乎是任意的。然后我认为在 LaTeX 中使用$$displaymath 是大忌,但它显然是这个重新定义的一部分(第 91+111 行)。

相关内容