Why isn't there any command to start a paragraph with \vbox?
The command for starting horizontal mode with a \vbox
is \leavevmode
. Why would you need something else?
Your assumption is wrong, I'm afraid: it's not “empty contents” that triggers mode change. It is precisely \unhbox
that does.
Differently from \box
and \copy
, \unhbox
is a horizontal command, so it triggers horizontal mode if TeX is in vertical mode. The macro \leavevmode
uses \voidb@x
so that nothing is appended to the horizontal list (after possibly having started it).
The analog command \unvbox
is a vertical command and ends a paragraph.
\catcode`@=11
\def\leavehmode{\unvbox\voidb@x}
\catcode`@=12
\everypar{PAR}% to show a paragraph has started
abc\leavehmode def
\bye
I don't know whether this is clear or not, but let's state it explicitly (from the TeXbook):
|\leavevmode| is an abbreviation for `|\unhbox\voidbox|',
where |\voidbox| is a permanently empty box register.
Now what does \unhbox\voidbox
actually do? Let's take a look in tex.web
:
@ @<Cases of |main_control| that build...@>=
vmode+start_par: new_graf(cur_chr>0);
vmode+letter,vmode+other_char,vmode+char_num,vmode+char_given,
vmode+math_shift,vmode+un_hbox,vmode+vrule,
vmode+accent,vmode+discretionary,vmode+hskip,vmode+valign,
vmode+ex_space,vmode+no_boundary:@t@>@;@/
begin back_input; new_graf(true);
end;
As you can see any of those combinations of mode and something else start a paragraph, but vmode+un_vbox
is not among them.
On a personal note, I find it interesting that Knuth did not let vmode+<*>vbox
start a paragraph but vmode+valign
does.