The following MWE points out that, without fleqn
class option, math internal mode is detected ("i" and "o") but, as soon as fleqn
class option is enabled, this mode is not detected anymore ("i" and "i").
Do you see what's going on?
\documentclass
%[fleqn]
{article}
%
\newcommand{\test}{%
\relax%
\ifinner%
i%
\else%
o%
\fi%
}
%
\begin{document}
$\test$
%
\begin{equation}
\test
\end{equation}
\end{document}
\ifinner
has never been a good test for being in inline or display math.fleqn
you have forequation
something like$\m@th\displaystyle \hskip\mathindent\bgroup...
. Withoutfleqn
you have plain$$...
.fleqn
you will end up in$$...$$
, withfleqn
you will end up in$...$
. For more look atarticle.cls
andfleqn.clo
.\ifinner
is a useful test in math mode.