Command \ifmmode
misjudged in math environment of package amsmath
. An mwe is like
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather}
\ifmmode123\else456\fi
\end{gather}
\end{document}
In math eqvironment, it should have produced 123
in gather
environment. But the outcome is just the opposite. Similar cases appear in align
, eqarray
and so on. But in equation
, it produces the right outcome. Is this a bug? Or how to fix it? Thansks for help!