3

In this answer, it is advised to proceed to the following redefinition:

\DeclareRobustCommand{\[}{\begin{equation*}}
\DeclareRobustCommand{\]}{\end{equation*}}

But, as pointed out by the following MCE, this leads to extra vertical spaces.

Do you see how to get rid of these extra spaces?

\documentclass[fleqn]{article}
\usepackage[step=1cm]{pagegrid}
\usepackage[margin=0pt,papersize=2.5cm]{geometry}
%
\usepackage{amsmath}
\usepackage[amsmath,fleqn,thmmarks]{ntheorem}
%
\newcommand{\test}{%
  \noindent%
  Foo
  \[
    a=a
  \]
  Bar
}
%
\begin{document}
\test
%
\DeclareRobustCommand{\[}{\begin{equation*}}%
\DeclareRobustCommand{\]}{\end{equation*}}%
\newpage
\test
\end{document}

enter image description here enter image description here

Denis Bitouzé
  • 9,652
  • 4
  • 27
  • 85
  • I will remove my comments because I see only now your question is direct continuation of thread at https://tex.stackexchange.com/questions/402187/ntheorems-fleqn-and-thmmarks-options-break-ifdisplay which already mentions thmmarks features... –  Nov 21 '17 at 16:15
  • See also https://tex.stackexchange.com/questions/47400/remove-vertical-space-around-align – John Kormylo Nov 22 '17 at 04:19
  • No, the answer doesn't recommend to do that redefinition. It actually recommends not using thmmarks. – egreg Jun 18 '18 at 12:38
  • @egreg Okay, this answer gave that redefinition as a workaround, sorry :) – Denis Bitouzé Jun 18 '18 at 13:34

1 Answers1

1

In the first instance the spacing before and after is provided by \topsep (from a trivlist), whereas in the amsmath case it is \abovedisplayskip and \belowdisplayskip. Setting the last two to \topsep gives the same spacing:

Sample output

\documentclass[fleqn]{article}
\usepackage[step=1cm]{pagegrid}
\usepackage[margin=0pt,papersize=2.5cm]{geometry}
%
\usepackage{amsmath}
\usepackage[amsmath,fleqn,thmmarks]{ntheorem}
%
\newcommand{\test}{%
  \noindent%
  Foo
  \[
    a=a
  \]
  Bar
}
%
\begin{document}
\test
%
\DeclareRobustCommand{\[}{\begin{equation*}}%
\DeclareRobustCommand{\]}{\end{equation*}}%
\setlength{\abovedisplayskip}{\topsep}%
\setlength{\belowdisplayskip}{\topsep}%
\newpage
\test
\end{document}
Andrew Swann
  • 95,762