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}
thmmarks
option. Have you contacted the maintainer(s) of thentheorem
package and alerted them to this issue?