ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Dividing dimensions
@ 2009-03-21 22:08 Aditya Mahajan
  2009-03-21 22:26 ` Arthur Reutenauer
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Aditya Mahajan @ 2009-03-21 22:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

Can I divide dimensions to get a number in pdftex?

I have four dimensions \!!dimena, \!!dimenb, \!!dimenc and \!!dimend, and 
I want

if (dimena/dimenb) > (dimenc/dimend)
   do something
else
   do otherthing


Any hints on how to do this in ConTeXt.

Thanks,
Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-21 22:08 Dividing dimensions Aditya Mahajan
@ 2009-03-21 22:26 ` Arthur Reutenauer
  2009-03-21 22:41   ` Wolfgang Schuster
  2009-03-22  8:38   ` Wolfgang Schuster
  2009-03-22  0:02 ` Marcin Borkowski
  2009-03-22  9:41 ` Hans Hagen
  2 siblings, 2 replies; 16+ messages in thread
From: Arthur Reutenauer @ 2009-03-21 22:26 UTC (permalink / raw)
  To: Mailing list for ConTeXt users

> Can I divide dimensions to get a number in pdftex?

  LaTeX has a package to do exactly that, fp.  You could look into its
code.  Or you could use LuaTeX :-)

	Arthur
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-21 22:26 ` Arthur Reutenauer
@ 2009-03-21 22:41   ` Wolfgang Schuster
  2009-03-21 22:49     ` Aditya Mahajan
  2009-03-23  7:15     ` Alan BRASLAU
  2009-03-22  8:38   ` Wolfgang Schuster
  1 sibling, 2 replies; 16+ messages in thread
From: Wolfgang Schuster @ 2009-03-21 22:41 UTC (permalink / raw)
  To: Mailing list for ConTeXt users


Am 21.03.2009 um 23:26 schrieb Arthur Reutenauer:

>> Can I divide dimensions to get a number in pdftex?
>
>  LaTeX has a package to do exactly that, fp.  You could look into its
> code.  Or you could use LuaTeX :-)


It's easy to do with etex but I would use lua if possible.

\starttext
\unprotect

\!!dimena=1cm
\!!dimenb=2cm
\!!dimenc=1cm
\!!dimend=3cm

\ifdim\dimexpr\!!dimena*100/\!!dimenb\relax>\dimexpr\!!dimenc*100/\!! 
dimend\relax
     this
\else
     that
\fi

\!!dimend=1cm

\ifdim\dimexpr\!!dimena*100/\!!dimenb\relax>\dimexpr\!!dimenc*100/\!! 
dimend\relax
     this
\else
     that
\fi

\protect
\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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-21 22:41   ` Wolfgang Schuster
@ 2009-03-21 22:49     ` Aditya Mahajan
  2009-03-21 23:00       ` Wolfgang Schuster
  2009-03-23  7:15     ` Alan BRASLAU
  1 sibling, 1 reply; 16+ messages in thread
From: Aditya Mahajan @ 2009-03-21 22:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 21 Mar 2009, Wolfgang Schuster wrote:

>
> Am 21.03.2009 um 23:26 schrieb Arthur Reutenauer:
>
>>> Can I divide dimensions to get a number in pdftex?
>> 
>> LaTeX has a package to do exactly that, fp.  You could look into its
>> code.  Or you could use LuaTeX :-)
>
>
> It's easy to do with etex but I would use lua if possible.
>
> \starttext
> \unprotect
>
> \!!dimena=1cm
> \!!dimenb=2cm
> \!!dimenc=1cm
> \!!dimend=3cm
>
> \ifdim\dimexpr\!!dimena*100/\!!dimenb\relax>\dimexpr\!!dimenc*100/\!!dimend\relax
>   this
> \else
>   that
> \fi

Ah. I was using \dimexpr\!!dimena/\!!dimenb with crazy results. So the 
trick is to mulitply by a number in between. Thanks Wolfgang.

Aditya

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-21 22:49     ` Aditya Mahajan
@ 2009-03-21 23:00       ` Wolfgang Schuster
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Schuster @ 2009-03-21 23:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 21.03.2009 um 23:49 schrieb Aditya Mahajan:

>> \ifdim\dimexpr\!!dimena*100/\!!dimenb\relax>\dimexpr\!! 
>> dimenc*100/\!!dimend\relax
>>  this
>> \else
>>  that
>> \fi
>
> Ah. I was using \dimexpr\!!dimena/\!!dimenb with crazy results. So  
> the trick is to mulitply by a number in between. Thanks Wolfgang.

Yes because you're working with integers and dividing a number by a  
bigger
number results in zero (that's why you could also use \numexpr above).

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-21 22:08 Dividing dimensions Aditya Mahajan
  2009-03-21 22:26 ` Arthur Reutenauer
