Re: [NTG-context] Include chapter number in figure numbering

2012-09-04 Thread Marco Patzer
On 2012-09-04 Sietse Brouwer sbbrou...@gmail.com wrote:

Hi Sietse,

  how do I include the chapter number in the figure numbering?
 
 Untested:
 \setupcaptions[prefixsegment=chapter]

This works with beta 2011-11-29, but unfortunately not in a current
one. Does it work for you?


Marco

___
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
___


Re: [NTG-context] Include chapter number in figure numbering

2012-09-04 Thread Sietse Brouwer
 how do I include the chapter number in the figure numbering?

 Untested:
 \setupcaptions[prefixsegment=chapter]

 This works with beta 2011-11-29, but unfortunately not in a current
 one. Does it work for you?

You're right: it doesn't work for me, either. A bug, then, or possibly
an unannounced interface change.
--Sietse
___
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
___


[NTG-context] \startchapter[title=Test] is not working inside \startcomponent

2012-09-04 Thread Jeong Dalyoung
Dear Listers,

\startchapter[title=Test] is working inside \starttext and \stoptext.
But it is not working inside \startcomponent and \stopcomponent.
Is it a natural behavior? 

I am using iMac, OSX Mountain Lion.
And the ConTeXt version is ConTeXt ver: 2012.08.28 20:00 MKIV fmt: 2012.9.4 
int: english/english

A short test file is:

%\startcomponent
\starttext

\startchapter[title=Test]

\input knuth
\stopchapter

\stoptext
%\stopcomponent

Thank you for reading.
Best regards,

Dalyoung


___
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
___


Re: [NTG-context] \startchapter[title=Test] is not working inside \startcomponent

2012-09-04 Thread Marco Patzer
On 2012-09-04 Jeong Dalyoung hak...@me.com wrote:

Hi Jeong,

 \startchapter[title=Test] is working inside \starttext and \stoptext.
 But it is not working inside \startcomponent and \stopcomponent.
 Is it a natural behavior? 

Yes. \startcomponent expects an argument.

\startcomponent somecomponent

or

\startcomponent *

http://wiki.contextgarden.net/Command/startcomponent


Marco

___
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
___


[NTG-context] Component: \product, \project

2012-09-04 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Hello,

when looking at http://wiki.contextgarden.net/Project_structure -

- why \product and/or \project specification is used in the COMPONENT in the 
example, or why is it supposed or even required to use in components?

I imagined that component doesn't need to know in which project/product is 
used, even when in may be intended to more projects/products.

So does it mean I would have to enumerate all projects/products in which the 
component is to be used?

Or can be \product and/or \project specification omitted in the component?

Best regards,

Lukas


--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___
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
___


Re: [NTG-context] \startchapter[title=Test] is not working inside \startcomponent

2012-09-04 Thread Jeong Dalyoung
Dear Marco,

Aha, I missed to put the name of the component.
With the component name, it works fine.
I am sorry for the noise.

Thank you.

Best regards,

Dalyoung
___
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
___


Re: [NTG-context] ConTeXt color to text

2012-09-04 Thread Peter Rolf
Am 03.09.2012 20:36, schrieb Hans Hagen:
 On 3-9-2012 18:59, Peter Rolf wrote:
 Hi,

 for a batch command (ImageMagick) I need to convert ConTeXt colors to a
 text representation (e.g. rgb 'red' - 'rgb(255,0,0)'; same for color
 models cmyk and gray).
 What is the best way to get (read only) access to the color channels of
 a defined color?
 
 \colorcomponents{red}
 \colorvalue{red}
 
 in next beta:
 
 \startluacode
 
 -- inspect(attributes.colors.spec(red))

Thanks Hans, very nice. Looking out for the next beta. I'll use the time
to check some other problems :-)



 -- table={
 --  [b]=0,
 --  [c]=0,
 --  [model]=cmyk,
 --  [g]=0,
 --  [k]=0,
 --  [m]=1,
 --  [r]=1,
 --  [s]=0.3,
 --  [y]=1,
 -- }
 
 \stopluacode
 
 -
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Stretching width in natural TABLEs

