Re: [NTG-context] xml and lua again

2011-10-28 Thread Thomas A. Schmitz
On 10/27/11 13:05, Hans Hagen wrote: 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

Re: [NTG-context] xml and lua again

2011-10-28 Thread luigi scarso
On Fri, Oct 28, 2011 at 8:23 AM, Thomas A. Schmitz thomas.schm...@uni-bonn.de wrote: On 10/27/11 13:05, Hans Hagen wrote: 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

Re: [NTG-context] xml and lua again

2011-10-28 Thread luigi scarso
On Fri, Oct 28, 2011 at 8:37 AM, luigi scarso luigi.sca...@gmail.com wrote: soryy, typos number.topoints(tex.dimen[textwidth]/2) gives XYZ.ABSpt number.topoints(tex.dimen[textwidth]/2) gives XYZ.ABCpt TeX reads XYZ.ABC.pt and convert to xyzsp and drops sp TeX reads XYZ.ABCpt and convert to

Re: [NTG-context] xml and lua again

2011-10-28 Thread Patrick Gundlach
context.blackrule{ width = number.topoints(tex.dimen[textwidth]/2) } or just tex.dimen[textwidth]/2 .. sp Wait, just so I understand: your solution would imply that tex.dimen[textwidth] holds a number, not a dimension, right? (Because you simply concatenate it with a dimension

Re: [NTG-context] xml and lua again

2011-10-28 Thread Thomas A. Schmitz
On 10/28/11 08:44, Patrick Gundlach wrote: context.blackrule{ width = number.topoints(tex.dimen[textwidth]/2) } or just tex.dimen[textwidth]/2 .. sp Wait, just so I understand: your solution would imply that tex.dimen[textwidth] holds a number, not a dimension, right? (Because you

Re: [NTG-context] xml and lua again

2011-10-28 Thread Wolfgang Schuster
Am 28.10.2011 um 08:55 schrieb Thomas A. Schmitz: Luigi, Patrick, thanks for your explanations! The point of my question was: can I feed the content of tex.dimen[textwidth] directly back to TeX, and the answer to this appears to be no; you need to add some unit to it (otherwise, you get

Re: [NTG-context] xml and lua again

2011-10-28 Thread Hans Hagen
Hi Thomas, thanks for your explanations! The point of my question was: can I feed the content of tex.dimen[textwidth] directly back to TeX, and the answer to this appears to be no; you need to add some unit to it (otherwise, you get an error message). Which was a bit confusing to me at first,

Re: [NTG-context] xml and lua again

2011-10-28 Thread Hans Hagen
On 28-10-2011 10:35, Wolfgang Schuster wrote: Am 28.10.2011 um 08:55 schrieb Thomas A. Schmitz: Luigi, Patrick, thanks for your explanations! The point of my question was: can I feed the content of tex.dimen[textwidth] directly back to TeX, and the answer to this appears to be no; you need

Re: [NTG-context] xml and lua again

2011-10-28 Thread Thomas A. Schmitz
On 10/28/11 10:56, Hans Hagen wrote: Just switch to philosopher mode for a while and ask yourself what implications that would have in the rather fuzzy world of printing. What is a 'real' dimension? What we call points (pt) is in other application also called points but happens to be basepoints

Re: [NTG-context] xml and lua again

2011-10-28 Thread luigi scarso
On Fri, Oct 28, 2011 at 10:56 AM, Hans Hagen pra...@wxs.nl wrote: Hi Thomas, thanks for your explanations! The point of my question was: can I feed the content of tex.dimen[textwidth] directly back to TeX, and the answer to this appears to be no; you need to add some unit to it (otherwise,

Re: [NTG-context] xml and lua again

2011-10-28 Thread Hans Hagen
i.e it's a Lua number -- a floating point. So a kind of conversion can happen between a floating point and a sp number (which has a limited range) Of course Lua has its routines, but probably they differs from TeX If I recall correctly, both use 32 bits, but if you extend to lets say 48 bit

Re: [NTG-context] xml and lua again

2011-10-27 Thread 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

Re: [NTG-context] xml and lua again

2011-10-27 Thread Wolfgang Schuster
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...

Re: [NTG-context] xml and lua again

2011-10-27 Thread Thomas A. Schmitz
On 10/27/2011 11:53 AM, Wolfgang Schuster wrote: 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) }

Re: [NTG-context] xml and lua again

2011-10-27 Thread Hans Hagen
On 27-10-2011 12:32, Thomas A. Schmitz wrote: On 10/27/2011 11:53 AM, Wolfgang Schuster wrote: 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 =

Re: [NTG-context] xml and lua again

2011-10-25 Thread Thomas A. Schmitz
On 10/24/11 8:48 PM, Hans Hagen wrote: sure, oryou can play with if xml.filter(t,.[@frame=on]) then the x-*.lua show some tricks OK, I'm in my stubborn mode then: why doesn't this work: \startbuffer[test] a nattable frame=on tr td1/td td2/td td3/td td4/td

Re: [NTG-context] xml and lua again

2011-10-25 Thread Wolfgang Schuster
Am 25.10.2011 um 11:43 schrieb Thomas A. Schmitz: On 10/24/11 8:48 PM, Hans Hagen wrote: sure, oryou can play with if xml.filter(t,.[@frame=on]) then the x-*.lua show some tricks OK, I'm in my stubborn mode then: why doesn't this work: […] \startxmlsetups xml:nattable

Re: [NTG-context] xml and lua again

2011-10-25 Thread Hans Hagen
On 25-10-2011 11:43, Thomas A. Schmitz wrote: \startxmlsetups xml:nattable \startluacode if xml.attribute(t, /, frame, off) == on then context(Yes, the frame is really on!) else context(Nope, sorry, it's still off.) end context(true) context.placefigure( { here }, none , function()

Re: [NTG-context] xml and lua again

2011-10-25 Thread Thomas A. Schmitz
On 10/25/11 12:17 PM, Hans Hagen wrote: see Wolfgangs answer anyway, best move the lua code and wrap it in a function document.MyWhatever ... now its get defined each time Hans Wolfgang, Hans, thanks a lot, this works now. Will now try and move the code to a ctxluafile and see if I can

Re: [NTG-context] xml and lua again

2011-10-24 Thread Hans Hagen
On 22-10-2011 18:46, Thomas A. Schmitz wrote: Hi all, again, I'm playing a bit with processing my xml in lua. I want a simple interface for processing tables (I don't need all the power and complexity of cals tables and want to learn something in the process). And I thought that collecting the

Re: [NTG-context] xml and lua again

2011-10-24 Thread Thomas A. Schmitz
On 10/24/2011 12:17 PM, Hans Hagen wrote: why so complex Hi Hans, yes, I'm aware that this procedure is quite silly for this example, this was just for myself, for educational purposes. As soon as the setup becomes more complex, I thought it might be easier to collect and process the

Re: [NTG-context] xml and lua again

2011-10-24 Thread Hans Hagen
On 24-10-2011 14:18, Thomas A. Schmitz wrote: On 10/24/2011 12:17 PM, Hans Hagen wrote: why so complex Hi Hans, yes, I'm aware that this procedure is quite silly for this example, this was just for myself, for educational purposes. As soon as the setup becomes more complex, I thought it

Re: [NTG-context] xml and lua again

2011-10-24 Thread Thomas A. Schmitz
On 10/24/2011 02:26 PM, Hans Hagen wrote: if lxml.att(t, frame) == on then context(Yes, the frame is really on!) else context(Nope, sorry, it's still off.) end I don't really understand what kind of object a call such as lxml.att(t, frame) produces. all lxml.* calls print something to tex, so

Re: [NTG-context] xml and lua again

2011-10-24 Thread Hans Hagen
On 24-10-2011 19:00, Thomas A. Schmitz wrote: On 10/24/2011 02:26 PM, Hans Hagen wrote: if lxml.att(t, frame) == on then context(Yes, the frame is really on!) else context(Nope, sorry, it's still off.) end I don't really understand what kind of object a call such as lxml.att(t, frame)

Re: [NTG-context] xml and lua again

2011-10-23 Thread Peter Rolf
Hi Thomas, Am 22.10.2011 18:46, schrieb Thomas A. Schmitz: Hi all, again, I'm playing a bit with processing my xml in lua. I want a simple interface for processing tables (I don't need all the power and complexity of cals tables and want to learn something in the process). And I thought

Re: [NTG-context] xml and lua again

2011-10-23 Thread Thomas A. Schmitz
Hi Peter, thanks for your reply, and I'll keep the bit about goat milk in mind :-). frame= .. tostring(framestate) It has the advantage of making the example compile. It has the drawback of not doing anything :-) seems to work. Anyhow, if you are planning to do some more complex stuff,

Re: [NTG-context] xml and lua again

2011-10-23 Thread Peter Rolf
Am 23.10.2011 16:37, schrieb Thomas A. Schmitz: Hi Peter, thanks for your reply, and I'll keep the bit about goat milk in mind :-). frame= .. tostring(framestate) It has the advantage of making the example compile. It has the drawback of not doing anything :-) (sadly) true :-) I

Re: [NTG-context] xml and lua again

2011-10-23 Thread Peter Rolf
Am 22.10.2011 18:46, schrieb Thomas A. Schmitz: Hi all, again, I'm playing a bit with processing my xml in lua. I want a simple interface for processing tables (I don't need all the power and complexity of cals tables and want to learn something in the process). And I thought that

[NTG-context] xml and lua again

2011-10-22 Thread Thomas A. Schmitz
Hi all, again, I'm playing a bit with processing my xml in lua. I want a simple interface for processing tables (I don't need all the power and complexity of cals tables and want to learn something in the process). And I thought that collecting the setups in lua might be the easiest way, but