@ 2009-03-22  0:02 ` Marcin Borkowski
  2009-03-22  2:13   ` Aditya Mahajan
  2009-03-22  9:41 ` Hans Hagen
  2 siblings, 1 reply; 16+ messages in thread
From: Marcin Borkowski @ 2009-03-22  0:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dnia Sat, Mar 21, 2009 at 06:08:41PM -0400, Aditya Mahajan napisał(a):
> Hi,
> 
> Can I divide dimensions to get a number in pdftex?
> 
> I have four dimensions \!!dimena, \!!dimenb, \!!dimenc and \!!dimend, and 
> I want
> 
> if (dimena/dimenb) > (dimenc/dimend)
>   do something
> else
>   do otherthing

What about

if (dimena*dimend) > (dimenc*dimenb) ... ?

If dimenb and dimend are positive, this should be equivalent (assuming
you don't run into overflow).

> Any hints on how to do this in ConTeXt.
> 
> Thanks,
> Aditya

Regards

-- 
Marcin Borkowski (http://mbork.pl)

Ja nie chcę czytać tych głupich gazet
I wymyślonych oglądać historii.
                        (Chili My)
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-22  0:02 ` Marcin Borkowski
@ 2009-03-22  2:13   ` Aditya Mahajan
  0 siblings, 0 replies; 16+ messages in thread
From: Aditya Mahajan @ 2009-03-22  2:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 22 Mar 2009, Marcin Borkowski wrote:

> Dnia Sat, Mar 21, 2009 at 06:08:41PM -0400, Aditya Mahajan napisał(a):
>> Hi,
>>
>> Can I divide dimensions to get a number in pdftex?
>>
>> I have four dimensions \!!dimena, \!!dimenb, \!!dimenc and \!!dimend, and
>> I want
>>
>> if (dimena/dimenb) > (dimenc/dimend)
>>   do something
>> else
>>   do otherthing
>
> What about
>
> if (dimena*dimend) > (dimenc*dimenb) ... ?
>
> If dimenb and dimend are positive, this should be equivalent (assuming
> you don't run into overflow).

I tried that, but that leads to overflow.

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-21 22:26 ` Arthur Reutenauer
  2009-03-21 22:41   ` Wolfgang Schuster
@ 2009-03-22  8:38   ` Wolfgang Schuster
  1 sibling, 0 replies; 16+ messages in thread
From: Wolfgang Schuster @ 2009-03-22  8:38 UTC (permalink / raw)
  To: Mailing list for ConTeXt users


Am 21.03.2009 um 23:26 schrieb Arthur Reutenauer:

>> Can I divide dimensions to get a number in pdftex?
>
>  LaTeX has a package to do exactly that, fp.  You could look into its
> code.  Or you could use LuaTeX :-)