2012-09-04 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Hello,

On Tue, 04 Sep 2012 05:02:01 +0200, Rogers, Michael K mrog...@emory.edu wrote:


That's what I was afraid.  It's just I had the same problem last week, and a 
deadline made me settle for the ad hoc approach.


I was trying to solve the same situation several week ago.

Finally, I measured what the fit option of the first column mean in real 
units (cm) and I altered widths of remaining columns to get \textwidth in total, which is 
ugly and non-systematic solution.

So it seems that there is a task for natural TABLEs:


Suppose one or more columns have fit width, so the width is computed at 
run-time.
Suppose the total width of the table is defined, too.
How to specify width of other columns to have a specified ratio?


E.g.:

col1.width=fit - will be a concrete value at run-time, 'col1.width.real'
col2.width=fit - will be a concrete value at run-time, 'col2.width.real'
TABLE.tot.width=\textwidth
col3.width.weight=1
col4.width.weight=2

should give

col3.width =
  (TABLE.tot.width - col1.width.real - col2.width.real) / (col3.width.weight + 
col4.width.weight) * col3.width.weight

col4.width =
  (TABLE.tot.width - col1.width.real - col2.width.real) / (col3.width.weight + 
col4.width.weight) * col4.width.weight

Best regards,

Lukas


--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___
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
___


Re: [NTG-context] Include chapter number in figure numbering

2012-09-04 Thread Rogers, Michael K
On Sep 4, 2012, at 4:00 AM, Sietse Brouwer wrote:

 how do I include the chapter number in the figure numbering?

 Untested:
 \setupcaptions[prefixsegment=chapter]

 This works with beta 2011-11-29, but unfortunately not in a current
 one. Does it work for you?

 You're right: it doesn't work for me, either. A bug, then, or possibly
 an unannounced interface change.
 --Sietse

I think the key name is plural, and you need to turn on prefixes.  Try

\setupcaptions[prefix=yes,prefixsegments=chapter]
\starttext
\chapter{One}
\section{Cow}
\placefigure{Caption}{\externalfigure[cow][width=2cm]}
Text.
\section{Cow revisited}
\placefigure{Caption}{\externalfigure[cow][width=2cm]}
Text.
\chapter{Two}
\placefigure{Caption}{\externalfigure[cow][width=2cm]}
Text.
\stoptext





This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).
___
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
___


Re: [NTG-context] Component: \product, \project

2012-09-04 Thread Sietse Brouwer
Hello Lukáš,

 I imagined that component doesn't need to know in which project/product is
 used, even when in may be intended to more projects/products.

Usually, projects (collections of environment files) are applied at the
product level. Sometimes, however, you want to apply one at the component
level, so you put a \project in the \startcomponent.

You never need to put \product anywhere.

Clearer descriptions of what the commands \project and \product do can
be found on the command pages; same for all the other structure
commands. The [[Project structure]] page is indeed confusing, it needs
a better structure itself.

Description from http://wiki.contextgarden.net/Command/project:
When used inside a \startproduct or \startcomponent environment,
\project is an instruction to source any \environment files linked in
the project file.

Description from http://wiki.contextgarden.net/Command/product:
The command \product does not do anything: to link a product to a
project file, one should use \project inside the product. Nonetheless,
the \product command is often used inside project files as a reminder
of what products the project involves.

Hope this helps.
Kind regards,
Sietse
___
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
___

Re: [NTG-context] Include chapter number in figure numbering

2012-09-04 Thread Marco Patzer
On 2012-09-04 Rogers, Michael K mrog...@emory.edu wrote:

Hi Rogers,

 I think the key name is plural, and you need to turn on prefixes.
 
 \setupcaptions[prefix=yes,prefixsegments=chapter]

Thanks, that works. I updated the wiki.


Marco

___
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
___


Re: [NTG-context] Include chapter number in figure numbering

2012-09-04 Thread Robert Blackstone

