Am 27.10.2011 um 11:23 schrieb Thomas A. Schmitz:

> On 10/25/2011 12:27 PM, Thomas A. Schmitz wrote:
>> Wolfgang, Hans,
>> 
>> thanks a lot, this works now. Will now try and move the code to a
>> ctxluafile and see if I can make it work again. If not, I'll be back; no
>> good deed goes unpunished...
>> 
>> Thomas
> 
> OK, I'm slowly making progress processing xml in lua. One naive question now: 
> how can I have access to and manipulate the textwidth dimension? In other 
> words, given
> 
> 0.4\textwidth
> 
> what would be the equivalent in lua code? I tried
> 
> 0.4 * tex.dimen.textwidth
> 
> or
> 
> 0.4 * tex.dimen["textwidth"]
> 
> but couldn't make that work. Also tried grepping the tex/context/base/*.lua 
> files for width, but couldn't find anything immediately obvious.


With “tex.dimen[…]” you get the value in scaled points but util-dim.lua 
provides some functions to convert the value in points, centimeter etc.

\starttext
\startluacode
context.blackrule{ width = number.topoints(tex.dimen["textwidth"]/2) }
\stopluacode
\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to