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

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss 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

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 wrote: > On 2012-09-04 Herbert Voss 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.

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 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:/t

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

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss 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-

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

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 wrote: > On Tue, 4 Sep 2012, Herbert Voss wrote: > > Am 04.09.2012 20:44, schrieb Marco Patzer: >> >>> On 2012-09-04 Wolfgang Schuster wrote: >>> >>> Why does adding semicolon not work? > Do you have a example? >>> >>> >>> \star

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 separat

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 wrote: > On 2012-09-04 Herbert Voss wrote: > > Hi Herbert, > > > > \starttext > > > \startluacode > > >if true then; > > > context("true") > > >else; > > > context("false") > > >end > > > \stopluacode > > > \stoptext > > > > that

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 wrote: Why does adding semicolon not work? Do you have a example? \starttext \startluacode if true then; context("true") else; context("false") end \stop

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

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss 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

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
On 2012-09-04 Wolfgang Schuster 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

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

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

2012-09-04 Thread Marco Patzer
On 2012-09-04 Wolfgang Schuster 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

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

2012-09-04 Thread Wolfgang Schuster
Am 04.09.2012 um 20:24 schrieb Aditya Mahajan : > 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! maillis

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Wolfgang Schuster
Am 04.09.2012 um 20:11 schrieb Marco Patzer : > On 2012-09-04 Wolfgang Schuster 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 mes

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 : 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 t

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
On 2012-09-04 Wolfgang Schuster 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 pr

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Wolfgang Schuster
Am 04.09.2012 um 19:40 schrieb Marco Patzer : > On 2012-09-04 Martin Schröder 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

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
On 2012-09-04 Martin Schröder 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 bu

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. :-) --Sie

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Martin Schröder
2012/9/4 Marco Patzer : > 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 ___

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Marco Patzer
On 2012-09-04 Aditya Mahajan 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

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

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 (\currentTAB

[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

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

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()

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

[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() --

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@

Re: [NTG-context] External Figure inside MPpage

2012-09-04 Thread Wolfgang Schuster
Am 04.09.2012 um 14:23 schrieb 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 \startMPpage draw externalfigu

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

2012-09-04 Thread Wolfgang Schuster
Am 04.09.2012 um 14:21 schrieb 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

[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 __

[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{%

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

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

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

2012-09-04 Thread Marco Patzer
On 2012-09-04 "Rogers, Michael K" 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 ___

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 compone

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

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 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" op

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 (rea

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,

[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

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

2012-09-04 Thread Marco Patzer
On 2012-09-04 Jeong Dalyoung 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 \st

[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: en

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 unan