# Is it possible to split a hbox?

When creating two columns or balancing it, we may use \vsplit to achieve this, but can we split a \hbox in TeX?

Compared with \vsplit, an example may be like this:

\setbox0=\hbox to 6in{ ... }
\setbox1=\hsplit0 to 3in


Maybe a method will be that we can put the contents of \box0 into a \vbox, then the horizontal lists in \box0 can be broken into lines. Any ideas?

-

Basically the method is as you said:

\setbox0=\hbox{one two three four five six seven eight nine ten eleven}
\setbox2=\vbox{%
\hsize=.5\wd0
\noindent\unhbox0 \par
\global\setbox3\lastbox
\unskip\unpenalty\unskip
\global\setbox1\lastbox
}

box1: \box1

box3: \box3

\bye

-
Yeah, David, maybe, this is the only method to do that, but, in my opinion :-) –  Timothy Li Mar 29 '13 at 9:57
Upvoted. I am pretty sure, though, that LuaTeX would enable a "cleaner" approach. –  mbork Mar 29 '13 at 11:27
@mbork surely you are not suggesting that lua code could beat the classic elegance of \unskip\global\setbox1\lastbox :-) –  David Carlisle Mar 29 '13 at 11:44
@TimLi if you only want to separate the items in a box then one could imagine other ways, and luatex gives you access to the horizontal list so you could reconstruct it, however if you want to split at exactly half distance and possibly break a word at that point, then you would have to invoke the hyphenation algorithm and so much of the line breaking machinery anyway. –  David Carlisle Mar 29 '13 at 11:46
@DavidCarlisle: I haven't used LuaTeX, only ConTeX for a week, but LuaTeX should be my choice in the future, It is cool to have access to the TeX kernel. –  Timothy Li Mar 29 '13 at 12:07