[texhax] A macro programming question

Philipp Stephani st_philipp at yahoo.de
Sun Apr 11 16:26:48 CEST 2010


Am 11.04.2010 um 15:19 schrieb Vafa Khalighi:

> To add to the other solutions... this one only defines one
> macro and works with both { } and \bgroup \egroup...
> 
> \def\hboxR{\begingroup
>  \everyhbox{%
>   \aftergroup\endgroup
>   \everyhbox{}%
>   \beginR
>   \bgroup
>   \aftergroup\endR
>   \aftergroup\egroup
>  }\hbox}
> 
> 
> \setbox0=\hboxR{This is a test.}
> \box0
> 
> Would not work here, because TeX expects a box. How can one fix this?

That is impossible: To use it as a <box>, the macro has to be expandable, thus all suggestions posted here (except mine, which requires explicit braces) don't work because they use assignments.


More information about the texhax mailing list