[texhax] visibility of variables through \rput

Brandon Kuczenski brandon at 301south.net
Mon Aug 10 09:02:44 CEST 2009


On Mon, 10 Aug 2009, Herbert Voss wrote:

> Brandon Kuczenski schrieb:
>
>> I have encountered a difficulty with using custom commands from inside
>> \rput.  When the commands define new macros, those macros aren't visible
>> from outside the \rput.  In the example below, the command defines
>> \theresult-- the first reference to \theresult works; the second reports
>> an "Undefined control sequence".  Is there any way to make the results
>> of the computation visible outside of the \rput scope?
>
> The argument of \rput is internally inside a local group.
> Try this:
>
> \makeatletter
> \newcommand\compute[2]{%
>  \FPmul\pst at tempa{#1}{#2}
>  \global\let\theresult\pst at tempa}
> \makeatother
>
>

Thank you- that seems to work great.  Two follow-up questions: what's a 
good reference to understand scoping in TeX?  and if I were to put this 
command declaration with related ones in a .sty file, well.. what's a good 
reference to understand how to do that well?  Learning by trial and error 
(and texhax as a last resort) is getting tiring.

Kind regards,
Brandon



More information about the texhax mailing list