On 4 Sep 2012, at 10:46 ,  08:55:10 +0200  Marco Patzer home...@lavabit.com  
wrot
 
 Hi Sietse,
 
 how do I include the chapter number in the figure numbering?
 
 Untested:
 \setupcaptions[prefixsegment=chapter]
 
 This works with beta 2011-11-29, but unfortunately not in a current
 one. Does it work for you?

Hi, 
This works (for me) in mkiv of 25-08-2012:

\setupcaption[figure][number=yes,way=bychapter,prefix=yes,prefixsegments=chapter]

Best regards,
Robert Blackstone
___
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
___


Re: [NTG-context] Component: \product, \project

2012-09-04 Thread Procházka Lukáš Ing . - Pontex s . r . o .

... Thanks for explanation, it's much clearer now.

Best regards,

Lukas


On Tue, 04 Sep 2012 13:57:50 +0200, Sietse Brouwer sbbrou...@gmail.com wrote:


Hello Lukáš,

Usually, projects (collections of environment files) are applied at the
product level. Sometimes, however, you want to apply one at the component
level, so you put a \project in the \startcomponent.

You never need to put \product anywhere.

Clearer descriptions of what the commands \project and \product do can
be found on the command pages; same for all the other structure
commands. The [[Project structure]] page is indeed confusing, it needs
a better structure itself.

Description from http://wiki.contextgarden.net/Command/project:
When used inside a \startproduct or \startcomponent environment,
\project is an instruction to source any \environment files linked in
the project file.

Description from http://wiki.contextgarden.net/Command/product:
The command \product does not do anything: to link a product to a
project file, one should use \project inside the product. Nonetheless,
the \product command is often used inside project files as a reminder
of what products the project involves.

Hope this helps.
Kind regards,
Sietse


--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___
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
___


[NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
Hi,

I discovered strange behaviour concerning Lua conditionals within
texdefinitions.

ConTeXt complains: 'then' expected near 'thenelseend'.

I guess it has something to do with how the content of a
texdefinitions is grabbed. Seems like a bug or is this by design?


% This works fine
\def\mycmd{%
  \startluacode
if true then
else
end
  \stopluacode}

% This one fails
% \starttexdefinition mycmd
%   \startluacode
% if true then
% else
% end
%   \stopluacode
% \stoptexdefinition

\startluacode
  userdata = userdata or { }
  function userdata.myfun()
if true then
else
end
  end
\stopluacode

% This also works fine
\starttexdefinition mycmd
  \luacode{userdata.myfun()}
\stoptexdefinition

\mycmd


Marco

___
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
___


[NTG-context] External Figure inside MPpage

2012-09-04 Thread Troy Henderson
I was wondering if there is a way to place an external figure (JPG/PDF)
inside a MPpage.  The following does not work.

\startMPpage
   \externalfigure[spiral/andrew/andrew.jpg][height=4.75in]
\stopMPpage

Troy Henderson
___
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
___

Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Wolfgang Schuster

Am 04.09.2012 um 14:21 schrieb Marco Patzer home...@lavabit.com:

 Hi,
 
 I discovered strange behaviour concerning Lua conditionals within
 texdefinitions.
 
 ConTeXt complains: 'then' expected near 'thenelseend'.
 
 I guess it has something to do with how the content of a
 texdefinitions is grabbed. Seems like a bug or is this by design?

When you use the texdefinition environment to create a command
the end of line character which results normally in a space is ignored
sees “thenelseend” as a single string, in such a case you can add
a space and put a comment sign at the end of the line.

 % This one fails
 % \starttexdefinition mycmd
 %   \startluacode
 % if true then
 % else
 % end
 %   \stopluacode
 % \stoptexdefinition

\starttexdefintion mycmd
  \startluacode
if true then %
else %
end
  \stopluacode
\stoptexdefinition

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
___


Re: [NTG-context] External Figure inside MPpage

2012-09-04 Thread Wolfgang Schuster

Am 04.09.2012 um 14:23 schrieb Troy Henderson thend...@gmail.com:

 I was wondering if there is a way to place an external figure (JPG/PDF) 
 inside a MPpage.  The following does not work.
 
 \startMPpage
\externalfigure[spiral/andrew/andrew.jpg][height=4.75in]
 \stopMPpage

\startMPpage
draw externalfigure mill scaled 4.75in ;
\stopMPpage

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
___


Re: [NTG-context] External Figure inside MPpage

2012-09-04 Thread Troy Henderson
 \startMPpage
 draw externalfigure mill scaled 4.75in ;
 \stopMPpage


Excellent.  Thank you!

Troy
___
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
___

[NTG-context] \startluacode and macro names with underscores

2012-09-04 Thread Marco Patzer
Hi,

the luacode environment chokes on macro names with underscores.
Example:

\starttext
\unprotect

\def\number_two{two}

\startluacode
  userdata = userdata or { }
  function userdata.number_one() context(one) end

  -- works
  userdata.number_one()

  -- fails
  -- context.number_two()

  -- workaround
  tex.print(\\number_two)
\stopluacode

\protect
\stoptext

Why is that and what can be done to access underscored macros in the
usual way? I guess it's some catcode change from the function that
prints into the TeX stream.


Marco

___
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
___


Re: [NTG-context] \startluacode and macro names with underscores

2012-09-04 Thread Wolfgang Schuster

Am 04.09.2012 um 15:40 schrieb Marco Patzer home...@lavabit.com:

 Hi,
 
 the luacode environment chokes on macro names with underscores.
 Example:
 
 \starttext
 \unprotect
 
 \def\number_two{two}
 
 \startluacode
  userdata = userdata or { }
  function userdata.number_one() context(one) end
 
  -- works
  userdata.number_one()
 
  -- fails
  -- context.number_two()
 
  -- workaround
  tex.print(\\number_two)
 \stopluacode
 
 \protect
 \stoptext
 
 Why is that and what can be done to access underscored macros in the
 usual way? I guess it's some catcode change from the function that
 prints into the TeX stream.


Use this in your Lua code:

context.unprotect()
context.number_two()
context.protect()

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
___


Re: [NTG-context] \startluacode and macro names with underscores

2012-09-04 Thread Hans Hagen

On 4-9-2012 15:40, Marco Patzer wrote:

Hi,

the luacode environment chokes on macro names with underscores.
Example:

\starttext
\unprotect

\def\number_two{two}

\startluacode
   userdata = userdata or { }
   function userdata.number_one() context(one) end

   -- works
   userdata.number_one()

   -- fails
   -- context.number_two()

   -- workaround
   tex.print(\\number_two)
\stopluacode

\protect
\stoptext

Why is that and what can be done to access underscored macros in the
usual way? I guess it's some catcode change from the function that
prints into the TeX stream.


\starttext

\unprotect
\def\number_two{two}
\protect

\startluacode
userdata = userdata or { }
function userdata.number_one() context(one) end

userdata.number_one()

context.unprotect()
context.number_two()
context.protect()

context.pushcatcodes(prt)
context.number_two()
context.popcatcodes()

\stopluacode

\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Setting options for every n-th row in natural TABLEs

2012-09-04 Thread Hans Hagen

On 2-9-2012 20:58, Wolfgang Schuster wrote:


Am 02.09.2012 um 17:59 schrieb Aditya Mahajan adit...@umich.edu:


Hi,

On Edward Tufte's website, there is a discussion on zebra coloring in 
tables[1]. One of the suggestion is to add a horizontal rule after every third 
line or shade three lines with one background color and the remaining three 
with another background color.

Is there an easy way to do this with natural TABLEs? I can do something like:

\setupTABLE[row][1,2,3][background=color, backgroundcolor=gray]
\setupTABLE[row][7,8,9][background=color, backgroundcolor=gray]

but it requires knowing the number of lines in advance.

Aditya

[1]: http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001IV


Natural tables have “odd” and “even” keywords for \setupTABLE but none in the 
way you like it. What I would do is to use a overlay in combination with 
metapost to create the background but there is no global register to access the 
current column/row of a cell, e.g. \currenttablecolumn (this name is already 
used by tables) and \currenttablerow.


I've added 4 status macros:

\starttext

\bTABLE
\bTR
\bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
\bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
\bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
\bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD

\eTR
\bTR
\bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
\bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
\bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
\bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD

\eTR
\eTABLE

\stoptext


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
Hi,

please have a look at the following example:

\starttext

\def\cmd{%
  \def\mymacro{Foobar}
  \newtoks\mytoks
  \mytoks={mytoks}}

\startluacode
  context.cmd()
  context.mymacro()
  -- this fails
  -- context(tex.toks.mytoks)
\stopluacode

-- this works
\startluacode
  context(tex.toks.mytoks)
\stopluacode

\stoptext

Why does the first call to tex.toks.mytoks fail?

Apparently the luacode environment has to be closed for cmd to be
expanded. I guess that the call to mymacro() succeeds is a quirk due
to the face that the macro is expanded later, in contrast to tokens,
dimens and counters.

Is there a command I can use within Lua to expand a macro
immediately or to expand the pending macros to be able to access the
values like the token register in the example?


Another question which is related:

Is there a way to access the contents of the macro from within Lua
like counters and token registers?

\starttext

\newtoks\mytoks
\mytoks={Foobar}

\startluacode
  local tok = tex.toks.mytoks

  -- something like this is what I have in mind
  -- local mac = tex.macros.somemacro
\stopluacode

\stoptext

I am just interested in a text string, not a box with typeset
material. I guess that's more difficult, since macros are expanded
and not just simply read.


Marco

___
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
___


Re: [NTG-context] Setting options for every n-th row in natural TABLEs

2012-09-04 Thread Aditya Mahajan

On Tue, 4 Sep 2012, Hans Hagen wrote:


I've added 4 status macros:

\starttext

\bTABLE
   \bTR
   \bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
   \bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
   \bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
   \bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD

   \eTR
   \bTR
   \bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
   \bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
   \bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
   \bTD 
(\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD

   \eTR
\eTABLE

\stoptext


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


Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Aditya Mahajan

On Tue, 4 Sep 2012, Marco Patzer wrote:


Hi,

please have a look at the following example:

\starttext

\def\cmd{%
 \def\mymacro{Foobar}
 \newtoks\mytoks
 \mytoks={mytoks}}

\startluacode
 context.cmd()
 context.mymacro()
 -- this fails
 -- context(tex.toks.mytoks)
\stopluacode

-- this works
\startluacode
 context(tex.toks.mytoks)
\stopluacode

\stoptext

Why does the first call to tex.toks.mytoks fail?

Apparently the luacode environment has to be closed for cmd to be
expanded. I guess that the call to mymacro() succeeds is a quirk due
to the face that the macro is expanded later, in contrast to tokens,
dimens and counters.

Is there a command I can use within Lua to expand a macro
immediately or to expand the pending macros to be able to access the
values like the token register in the example?


Instead of

  context(tex.toks.mytoks)

use

  context(function () context(tex.toks.mytoks) end)

See the ConTeXt Lua Document manual for explanation.



Another question which is related:

Is there a way to access the contents of the macro from within Lua
like counters and token registers?

\starttext

\newtoks\mytoks
\mytoks={Foobar}

\startluacode
 local tok = tex.toks.mytoks

 -- something like this is what I have in mind
 -- local mac = tex.macros.somemacro
\stopluacode

\stoptext

I am just interested in a text string, not a box with typeset
material. I guess that's more difficult, since macros are expanded
and not just simply read.


AFAIK, this is not possible.

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


Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
On 2012-09-04 Aditya Mahajan adit...@umich.edu wrote:

Hi Aditya,

 Instead of
 
context(tex.toks.mytoks)
 
 use
 
context(function () context(tex.toks.mytoks) end)
 
 See the ConTeXt Lua Document manual for explanation.

Thanks. This works indeed. But what to do in the following
case? It's hard to find a proper wording for this problem which
makes searching on the net or in the documentation difficult.

\starttext

\def\cmd
  {\newdimen\mydimen
   \mydimen=50pt}

\startluacode
  context.cmd()
  if tex.dimen.mydimen  tex.dimen.textwidth then
context(is smaller)
  else
context(is not smaller)
  end
\stopluacode

\stoptext

  Is there a way to access the contents of the macro from within Lua
  like counters and token registers?
 
  […]
 
 AFAIK, this is not possible.

Thanks.


Marco

___
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
___

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Martin Schröder
2012/9/4 Marco Patzer home...@lavabit.com:
 I am just interested in a text string, not a box with typeset
 material. I guess that's more difficult, since macros are expanded
 and not just simply read.

http://tracker.luatex.org/view.php?id=682

Best
   Martin
___
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
___


Re: [NTG-context] Setting options for every n-th row in natural TABLEs

2012-09-04 Thread Sietse Brouwer
http://wiki.contextgarden.net/Command/currentTABLErow
http://wiki.contextgarden.net/Command/currentTABLEcolumn
http://wiki.contextgarden.net/Command/nofTABLErows
http://wiki.contextgarden.net/Command/nofTABLEcolumns

A bit of cutting, a bit of pasting ... the six-year-old in me is happy. :-)

--Sietse
___
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
___


Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
On 2012-09-04 Martin Schröder mar...@oneiros.de wrote:

Hi Martin,

 http://tracker.luatex.org/view.php?id=682

It seems that I just hit a very hard to solve issue which needs
not yet available support from the luatex side.

Patricks solution seems not very practical and error prone, so I
settled with this ugly but still readable workaround:

\def\cmd
{\newdimen\mydimen
 \mydimen=50pt}

\starttexdefinition action
\cmd
\startluacode
if tex.dimen.mydimen  tex.dimen.textwidth then %
context(is smaller)
else %
context(is not smaller)
end %
\stopluacode
\stoptexdefinition

\action


Marco

___
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
___

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Wolfgang Schuster

Am 04.09.2012 um 19:40 schrieb Marco Patzer home...@lavabit.com:

 On 2012-09-04 Martin Schröder mar...@oneiros.de wrote:
 
 Hi Martin,
 
 http://tracker.luatex.org/view.php?id=682
 
 It seems that I just hit a very hard to solve issue which needs
 not yet available support from the luatex side.
 
 Patricks solution seems not very practical and error prone, so I
 settled with this ugly but still readable workaround:
 
 \def\cmd
   {\newdimen\mydimen
\mydimen=50pt}
 
 \starttexdefinition action
   \cmd
   \startluacode
   if tex.dimen.mydimen  tex.dimen.textwidth then %
   context(is smaller)
   else %
   context(is not smaller)
   end %
   \stopluacode
 \stoptexdefinition
 
 \action

Is there a good reason why you put \newdimen because dimen/count etc. registers 
should always be defined once.

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
___


Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:

 Is there a good reason why you put \newdimen because dimen/count
 etc. registers should always be defined once.

The definitions are not in a macro, they are defined at the top of
the file. I messed around while creating a minimal example. However,
the problem remains the same since the assignment does not happen
within Lua.

But, thanks for the hint. I am always happy for improvements and
feedback about my code.


Marco

___
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
___


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Aditya Mahajan

On Tue, 4 Sep 2012, Wolfgang Schuster wrote:



Am 04.09.2012 um 14:21 schrieb Marco Patzer home...@lavabit.com:


Hi,

I discovered strange behaviour concerning Lua conditionals within
texdefinitions.

ConTeXt complains: 'then' expected near 'thenelseend'.

I guess it has something to do with how the content of a
texdefinitions is grabbed. Seems like a bug or is this by design?


When you use the texdefinition environment to create a command
the end of line character which results normally in a space is ignored
sees “thenelseend” as a single string, in such a case you can add
a space and put a comment sign at the end of the line.


% This one fails
% \starttexdefinition mycmd
%   \startluacode
% if true then
% else
% end
%   \stopluacode
% \stoptexdefinition


\starttexdefintion mycmd
 \startluacode
   if true then %
   else %
   end
 \stopluacode
\stoptexdefinition


Why does adding semicolon not work?

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

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Wolfgang Schuster

Am 04.09.2012 um 20:11 schrieb Marco Patzer home...@lavabit.com:

 On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:
 
 Is there a good reason why you put \newdimen because dimen/count
 etc. registers should always be defined once.
 
 The definitions are not in a macro, they are defined at the top of
 the file. I messed around while creating a minimal example. However,
 the problem remains the same since the assignment does not happen
 within Lua.
 
 But, thanks for the hint. I am always happy for improvements and
 feedback about my code.

What prevents you from setting the dimen value in Lua?

\starttext

\scratchdimen = 20pt

\the\scratchdimen

\ctxlua{tex.dimen.scratchdimen = 10pt}

\the\scratchdimen

\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
___


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Wolfgang Schuster

Am 04.09.2012 um 20:24 schrieb Aditya Mahajan adit...@umich.edu:

 Why does adding semicolon not work?

Do you have a example?

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
___


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:

  Why does adding semicolon not work?
 
 Do you have a example?


\starttext
\startluacode
  if true then;
context(true)
  else;
context(false)
  end
\stopluacode
\stoptext


Marco

___
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
___


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Herbert Voss

Am 04.09.2012 20:44, schrieb Marco Patzer:

On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:


Why does adding semicolon not work?


Do you have a example?



\starttext
\startluacode
   if true then;
 context(true)
   else;
 context(false)
   end
\stopluacode
\stoptext


that is no Lua syntax

Herbert

___
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
___


Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:

 What prevents you from setting the dimen value in Lua?

Some background:

The code is part of a smarter float placement. It takes the size of
the float into account and decides for a location. For example, it
positions the float in the margin if it fits or it prints the
caption underneath the float if the float spans the margin as well
(captions are in the margin by default in this layout).

Most of the code is written in TeX and I don't feel it's necessary
to rewrite it in Lua. I am more fluent in TeX than in Lua.

In this case a TeX helper function computes the size and saves the
results in dimen registers. I use Lua for calculations especially
when it comes to dimensions. It's a nightmare in TeX and hard to
find errors easily creep in.


Marco

___
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
___


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

Hi Herbert,

  \starttext
  \startluacode
 if true then;
   context(true)
 else;
   context(false)
 end
  \stopluacode
  \stoptext
 
 that is no Lua syntax

if true then;
  print(true)
else;
  print(false)
end

This snippet fed into a standalone Lua interpreter prints “true” on
the terminal.

I admit, I did not look up the syntax in the manual, but I have in
mind that semicolons can be used to separate statements that are on
one line.


Marco

___
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
___

Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Aditya Mahajan

On Tue, 4 Sep 2012, Herbert Voss wrote:


Am 04.09.2012 20:44, schrieb Marco Patzer:

On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:


Why does adding semicolon not work?


Do you have a example?



\starttext
\startluacode
   if true then;
 context(true)
   else;
 context(false)
   end
\stopluacode
\stoptext


that is no Lua syntax


I thought that semicolons were optional in lua are equal to end of lines.

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


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread luigi scarso
On Tue, Sep 4, 2012 at 9:05 PM, Marco Patzer home...@lavabit.com wrote:

 On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

 Hi Herbert,

   \starttext
   \startluacode
  if true then;
context(true)
  else;
context(false)
  end
   \stopluacode
   \stoptext
 
  that is no Lua syntax

 if true then;
   print(true)
 else;
   print(false)
 end

 This snippet fed into a standalone Lua interpreter prints “true” on
 the terminal.

 Not in my lua interpreter: saving the snippet into test.lua
$lua test.lua
gives
lua: test.lua:1: unexpected symbol near ';'


-- 
luigi
___
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
___

Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Herbert Voss

Am 04.09.2012 21:05, schrieb Marco Patzer:


if true then;
   print(true)
else;
   print(false)
end

This snippet fed into a standalone Lua interpreter prints “true” on
the terminal.

I admit, I did not look up the syntax in the manual, but I have in
mind that semicolons can be used to separate statements that are on
one line.


voss@shania:~/ConTeXt lua zzz.lua
lua: zzz.lua:1: unexpected symbol near ';'

voss@shania:~/ConTeXt lua -v
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

Herbert
___
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
___

Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread luigi scarso
On Tue, Sep 4, 2012 at 9:05 PM, Aditya Mahajan adit...@umich.edu wrote:

 On Tue, 4 Sep 2012, Herbert Voss wrote:

  Am 04.09.2012 20:44, schrieb Marco Patzer:

 On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:

  Why does adding semicolon not work?


 Do you have a example?



 \starttext
 \startluacode
if true then;
  context(true)
else;
  context(false)
end
 \stopluacode
 \stoptext


 that is no Lua syntax


 I thought that semicolons were optional in lua are equal to end of lines.

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



http://www.lua.org/manual/5.1/manual.html#2.4.4

The unit of execution of Lua is called a chunk. A chunk is simply a
sequence of statements, which are executed sequentially. Each statement can
be optionally followed by a semicolon:
:
:
2.4.4 - Control Structures

The control structures if, while, and repeat have the usual meaning and
familiar syntax:

stat ::= while exp do block end
stat ::= repeat block until exp
stat ::= if exp then block {elseif exp then block} [else block] end

(as conseguence
if exp then; block else; block end
is not valid
)

-- 
luigi
___
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
___

Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Herbert Voss

Am 04.09.2012 21:22, schrieb luigi scarso:


http://www.lua.org/manual/5.1/manual.html#2.4.4

The unit of execution of Lua is called a chunk. A chunk is simply a
sequence of statements, which are executed sequentially. Each statement
can be optionally followed by a semicolon:
:
:
2.4.4 - Control Structures

The control structures if, while, and repeat have the usual meaning and
familiar syntax:

stat ::= while exp do block end
stat ::= repeat block until exp
stat ::= if exp then block {elseif exp then block} [else block] end

(as conseguence
if exp then; block else; block end
is not valid
)


yes, see also: http://www.lua.org/manual/5.1/manual.html#8

Herbert

___
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
___


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

 voss@shania:~/ConTeXt lua zzz.lua
 lua: zzz.lua:1: unexpected symbol near ';'

marco@homerow:/tmp$ lua t.lua
true

 voss@shania:~/ConTeXt lua -v
 Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

marco@homerow:/tmp$ lua -v
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio


Marco

___
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
___


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Herbert Voss

Am 04.09.2012 21:35, schrieb Marco Patzer:

On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:


voss@shania:~/ConTeXt lua zzz.lua
lua: zzz.lua:1: unexpected symbol near ';'


marco@homerow:/tmp$ lua t.lua
true


voss@shania:~/ConTeXt lua -v
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio


marco@homerow:/tmp$ lua -v
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio


the syntax changes, see http://www.lua.org/manual/5.2/manual.html#9

Herbert
___
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
___


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread luigi scarso
On Tue, Sep 4, 2012 at 9:35 PM, Marco Patzer home...@lavabit.com wrote:

 On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

  voss@shania:~/ConTeXt lua zzz.lua
  lua: zzz.lua:1: unexpected symbol near ';'

 marco@homerow:/tmp$ lua t.lua
 true

  voss@shania:~/ConTeXt lua -v
  Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

 marco@homerow:/tmp$ lua -v
 Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio


Because in Lua 5.2 there is the empty statements
http://www.lua.org/manual/5.2/manual.html#3

3.3.1 – Blocks

A block is a list of statements, which are executed sequentially:

block ::= {stat}
Lua has empty statements that allow you to separate statements with
semicolons, start a block with a semicolon or write two semicolons in
sequence:

stat ::= ‘;’

So
stat ::= if exp then block {elseif exp then block} [else block] end

means that
if exp then
;
else
;
end
is valid.

Luatex still uses lua 5.1.4


-- 
luigi
___
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
___

Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

  voss@shania:~/ConTeXt lua -v
  Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
 
  marco@homerow:/tmp$ lua -v
  Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 
 the syntax changes, see http://www.lua.org/manual/5.2/manual.html#9

You're totally right. LuaTeX uses does not use lua 5.2 and therefore
the semicolon syntax is wrong. I also get an “unexpected symbol”
with lua5.1

Thanks for the clarification


Marco

___
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
___