2

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

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.