# Use case for pdfTeX's \quitvmode

While reading one of Lev's answers, I encountered a pdfTeX primitive \quitvmode that I have never noticed before.

The pdfTeX manual states that this causes TeX to leave (internal) vertical mode and enter horizontal mode—the mode in which TeX is building paragraphs. This is the purpose of the plain TeX and LaTeX macro \leavevmode. The manual states that this does so without any bad interaction with \everypar.

The only examples I can think of where this would be useful are horribly contrived. For example,

\everypar{\foo}
\def\foo#1{{\tt\string#1}}
\leavevmode foo

\quitvmode bar
\bye


produces

which is more or less what I'd expect, but this use of \everypar is really silly.

What is an actual use where using \quitvmode instead of \leavevmode matters?

-

Interesting discussion. I see why \ifvmode\indent\fi needs to be \protected. So I see why it's unnecessary with e-TeX extensions, but what I don't understand is why either a primitive or a \protected macro is needed at all. \leavevmode doesn't have expansion problems. The pdfTeX manual explicitly mentions \everypar, but I'm not really seeing the connection (beyond trivial examples like mine). –  TH. Mar 18 '11 at 3:26