[texhax] A macro programming question

Vafa Khalighi vafakh84 at gmail.com
Sun Apr 11 13:58:16 CEST 2010


On Sun, Apr 11, 2010 at 8:29 PM, Donald Arseneau <asnd at triumf.ca> wrote:

> Vafa Khalighi <vafakh84 at gmail.com> writes:
>
> > 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}
>
> 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}
>
>
>
Thanks Donald and others. This has been very helpful for me. I actually like
Donald's solution better. I have got one more questions and that is it. I
also need to implement another primitive like command \halignR such that
when I say

\halignR to 2pt{#1}

It actually will mean

\hbox\bgroup\beginR\vbox\
bgroup\halign to 2pt{#1}\egroup\endR\egroup

so again \halignR accepts both {} and \bgroup \egroup. I have tried to
implement this with using your solutions but I only could do it when it
actually accepts {} and not \bgroup \egroup.

Thanks


-- 
Best wishes,
Vafa Khalighi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20100411/2c61694e/attachment.html>


More information about the texhax mailing list