\startluacode
if tex.dimen["!!dimena"] / tex.dimen["!!dimenb"] > tex.dimen["!! 
dimenc"] / tex.dimen["!!dimend"] then
     tex.sprint("this")
else
     tex.sprint("that")
end
\stopluacode

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-21 22:08 Dividing dimensions Aditya Mahajan
  2009-03-21 22:26 ` Arthur Reutenauer
  2009-03-22  0:02 ` Marcin Borkowski
@ 2009-03-22  9:41 ` Hans Hagen
  2 siblings, 0 replies; 16+ messages in thread
From: Hans Hagen @ 2009-03-22  9:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Aditya Mahajan wrote:
> Hi,
> 
> Can I divide dimensions to get a number in pdftex?
> 
> I have four dimensions \!!dimena, \!!dimenb, \!!dimenc and \!!dimend, 
> and I want

depends on what you want to achive as there are many possibilities

\number\dimexp 123pt\relax
\number\dimexp 123pt/65536\relax

there's also

\withoutpt

anyhow, you code ...


\dimen0=10pt
\dimen2=20pt
\dimen4=30pt
\dimen6=40pt

\ifdim \dimexpr\dimen0/\dimen2\relax > \dimexpr\dimen4/\dimen6\relax
   do something
\else
   do otherthing
\fi

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-21 22:41   ` Wolfgang Schuster
  2009-03-21 22:49     ` Aditya Mahajan
@ 2009-03-23  7:15     ` Alan BRASLAU
  2009-03-23 11:35       ` Arthur Reutenauer
  2009-03-23 12:12       ` Wolfgang Schuster
  1 sibling, 2 replies; 16+ messages in thread
From: Alan BRASLAU @ 2009-03-23  7:15 UTC (permalink / raw)
  To: ntg-context

Can someone explain this?
The solutions posted in lua seem more complicated
than that using \dimexpr

I will add further examples to
http://wiki.contextgarden.net/Expressions
(or someone else can do this directly, of course)
once I understand the advantages and limitations.

Alan

On Saturday 21 March 2009 23:41:19 Wolfgang Schuster wrote:
> >> Can I divide dimensions to get a number in pdftex?
> >
> >  LaTeX has a package to do exactly that, fp.  You could look into its
> > code.  Or you could use LuaTeX :-)
>
> It's easy to do with etex but I would use lua if possible

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-23  7:15     ` Alan BRASLAU
@ 2009-03-23 11:35       ` Arthur Reutenauer
  2009-03-23 12:12       ` Wolfgang Schuster
  1 sibling, 0 replies; 16+ messages in thread
From: Arthur Reutenauer @ 2009-03-23 11:35 UTC (permalink / raw)
  To: Mailing list for ConTeXt users

> Can someone explain this?

  tex.dimen is a Lua table containing the dimension registers, in scaled
points.  Hence, if \!!dimena is 1pt, tex.dimen["!!dimena"] will be 65536,
for instance.  The rest is algebra and Lua control structures.

> The solutions posted in lua seem more complicated
> than that using \dimexpr

  If you mean from the number of characters, maybe.  Then again, it's
only about comparing a / b to c / d in both cases.  It would be
interesting to compare their efficiency.

	Arthur
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-23  7:15     ` Alan BRASLAU
  2009-03-23 11:35       ` Arthur Reutenauer
@ 2009-03-23 12:12       ` Wolfgang Schuster
  2009-03-23 12:22         ` Arthur Reutenauer
  2009-03-23 23:27         ` Alan BRASLAU
  1 sibling, 2 replies; 16+ messages in thread
From: Wolfgang Schuster @ 2009-03-23 12:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 23.03.2009 um 08:15 schrieb Alan BRASLAU:

> Can someone explain this?
> The solutions posted in lua seem more complicated
> than that using \dimexpr
>
> I will add further examples to
> http://wiki.contextgarden.net/Expressions
> (or someone else can do this directly, of course)
> once I understand the advantages and limitations.


Here is a example document.

Wolfgang


\starttext

\setupwhitespace[line]

Our todays question is how to divide two dimension and compare their
result with the result of another division, to do this we assign values
two four dimensions.

\startbuffer
\dimen0=15pt
\dimen2=20pt
\dimen4=15pt
\dimen6=30pt
\stopbuffer

