Harald Hanche-Olsen posted some interesting code in answer to this question.
Could someone explain how it works?
I understand (I think) the futurelet and the expansions. I don't understand:
- Where does the
<null>
character come from in\ifcat\next9
? - How does the expanded text actually get broken into the
\hbox
's? (Pages 98-99 of the TeXbook didn't really help me understand the trace output in this case, so I'm hoping someone can clarify.)
Thanks!
Here is the code reproduced from the referenced answer:
\def\breaknumberanywhere{\hskip0pt\futurelet\next\breaknumberi}
\def\breaknumberi{\ifcat\next9\expandafter\breaknumberii\fi}
\def\breaknumberii#1{#1\breaknumberanywhere}
\def\foo#1#2{\vtop{\hsize=#1\rightskip=0pt plus 1fil \leftskip=0pt\noindent\breaknumberanywhere#2}}
Here is a long number:
\foo{2in}
{17823941237490812347123904712389407123408917234890123748912034712985712389012351}
\bye
<null>
character you are talking about?