TeX/ifhmode

Synopsis
\ifhmode  [\else ] \fi

Description
The \ifhmode command denotes the start of an if-then-else control structure that tests whether TeX is currently in either horizontal mode or restricted horizontal mode. As indicated in the Synopsis, the \else part is optional.  is processed if TeX is in one of the horizontal modes, otherwise it is ignored. If the \else section is included and TeX is not in one of the horizontal modes then  is processed; otherwise it is ignored.