\typebuffer \getbuffer

Because we can use \ETEX\ functions with \CONTEXT\ let's try to use  
them,
the following example should work:

\startbuffer
\ifdim\dimexpr\dimen0/\dimen2\relax<\dimexpr\dimen4/\dimen6\relax
     Second number is bigger.
\else
     First number is bigger.
\fi
\stopbuffer

\typebuffer \getbuffer

This seems to be working but did it also work when the first result of
the second division is bigger.

\startbuffer
\dimen6=15pt

\ifdim\dimexpr\dimen0/\dimen2\relax<\dimexpr\dimen4/\dimen6\relax
     Second number is bigger.
\else
     First number is bigger.
\fi
\stopbuffer

\typebuffer \getbuffer

This seems to be weird because we still get as result that the first  
number
is bigger but why did this happen? Let's take a closer look at the  
real values
of the dimensions and their results after the divison.

Dimen0 has a value of \the\dimen0{} which is \number\dimen0{} in  
scaled points.
Only the second value in scaled points is important for our  
calculation, we wan't
to also know what the value of the second dimensions is: \number 
\dimen2. The last
we want to know is the result of the division from the two number,  
this is
\number\dimexpr\dimen0/\dimen2\relax.

Before I want to say if this number is or good let's see what the  
value of
the second number is before we changed the value for dimension 6 and  
after
we changed it:

\startlines
Before: \dimen6=30pt \number\dimexpr\dimen4/\dimen6\relax
After:  \dimen6=15pt \number\dimexpr\dimen4/\dimen6\relax
\stoplines

The result is always 1 and not very helpful for us, you can see, if  
you to divide
two number which are nearly equal the result in \TEX\ is not ver  
helpful, to compensate
this we can multiply the first number in the division to get a better  
result.

We try this first with the pure number before we include this in the  
\type{\ifdim}
text we wanted.

\startlines
Result 1: \number\dimexpr\dimen0*100/\dimen2\relax
Result 2: \number\dimexpr\dimen4*100/\dimen6\relax
\stoplines

This gives us now to higher number we can compare with reliable results.
We will now try to test both this with our number above again.

\startbuffer
\dimen6=30pt

\ifdim\dimexpr\dimen0*100/\dimen2\relax<\dimexpr 
\dimen4*100/\dimen6\relax
     Second number is bigger.
\else
     First number is bigger.
\fi
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\dimen6=15pt

\ifdim\dimexpr\dimen0*100/\dimen2\relax<\dimexpr 
\dimen4*100/\dimen6\relax
     Second number is bigger.
\else
     First number is bigger.
\fi
\stopbuffer

\typebuffer \getbuffer

You can see both tests give us a correct result after we multiplied  
the first
number in each division by 100 but should we rely on such limitations  
in \TEX\
when we can also use \LUATEX\ to get a correct result.

The \type{tex.dimen} function allows us to access the dimen register  
from \TEX\ in Lua.

\startbuffer
\dimen6=30pt

\startluacode
if tex.dimen[0] / tex.dimen[2] < tex.dimen[4] / tex.dimen[6] then
     tex.sprint("Second number is bigger.")
else
     tex.sprint("First number is bigger.")
end
\stopluacode
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\dimen6=15pt

\startluacode
if tex.dimen[0] / tex.dimen[2] < tex.dimen[4] / tex.dimen[6] then
     tex.sprint("Second number is bigger.")
else
     tex.sprint("First number is bigger.")
end
\stopluacode
\stopbuffer

\typebuffer \getbuffer

The output is now correct in both values without any tricks.

