2

The following MCE points out ntheorem's fleqn and thmmarks options break \if@display: e.g., as soon as thmmarks is uncommented, the 1st "equation" contains "Non-display math".

Do you see what's going on?

\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage[
  amsmath,
  fleqn,
  % thmmarks
]{ntheorem}
%
\makeatletter
\newcommand\testdisplaymath{%
  \if@display
  \text{Display math}
  \else
  \text{Non-display math}
  \fi
}
\makeatother
%
\begin{document}
\[
  \testdisplaymath
\]
$\testdisplaymath$
\end{document}

Edit

Anyway, I discovered meanwhile that a better way to discriminate between display and non-display math would be to rely on \mathchoice and, as shown by the following MWE, this macro (unlike \if@display) isn't broken by ntheorem's fleqn and thmmarks options:

\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage[
  amsmath,
  fleqn,
  thmmarks
]{ntheorem}
%
\makeatletter
\newcommand\testdisplaymath{%
  \mathchoice{%
    \text{Display math}%
  }{%
    \text{Non-display math}%
  }{%
    \text{Non-display math}%
  }{%
    \text{Non-display math}%
  }
}
\makeatother
%
\begin{document}
\[
  \testdisplaymath
\]
$\testdisplaymath$
\end{document}
3
  • Another reason for not recommending this package.
    – egreg
    Commented Nov 20, 2017 at 7:04
  • This looks very much like a bug in the setup of the thmmarks option. Have you contacted the maintainer(s) of the ntheorem package and alerted them to this issue?
    – Mico
    Commented Nov 20, 2017 at 7:04
  • 1
    @Mico Maintainers informed about this issue. Commented Nov 20, 2017 at 18:42

2 Answers 2

5

When you load the thmmarks option, ntheorem does

\gdef\[{%
  <code adding to the corresponding in the LaTeX kernel>
}
\gdef\]{%
  <code adding to the corresponding in the LaTeX kernel>
}

but amsmath had one

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

Since the LaTeX kernel code has no provision for \if@display, you get no support for it using \[ and \], unless you redo the latter declarations. However, see also https://tex.stackexchange.com/a/329209/4427

Personal comment: the thmmarks option does so many changes in order to do something that simply requires \qedhere when needed and whose usage can be avoided by not ending a proof with a display or an enumerated list (of course with amsthm and not ntheorem).

3
0

It's another problem with the compatibility of amsmath. amsmath compatibility is an issue since the early beginnings. Mails to amsmath people in the early stage of development (suggested by Frank Mittelbach at that time) were simply not answered by them.

Personally, I suggest not to use amsmath. This is also due to a bad experience with backwards version compatibility of amsmath.

Wolfgang (still partially active developer of ntheorem)

6
  • 3
    Seriously? amsmath and, based on it, mathtools provide so many, so nice features when one has to typeset maths that these packages are widely used nowadays. Commented Nov 21, 2017 at 13:18
  • 2
    Sorry, but a choice between ntheorem and amsmath is definitely for the latter.
    – egreg
    Commented Nov 21, 2017 at 13:25
  • amsmath is part of latex/required and any math document should include it. The only reason that it isn't included by default in the format is the memory constraints of emtex on a 540K PC. Commented Nov 21, 2017 at 13:25
  • So people using it should hope that they by now care for backward compatibility. Commented Nov 21, 2017 at 13:31
  • The responsibility for maintenance of amsmath was transferred to the latex team in 2016. Commented Nov 21, 2017 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .