[XeTeX] How to append text to a paragraph (in an existing vbox)?

Philip Taylor (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Fri Jul 16 12:24:30 CEST 2010



Philip Taylor (Webmaster, Ret'd) wrote:

> Ron Aaron wrote:
>
>> What I wish to do is accumulate text into a paragraph "as I go".

and I offered two solutions, one based on \hboxes and one based
on token-list registers.  Off-list, Ron reported problems with
these, and said he was still looking for a \vbox-based solution,
so after considerable introspection I have come up with the
following : it is left to the reader to work out why spaces are
lost and how to overcome it !

\newbox \textbox
\def \addtobox #1%
     {%
         \setbox \textbox = \vbox
             \bgroup
                 \unvbox \textbox
                 \setbox 0 = \lastbox
                 \unhbox 0 \unskip \unskip #1%
             \egroup
     }

\addtobox {H}
\addtobox {a}
\addtobox {l}
\addtobox {l}
\addtobox {o}
\addtobox { }
\addtobox {t}
\addtobox {h}
\addtobox {e}
\addtobox {r}
\addtobox {e}
\addtobox { }
\addtobox {!}
\addtobox {}

\box \textbox

\end

** Phil.


More information about the XeTeX mailing list