[pdftex] Ruby in TeX II.
Nagy Bence
tipogral at freemail.hu
Fri Feb 20 13:50:36 CET 2004
> I prefer to get 6.0 Euro rather than 6.0pt.
>
> Why do you put the result into a dimension register? Wouldn't it be
> much more flexible, more convenient and much more general to put the
> output into a token register?
>
> \newtoks\testtoks
> \rubycalc\testtoks{3*2}
> \the\testtoks
>
> Output (\the\testtoks causes):
>
> 6.0
>
> No need then to strip the "pt" and you have arbitrary resolution. And
> I can probably even get my 6.0 Euro.
The dimen gaved back by \rubycalc is a true TeX dimension, so you can
use it like this example (which makes a hbox with width of the 2/3 part
of bodywidth and rightmargin):
\rubycalc\testdimen{(\value\paperwidth-\value\leftmargin)/2.0*3}
\hbox to \testdimen{bla-bla-bla}
Try \rubyexec which gives back a string so "\rubyexec{(3*2).to_s} Euro"
writes "6 Euro" out without using any token registers.
Greetings,
Bence
More information about the pdftex
mailing list