\stoptext

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-23 12:12       ` Wolfgang Schuster
@ 2009-03-23 12:22         ` Arthur Reutenauer
  2009-03-23 23:27         ` Alan BRASLAU
  1 sibling, 0 replies; 16+ messages in thread
From: Arthur Reutenauer @ 2009-03-23 12:22 UTC (permalink / raw)
  To: Mailing list for ConTeXt users

	Hello Wolfgang,

  Thanks for the detailed explanation.

> The \type{tex.dimen} function allows us to access the dimen register from 
> \TEX\ in Lua.

  A small correction: it's not a function, it really behaves like a
table in Lua.  You can use both the register number, or the symbolic
name (as defined by \dimendef, if applicable), as a key to the table.

	Arthur
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-23 12:12       ` Wolfgang Schuster
  2009-03-23 12:22         ` Arthur Reutenauer
@ 2009-03-23 23:27         ` Alan BRASLAU
  2009-03-24  6:51           ` Mojca Miklavec
  1 sibling, 1 reply; 16+ messages in thread
From: Alan BRASLAU @ 2009-03-23 23:27 UTC (permalink / raw)
  To: ntg-context

Great!
I added a section to the wiki
http://wiki.contextgarden.net/Expressions
taking liberties to modify the presentation slightly.

A few points are broken, though,
notably that the online ConTeXt doesn't appear to do luacode...

Alan


On Monday 23 March 2009 13:12:54 Wolfgang Schuster wrote:
> Here is a example document.

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-23 23:27         ` Alan BRASLAU
@ 2009-03-24  6:51           ` Mojca Miklavec
  2009-03-24  7:07             ` Hans Hagen
  0 siblings, 1 reply; 16+ messages in thread
From: Mojca Miklavec @ 2009-03-24  6:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Mar 24, 2009 at 00:27, Alan BRASLAU wrote:
> Great!
> I added a section to the wiki
> http://wiki.contextgarden.net/Expressions
> taking liberties to modify the presentation slightly.
>
> A few points are broken, though,
> notably that the online ConTeXt doesn't appear to do luacode...

True. We don't want users to experiment with os.execute.

Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Dividing dimensions
  2009-03-24  6:51           ` Mojca Miklavec
@ 2009-03-24  7:07             ` Hans Hagen
  0 siblings, 0 replies; 16+ messages in thread
From: Hans Hagen @ 2009-03-24  7:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:
> On Tue, Mar 24, 2009 at 00:27, Alan BRASLAU wrote:
>> Great!
>> I added a section to the wiki
>> http://wiki.contextgarden.net/Expressions
>> taking liberties to modify the presentation slightly.
>>
>> A few points are broken, though,
>> notably that the online ConTeXt doesn't appear to do luacode...
> 
> True. We don't want users to experiment with os.execute.

actually, the code for a more secure handling has been present from the 
start ... one can overload the normal executer

--~ executer.register('.*')
--~ executer.register('*')
--~ executer.register('dir','ls')
--~ executer.register('dir')

--~ executer.finalize()
--~ executer.execute('dir',"*.tex")
--~ executer.execute("dir *.tex")
--~ executer.execute("ls *.tex")
--~ os.execute('ls')

reminds me to add the exec and spawn variants

when i have time i will add some commandline argument to control it

Hans



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2009-03-24  7:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-21 22:08 Dividing dimensions Aditya Mahajan
2009-03-21 22:26 ` Arthur Reutenauer
2009-03-21 22:41   ` Wolfgang Schuster
2009-03-21 22:49     ` Aditya Mahajan
2009-03-21 23:00       ` Wolfgang Schuster
2009-03-23  7:15     ` Alan BRASLAU
2009-03-23 11:35       ` Arthur Reutenauer
2009-03-23 12:12       ` Wolfgang Schuster
2009-03-23 12:22         ` Arthur Reutenauer
2009-03-23 23:27         ` Alan BRASLAU
2009-03-24  6:51           ` Mojca Miklavec
2009-03-24  7:07             ` Hans Hagen
2009-03-22  8:38   ` Wolfgang Schuster
2009-03-22  0:02 ` Marcin Borkowski
2009-03-22  2:13   ` Aditya Mahajan
2009-03-22  9:41 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).