TeX can be in 7 distinct modes:
- Vertical mode: this is the mode in which TeX starts, and build pages.
- Internal vertical mode: TeX is in this mode within
\vbox{...}. - Horizontal mode: when constructing paragraphs.
- Restricted horizontal mode: within an
\hbox{...}. - Display math mode:
$$...$$(and LaTeX's other display math environments). - Math mode:
$...$for inline math. - No mode: only within
\writecommands?
The existence of the no mode mode can be ascertained by running
\tracingall
\immediate\write16{\iftrue\fi}
\end
(with the plain TeX format). The log contains
\write->\iftrue \fi
{no mode: \iftrue: (level 1)}
{true}
{\fi: \iftrue (level 1)}
{vertical mode: blank space }
{\end}
As you can see, TeX writes down the mode for the first command run in that mode. In this snippet, we can see no mode and vertical mode.
So far, I noted that neither \message nor \special change the mode to no mode. Only \write seems to do it.

