[texhax] A macro programming question
Philipp Stephani
st_philipp at yahoo.de
Sat Apr 10 16:49:11 CEST 2010
Am 10.04.2010 um 07:11 schrieb Vafa Khalighi:
> I ask my question as an example
>
> I can say \hbox to 10pt{This is a test.}
>
> Now I want to define the macro \hboxR, so that when I say
>
> \hboxR to 10pt{This is a test.}
>
> it actually means
>
> \hbox to 10pt{\beginR This is a test\endR}
>
> Can \hboxR be defined like what I described?
Probably not with full generality. The following is a partial solution with several issues:
\TeXXeTstate=1
\def\hboxR#1#{\hboxRR{#1}}
\def\hboxRR#1#2{\hbox#1{\beginR#2\endR}}
\setbox0=\hboxR to 40pt{abc\hfil def}
\box0
\bye
With this definition, \hboxR can presumably act as a <box>, and the syntax is similar to \hbox. However, no braces must occur in the "to" part, and the braces enclosing the box contents must be explicit.
More information about the texhax
mailing list