Re: [NTG-context] dorecurse within combination
Henning Hraban Ramm via ntg-context schrieb am 07.07.2022 um 21:25: Am 07.07.22 um 20:52 schrieb Henning Hraban Ramm via ntg-context: How can I do this? Sorry for the noise, I solved it with Lua. The cld manual even contains a combinations example. The Lua method is also simpler than a TeX based alternative. \starttext \startcollecting % \startcollect \startcombination[3*1] \stopcollect % \dorecurse{3} {\startcollect {\externalfigure[dummy]}{} \stopcollect} % \startcollect \stopcombination \stopcollect % \stopcollecting \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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] dorecurse within combination
Am 07.07.22 um 20:52 schrieb Henning Hraban Ramm via ntg-context: How can I do this? Sorry for the noise, I solved it with Lua. The cld manual even contains a combinations example. Hraban ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] dorecurse within combination
Hi, I’d like to place pages from a multipage PDF in a combination: \startcombination[3*1] \dorecurse{3}{% {\externalfigure[multipage][width=\textwidth/3,page=\recurselevel]}{} } \stopcombination That doesn’t work, because ConTeXt expects a { after \startcombination. (“A left brace was mandatory here, so I've put one in.”) I guess I need some expansion, but \expanded doesn’t help. How can I do this? Hraban ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse{}{} problem
Dear Aditya, Jairo, Wolfgang, and Otared, Thank you for the replies and explanations. I also read the blog. In this case, using '##1’ is an easy way. For more complex table, I may use luacode. Thanks again. 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse{}{} problem
Jeong Dal schrieb am 21.09.2020 um 20:54: Dear Aditya, Jairo, Wolfgang, and Otared, Thank you for the replies and explanations. I also read the blog. In this case, using '##1’ is an easy way. For more complex table, I may use luacode. I forgot the obvious \expanded solution: \starttext \starttabulate[|c|] \dorecurse{9}{\expanded{\NC \recurselevel \NC\NR}} \stoptabulate \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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] \dorecurse{}{} problem
Hi, I tried to make a table using \dorecurse or \doloop as in the example. There is no error but \recurselevel is not increased, all are 0 in the first example and only two rows are created with the \recurselevel 0 and 2 only in the second example. Does the tabulate cause the error? What is wrong in this MWE? Thank you for reading. Best regards, Dalyoung * \startbuffer[AdjacencyList1] \starttabulate[|c|cw(2cm)|] \HL \dorecurse{8} {\NC \recurselevel \NC \NC\NR \HL} \stoptabulate \stopbuffer \startbuffer[AdjacencyList2] \starttabulate[|c|cw(2cm)|] \HL \doloop{ \ifnum \recurselevel=7 \exitloop \fi \NC \recurselevel \NC \NC\NR \HL } \stoptabulate \stopbuffer \starttext \getbuffer[AdjacencyList1] \getbuffer[AdjacencyList2] \stoptext > 2020. 9. 21. 오후 10:50, ntg-context-requ...@ntg.nl 작성: > > Send ntg-context mailing list submissions to > ntg-context@ntg.nl > > To subscribe or unsubscribe via the World Wide Web, visit > https://mailman.ntg.nl/mailman/listinfo/ntg-context > or, via email, send a message with subject or body 'help' to > ntg-context-requ...@ntg.nl > > You can reach the person managing the list at > ntg-context-ow...@ntg.nl > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of ntg-context digest..." > > > Today's Topics: > > 1. Parallel text support (Denis Maier) > 2. Re: Parallel text support (Taco Hoekwater) > 3. Re: ZapfDingbats Unicode differences MKIV vs LMTX > (Christoph Reller) > 4. Re: ZapfDingbats Unicode differences MKIV vs LMTX (Hans Hagen) > 5. Math fonts for Nimbus fonts (Otared Kavian) > 6. Re: 2020 Meeting recordings? (Taco Hoekwater) > > > -- > > Message: 1 > Date: Mon, 21 Sep 2020 12:21:37 +0200 > From: Denis Maier > To: ntg-context@ntg.nl > Subject: [NTG-context] Parallel text support > Message-ID: <780fe43c-f2c3-6ea1-04f5-d4d5c22e7...@mailbox.org> > Content-Type: text/plain; charset=utf-8; format=flowed > > Hi, > > I'm trying to typeset a parallel text that should appear in columns. The > sources are XML, and there I have to use tables for this. So, I thought > the easiest way is to use extreme tables for this: > > = > \starttext > > \dorecurse{3}{\input knuth} > > \startxtable[split=yes,frame=off] > \startxrow > \startxcell Text \stopxcell > \startxcell Übersetzung \stopxcell > \stopxrow > \startxrow > \startxcell \input ward \stopxcell > \startxcell \input tufte \stopxcell > \stopxrow > \stopxtable > > \stoptext > = > > However, as it turns out, split only seems to mean that the table is > split between rows, individual rows stay on the same page. > > Is there a better approach? I've found the page-streams, but that seems > to be too much... > > Best, > Denis > > > -- > > Message: 2 > Date: Mon, 21 Sep 2020 13:58:11 +0200 > From: Taco Hoekwater > To: mailing list for ConTeXt users > Subject: Re: [NTG-context] Parallel text support > Message-ID: > Content-Type: text/plain; charset=utf-8 > > > >> On 21 Sep 2020, at 12:21, Denis Maier wrote: >> >> >> However, as it turns out, split only seems to mean that the table is split >> between rows, individual rows stay on the same page. >> >> Is there a better approach? I've found the page-streams, but that seems to >> be too much… > > \starttabulate > > > > -- > > Message: 3 > Date: Mon, 21 Sep 2020 14:55:02 +0200 > From: Christoph Reller > To: Hans Hagen > Cc: mailing list for ConTeXt users > Subject: Re: [NTG-context] ZapfDingbats Unicode differences MKIV vs > LMTX > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > On Sat, Sep 19, 2020 at 12:04 PM Hans Hagen wrote: > >> On 9/19/2020 6:18 AM, Christoph Reller wrote: >>> On Fri, Sep 18, 2020 at 4:17 PM Hans Hagen >> <mailto:j.ha...@xs4all.nl>> wrote: >>> >>>On 9/18/2020 11:23 AM, Christoph Reller wrote: >>> >> \definefontsynonym[ZapfDingbats][file:ZapfDingbats][features=dingbats] >>>> \usemodule [fnt-10] >>>> \starttext >>>> (1) \getglyphdirect{ZapfDingbats}{61491}\crlf % MKIV log: char >>>> (U+0F033) in font 'ZapfDingbats-4' with id 8: missing >>>> (2) \getglyphdirect{ZapfDingbats}{983059} % LMTX log: char >>>> (U+F0013) in font 'ZapfDingbats-4' with id 8: missing >>>> \ShowCompleteFon
Re: [NTG-context] \dorecurse{}{} problem
> On 21 Sep 2020, at 16:42, Aditya Mahajan wrote: > > On Mon, 21 Sep 2020, Wolfgang Schuster wrote: > >> Aditya Mahajan schrieb am 21.09.2020 um 16:35: >>> […] > > You gave the same reply 11 years ago :-) which is also listed in the blog > post. … Which shows that some things don't change in ConTeXt :-) Kidding aside, why is there a difference between the tabulate mechanism and the xtable mechanism? Best regards: Otared K. ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse{}{} problem
On Mon, 21 Sep 2020, Wolfgang Schuster wrote: > Aditya Mahajan schrieb am 21.09.2020 um 16:35: > > On Mon, 21 Sep 2020, Jeong Dal wrote: > > > > > Hi, > > > > > > I tried to make a table using \dorecurse or \doloop as in the example. > > > There is no error but \recurselevel is not increased, all are 0 in the > > > first example and only two rows are created with the \recurselevel 0 and 2 > > > only in the second example. > > > > > > Does the tabulate cause the error? > > > What is wrong in this MWE? > > \dorecurse does not expand its arguments. See this old blog post for a > > discussion on this: > > > > https://adityam.github.io/context-blog/post/tex-programming/ > > \starttext > > \starttabulate[|c|] > \dorecurse{8}{\NC ##1 \NC\NR} > \stoptabulate > > \stoptext You gave the same reply 11 years ago :-) which is also listed in the blog post. 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse{}{} problem
Hi Dalyoung, I don't know why \recurselevel returns 0 inside a tabulate environment, but the following works fine: \starttext \startxtable[frame=off,bottomframe=on,width=1cm,align={middle,lohi}] \startxrow\startxcell \stopxcell\stopxrow % just to have a line on the top of the first row \dorecurse{8} {\startxrow\startxcell \recurselevel \stopxcell\stopxrow} \stopxtable \stoptext Best regards: Otared K. > On 21 Sep 2020, at 16:07, Jeong Dal wrote: > > Hi, > > I tried to make a table using \dorecurse or \doloop as in the example. > There is no error but \recurselevel is not increased, all are 0 in the first > example and only two rows are created with the \recurselevel 0 and 2 only in > the second example. > > Does the tabulate cause the error? > What is wrong in this MWE? > > Thank you for reading. > > Best regards, > > Dalyoung > > * > \startbuffer[AdjacencyList1] > \starttabulate[|c|cw(2cm)|] > \HL > \dorecurse{8} >{\NC \recurselevel \NC \NC\NR \HL} > \stoptabulate > \stopbuffer > > \startbuffer[AdjacencyList2] > \starttabulate[|c|cw(2cm)|] > \HL > \doloop{ >\ifnum \recurselevel=7 > \exitloop >\fi >\NC \recurselevel \NC \NC\NR \HL > } > \stoptabulate > \stopbuffer > > \starttext > \getbuffer[AdjacencyList1] > > \getbuffer[AdjacencyList2] > \stoptext > >> 2020. 9. 21. 오후 10:50, ntg-context-requ...@ntg.nl 작성: >> >> Send ntg-context mailing list submissions to >> ntg-context@ntg.nl >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://mailman.ntg.nl/mailman/listinfo/ntg-context >> or, via email, send a message with subject or body 'help' to >> ntg-context-requ...@ntg.nl >> >> You can reach the person managing the list at >> ntg-context-ow...@ntg.nl >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of ntg-context digest..." >> >> >> Today's Topics: >> >> 1. Parallel text support (Denis Maier) >> 2. Re: Parallel text support (Taco Hoekwater) >> 3. Re: ZapfDingbats Unicode differences MKIV vs LMTX >> (Christoph Reller) >> 4. Re: ZapfDingbats Unicode differences MKIV vs LMTX (Hans Hagen) >> 5. Math fonts for Nimbus fonts (Otared Kavian) >> 6. Re: 2020 Meeting recordings? (Taco Hoekwater) >> >> >> -- >> >> Message: 1 >> Date: Mon, 21 Sep 2020 12:21:37 +0200 >> From: Denis Maier >> To: ntg-context@ntg.nl >> Subject: [NTG-context] Parallel text support >> Message-ID: <780fe43c-f2c3-6ea1-04f5-d4d5c22e7...@mailbox.org> >> Content-Type: text/plain; charset=utf-8; format=flowed >> >> Hi, >> >> I'm trying to typeset a parallel text that should appear in columns. The >> sources are XML, and there I have to use tables for this. So, I thought >> the easiest way is to use extreme tables for this: >> >> = >> \starttext >> >> \dorecurse{3}{\input knuth} >> >> \startxtable[split=yes,frame=off] >> \startxrow >> \startxcell Text \stopxcell >> \startxcell Übersetzung \stopxcell >> \stopxrow >> \startxrow >> \startxcell \input ward \stopxcell >> \startxcell \input tufte \stopxcell >> \stopxrow >> \stopxtable >> >> \stoptext >> = >> >> However, as it turns out, split only seems to mean that the table is >> split between rows, individual rows stay on the same page. >> >> Is there a better approach? I've found the page-streams, but that seems >> to be too much... >> >> Best, >> Denis >> >> >> -- >> >> Message: 2 >> Date: Mon, 21 Sep 2020 13:58:11 +0200 >> From: Taco Hoekwater >> To: mailing list for ConTeXt users >> Subject: Re: [NTG-context] Parallel text support >> Message-ID: >> Content-Type: text/plain;charset=utf-8 >> >> >> >>> On 21 Sep 2020, at 12:21, Denis Maier wrote: >>> >>> >>> However, as it turns out, split only seems to mean that the table is split >>> between rows, individual rows stay on the same page. >>> >>> Is there a better approach? I've found the page-streams, but that seems to >>> be too much… >> >> \starttabulate >> >> >> >> -- >> >> Message: 3 >> Date: Mon, 21
Re: [NTG-context] \dorecurse{}{} problem
Aditya Mahajan schrieb am 21.09.2020 um 16:35: On Mon, 21 Sep 2020, Jeong Dal wrote: Hi, I tried to make a table using \dorecurse or \doloop as in the example. There is no error but \recurselevel is not increased, all are 0 in the first example and only two rows are created with the \recurselevel 0 and 2 only in the second example. Does the tabulate cause the error? What is wrong in this MWE? \dorecurse does not expand its arguments. See this old blog post for a discussion on this: https://adityam.github.io/context-blog/post/tex-programming/ \starttext \starttabulate[|c|] \dorecurse{8}{\NC ##1 \NC\NR} \stoptabulate \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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse{}{} problem
Hi, Using ##1 instead of \recurselevel makes it work in this specific case if you want a quick and dirty solution. It seems to be a thing with nesting, as using #1 complains. I'd prefer the solutions as shown by Aditya: constructing tables via Lua, etc. Regards, Jairo El lun., 21 de sep. de 2020 a la(s) 09:16, Jeong Dal (hak...@me.com) escribió: > Hi, > > I tried to make a table using \dorecurse or \doloop as in the example. > There is no error but \recurselevel is not increased, all are 0 in the > first example and only two rows are created with the \recurselevel 0 and 2 > only in the second example. > > Does the tabulate cause the error? > What is wrong in this MWE? > > Thank you for reading. > > Best regards, > > Dalyoung > > * > \startbuffer[AdjacencyList1] > \starttabulate[|c|cw(2cm)|] > \HL > \dorecurse{8} > {\NC \recurselevel \NC \NC\NR \HL} > \stoptabulate > \stopbuffer > > \startbuffer[AdjacencyList2] > \starttabulate[|c|cw(2cm)|] > \HL > \doloop{ > \ifnum \recurselevel=7 > \exitloop > \fi > \NC \recurselevel \NC \NC\NR \HL > } > \stoptabulate > \stopbuffer > > \starttext > \getbuffer[AdjacencyList1] > > \getbuffer[AdjacencyList2] > \stoptext > > 2020. 9. 21. 오후 10:50, ntg-context-requ...@ntg.nl 작성: > > Send ntg-context mailing list submissions to > ntg-context@ntg.nl > > To subscribe or unsubscribe via the World Wide Web, visit > https://mailman.ntg.nl/mailman/listinfo/ntg-context > or, via email, send a message with subject or body 'help' to > ntg-context-requ...@ntg.nl > > You can reach the person managing the list at > ntg-context-ow...@ntg.nl > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of ntg-context digest..." > > > Today's Topics: > > 1. Parallel text support (Denis Maier) > 2. Re: Parallel text support (Taco Hoekwater) > 3. Re: ZapfDingbats Unicode differences MKIV vs LMTX > (Christoph Reller) > 4. Re: ZapfDingbats Unicode differences MKIV vs LMTX (Hans Hagen) > 5. Math fonts for Nimbus fonts (Otared Kavian) > 6. Re: 2020 Meeting recordings? (Taco Hoekwater) > > > -- > > Message: 1 > Date: Mon, 21 Sep 2020 12:21:37 +0200 > From: Denis Maier > To: ntg-context@ntg.nl > Subject: [NTG-context] Parallel text support > Message-ID: <780fe43c-f2c3-6ea1-04f5-d4d5c22e7...@mailbox.org> > Content-Type: text/plain; charset=utf-8; format=flowed > > Hi, > > I'm trying to typeset a parallel text that should appear in columns. The > sources are XML, and there I have to use tables for this. So, I thought > the easiest way is to use extreme tables for this: > > = > \starttext > > \dorecurse{3}{\input knuth} > > \startxtable[split=yes,frame=off] > \startxrow > \startxcell Text \stopxcell > \startxcell Übersetzung \stopxcell > \stopxrow > \startxrow > \startxcell \input ward \stopxcell > \startxcell \input tufte \stopxcell > \stopxrow > \stopxtable > > \stoptext > = > > However, as it turns out, split only seems to mean that the table is > split between rows, individual rows stay on the same page. > > Is there a better approach? I've found the page-streams, but that seems > to be too much... > > Best, > Denis > > > -- > > Message: 2 > Date: Mon, 21 Sep 2020 13:58:11 +0200 > From: Taco Hoekwater > To: mailing list for ConTeXt users > Subject: Re: [NTG-context] Parallel text support > Message-ID: > Content-Type: text/plain; charset=utf-8 > > > > On 21 Sep 2020, at 12:21, Denis Maier > wrote: > > > However, as it turns out, split only seems to mean that the table is split > between rows, individual rows stay on the same page. > > Is there a better approach? I've found the page-streams, but that seems to > be too much… > > > \starttabulate > > > > -- > > Message: 3 > Date: Mon, 21 Sep 2020 14:55:02 +0200 > From: Christoph Reller > To: Hans Hagen > Cc: mailing list for ConTeXt users > Subject: Re: [NTG-context] ZapfDingbats Unicode differences MKIV vs > LMTX > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > On Sat, Sep 19, 2020 at 12:04 PM Hans Hagen wrote: > > On 9/19/2020 6:18 AM, Christoph Reller wrote: > > On Fri, Sep 18, 2020 at 4:17 PM Hans Hagen <mailto:j.ha...@xs4all.nl>> wrote: > >On 9/18/2020 11:23 AM, Christoph Reller wrote: > > \definefontsynonym[ZapfDingbats][file:ZapfDingbats][features=dingbats]
Re: [NTG-context] \dorecurse{}{} problem
On Mon, 21 Sep 2020, Jeong Dal wrote: > Hi, > > I tried to make a table using \dorecurse or \doloop as in the example. > There is no error but \recurselevel is not increased, all are 0 in the first > example and only two rows are created with the \recurselevel 0 and 2 only in > the second example. > > Does the tabulate cause the error? > What is wrong in this MWE? \dorecurse does not expand its arguments. See this old blog post for a discussion on this: https://adityam.github.io/context-blog/post/tex-programming/ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \recursestring undefined when inside \dorecurse
On 6/14/2020 11:41 PM, Pablo Rodriguez wrote: Dear list, I have the following sample: \starttext \dorecurse{25}{\recurselevel\par} \doloopoverstring{a,b,c}{\recursestring} } \stoptext Both LMTX and MkIV complain about \recursestring for being undefined. I wonder whether this is inteded or it is a bug. intended, as there is no \doloopoverstring, it's \doloopoverlist {red,green,blue} { [\recursestring] } (btw, you have one } too many) - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] \recursestring undefined when inside \dorecurse
Dear list, I have the following sample: \starttext \dorecurse{25}{\recurselevel\par} \doloopoverstring{a,b,c}{\recursestring} } \stoptext Both LMTX and MkIV complain about \recursestring for being undefined. I wonder whether this is inteded or it is a bug. Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] \beginBLOCKS and \endBLOCKS do not work in \dorecurse
Hi, I cannot make \beginBLOCKS and \endBLOCKS work in a \dorecurse loop. Is it possible? Here is a minimum non working exemple (from https://wiki.contextgarden.net/Command/defineblock): %% \startdocument \defineblock[question] \hideblocks[question] % We don't want to print blocks where we define them \dorecurse{2}{ \beginquestion[first] To be, or not to be? \endquestion \section{Let's see what blocks we've got.} \useblocks[question] \section{We've seen what blocks we've got. Let's take another look at that first question.} \useblocks[question][first] \beginquestion[last] Mais o\`u sont les neiges d'antan? \endquestion } \stopdocument %% Thank you in advance. Best. -- Romain Diss ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] dorecurse problem
> On 20 Jan 2017, at 18:00, Rik Kabelwrote: > […] > > Otared, > > I am not sure what you are doing, but if you are using only the code snippet > that Hans posted, you will get a blank page. You have to define the layer and > page background in addition to Hans' snippet. Oh yes… sorry, I am ashamed :-( I just put the code sent by Hans below your’s, and then commented out your code, including the definition of layers and backgounds… Indeed everything works as expected with a buffer. Best regards: OK ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] dorecurse problem
On 2017-01-20 11:42, Otared Kavian wrote: Hi Hans, Unfortunately your workaround with \getbuffer does not produce the correct page: it gives only a blank page. Thanks for your attention: OK On 20 Jan 2017, at 10:08, Hans Hagen <pra...@wxs.nl> wrote: On 1/20/2017 8:59 AM, Aditya Mahajan wrote: On Thu, 19 Jan 2017, Rik Kabel wrote: ConTeXters, When \dorecurse is active in the following MWE, the lines of text are overprinted. At least, this is the case for me, please confirm it for yourself. When \dorecurse is disabled, the lines print as they should, separately. Please tell me what I am doing wrong with this, if anything, and how to fix it. (Running ConTeXt ver: 2017.01.17 17:37 MKIV beta fmt: 2017.1.19 on Win10 x64. There are no errors in the log.) This has nothing to do with \dorecurse, but due to the fact that the argument of \dorecurse or any macro is parsed before the catcode changes introduced by \startlines come into effect. Here is a simpler example demonstrating similar behavior: \def\test#1{#1} \starttext \test{Something \startlines Line one Line two \stoplines} \stoptext Depending on what you want to do, it should be possible to come up with a workaround. \startbuffer \startstandardmakeup \setlayerframed [blocks] [preset=lefttop, frame=off, align=right]{ \startlines Line one on the left Line two on the left \stoplines } \setlayerframed [blocks] [preset=righttop, frame=off, align=flushright]{ \startlines thgir eht no eno eniL thgir eht no owt eniL \stoplines } \stopstandardmakeup \stopbuffer \dorecurse{1}{ \getbuffer } ___ Hans and Aditya, Thank you for the explanation and the workaround. Otared, I am not sure what you are doing, but if you are using only the code snippet that Hans posted, you will get a blank page. You have to define the layer and page background in addition to Hans' snippet. --- Rik ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] dorecurse problem
Hi Hans, Unfortunately your workaround with \getbuffer does not produce the correct page: it gives only a blank page. Thanks for your attention: OK > On 20 Jan 2017, at 10:08, Hans Hagen <pra...@wxs.nl> wrote: > > On 1/20/2017 8:59 AM, Aditya Mahajan wrote: >> On Thu, 19 Jan 2017, Rik Kabel wrote: >> >>> ConTeXters, >>> >>> When \dorecurse is active in the following MWE, the lines of text are >>> overprinted. At least, this is the case for me, please confirm it for >>> yourself. When \dorecurse is disabled, the lines print as they should, >>> separately. Please tell me what I am doing wrong with this, if >>> anything, and how to fix it. (Running ConTeXt ver: 2017.01.17 17:37 >>> MKIV beta fmt: 2017.1.19 on Win10 x64. There are no errors in the log.) >> >> This has nothing to do with \dorecurse, but due to the fact that the >> argument of \dorecurse or any macro is parsed before the catcode changes >> introduced by \startlines come into effect. Here is a simpler example >> demonstrating similar behavior: >> >> \def\test#1{#1} >> >> \starttext >> \test{Something >> \startlines >> Line one >> Line two >> \stoplines} >> \stoptext >> >> Depending on what you want to do, it should be possible to come up with >> a workaround. > > \startbuffer > \startstandardmakeup >\setlayerframed > [blocks] > [preset=lefttop, > frame=off, > align=right]{ > \startlines >Line one on the left >Line two on the left > \stoplines >} >\setlayerframed > [blocks] > [preset=righttop, > frame=off, > align=flushright]{ > \startlines >thgir eht no eno eniL >thgir eht no owt eniL > \stoplines >} > \stopstandardmakeup > \stopbuffer > >\dorecurse{1}{ >\getbuffer >} > > - > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] dorecurse problem
On 1/20/2017 8:59 AM, Aditya Mahajan wrote: On Thu, 19 Jan 2017, Rik Kabel wrote: ConTeXters, When \dorecurse is active in the following MWE, the lines of text are overprinted. At least, this is the case for me, please confirm it for yourself. When \dorecurse is disabled, the lines print as they should, separately. Please tell me what I am doing wrong with this, if anything, and how to fix it. (Running ConTeXt ver: 2017.01.17 17:37 MKIV beta fmt: 2017.1.19 on Win10 x64. There are no errors in the log.) This has nothing to do with \dorecurse, but due to the fact that the argument of \dorecurse or any macro is parsed before the catcode changes introduced by \startlines come into effect. Here is a simpler example demonstrating similar behavior: \def\test#1{#1} \starttext \test{Something \startlines Line one Line two \stoplines} \stoptext Depending on what you want to do, it should be possible to come up with a workaround. \startbuffer \startstandardmakeup \setlayerframed [blocks] [preset=lefttop, frame=off, align=right]{ \startlines Line one on the left Line two on the left \stoplines } \setlayerframed [blocks] [preset=righttop, frame=off, align=flushright]{ \startlines thgir eht no eno eniL thgir eht no owt eniL \stoplines } \stopstandardmakeup \stopbuffer \dorecurse{1}{ \getbuffer } - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] dorecurse problem
On Thu, 19 Jan 2017, Rik Kabel wrote: ConTeXters, When \dorecurse is active in the following MWE, the lines of text are overprinted. At least, this is the case for me, please confirm it for yourself. When \dorecurse is disabled, the lines print as they should, separately. Please tell me what I am doing wrong with this, if anything, and how to fix it. (Running ConTeXt ver: 2017.01.17 17:37 MKIV beta fmt: 2017.1.19 on Win10 x64. There are no errors in the log.) This has nothing to do with \dorecurse, but due to the fact that the argument of \dorecurse or any macro is parsed before the catcode changes introduced by \startlines come into effect. Here is a simpler example demonstrating similar behavior: \def\test#1{#1} \starttext \test{Something \startlines Line one Line two \stoplines} \stoptext Depending on what you want to do, it should be possible to come up with a workaround. 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] dorecurse problem
Hi Rik, I can confirm the behaviour you are reporting (even without \startstandardmakeup—\stopstandardmakeup, but adding a line of text in the document in order to have an output). It seems that \dorecurse suppresses the passage to another line, since if one says \dorecurse{10} the texts in the framed layer are typeset ten times on the same line, as if the command \startlines were not there. Best regards: OK > On 20 Jan 2017, at 04:34, Rik Kabel <cont...@rik.users.panix.com> wrote: > > ConTeXters, > > When \dorecurse is active in the following MWE, the lines of text are > overprinted. At least, this is the case for me, please confirm it for > yourself. When \dorecurse is disabled, the lines print as they should, > separately. Please tell me what I am doing wrong with this, if anything, and > how to fix it. (Running ConTeXt ver: 2017.01.17 17:37 MKIV beta fmt: > 2017.1.19 on Win10 x64. There are no errors in the log.) > > \definelayer > [blocks] > [width=\textwidth, > height=\textheight] > > \setupbackgrounds > [page] > [background=blocks] > > \starttext > \dorecurse{1}{ % comment to clear error > \startstandardmakeup > \setlayerframed > [blocks] > [preset=lefttop, >frame=off, >align=right]{ > \startlines > Line one on the left > Line two on the left > \stoplines > } > \setlayerframed > [blocks] > [preset=righttop, >frame=off, >align=flushright]{ > \startlines > thgir eht no eno eniL > thgir eht no owt eniL > \stoplines > } > \stopstandardmakeup > } % comment to clear error > \stoptext > > -- > Rik ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] dorecurse problem
ConTeXters, When \dorecurse is active in the following MWE, the lines of text are overprinted. At least, this is the case for me, please confirm it for yourself. When \dorecurse is disabled, the lines print as they should, separately. Please tell me what I am doing wrong with this, if anything, and how to fix it. (Running ConTeXt ver: 2017.01.17 17:37 MKIV beta fmt: 2017.1.19 on Win10 x64. There are no errors in the log.) \definelayer [blocks] [width=\textwidth, height=\textheight] \setupbackgrounds [page] [background=blocks] \starttext \dorecurse{1}{ % comment to clear error \startstandardmakeup \setlayerframed [blocks] [preset=lefttop, frame=off, align=right]{ \startlines Line one on the left Line two on the left \stoplines } \setlayerframed [blocks] [preset=righttop, frame=off, align=flushright]{ \startlines thgir eht no eno eniL thgir eht no owt eniL \stoplines } \stopstandardmakeup } % comment to clear error \stoptext -- Rik ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \startanimation and \dorecurse
Dear Wolfgang, According to your advice, I am able to make a working example as following. \usemodule[animation] \setupinteraction[state=start] \startuseMPgraphic{Circles}{s} numeric sn, L, N; path p, q; p := fullcircle scaled 72; L:=length p; N:=20; sn := \MPvar{s}; q := subpath (0, sn/N*L) of p;% draw q withcolor red; fill fullcircle scaled 3 shifted point length q of q withcolor blue; setbounds currentpicture to unitsquare shifted (-0.5,-0.5) scaled 75; \stopuseMPgraphic \starttext \startanimation[menu=yes, menucolor=blue, framerate=5] \dorecurse{20} {\expanded{\frame{ \useMPgraphic{Circles}{s=\recurselevel \stopanimation \stoptext One more question. In metafun document, there is a command \setupMPvariables before \startuseMPgraphic. But we don’t use it in this example. Hence I think that it is not necessary always. Is there any case in which we have set the MPvariables? 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] \startanimation and \dorecurse
Dear Wolfgang, Thank you for a nice solution. I applied your method to produce an animation which draw a circle using the following: \usemodule[animation] \setupinteraction[state=start] \startuseMPgraphic{Circles}{s} numeric sn, L, N; path p, q; p := fullcircle scaled 72; L:=length p; N:=20; sn:= \MPvar{s}; q := subpath (0, sn/N*L) of p;% draw q withcolor red; fill fullcircle scaled 3 shifted point length q of q withcolor blue; setbounds currentpicture to unitsquare shifted (-0.5,-0.5) scaled 75; \stopuseMPgraphic \starttext \startanimation \dorecurse{20} {\startexpanded %\setupMPvariables[Circles][s] \useMPgraphic{Circles}{s=\recurselevel} \stopexpanded} \stopanimation \stoptext %% However, it just draw 20 figures instead of making an animation. Would you please tell me what is wrong in the above code? 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] \startanimation and \dorecurse
Am 21.10.2014 um 14:08 schrieb Jeong Dal hak...@me.com: Dear Wolfgang, Thank you for a nice solution. I applied your method to produce an animation which draw a circle using the following: \usemodule[animation] \setupinteraction[state=start] \startuseMPgraphic{Circles}{s} numeric sn, L, N; path p, q; p := fullcircle scaled 72; L:=length p; N:=20; sn:= \MPvar{s}; q := subpath (0, sn/N*L) of p;% draw q withcolor red; fill fullcircle scaled 3 shifted point length q of q withcolor blue; setbounds currentpicture to unitsquare shifted (-0.5,-0.5) scaled 75; \stopuseMPgraphic \starttext \startanimation \dorecurse{20} {\startexpanded %\setupMPvariables[Circles][s] \useMPgraphic{Circles}{s=\recurselevel} \stopexpanded} \stopanimation \stoptext %% However, it just draw 20 figures instead of making an animation. Would you please tell me what is wrong in the above code? You have to put each meatiest graphic into a frame, there are three ways to create a frame. 1. Use braces around the frame \startanimation {First frame} {Second frame} {Third frame} \stopanimation This method doesn’t work in your case where you use \dorecurse to create the graphics. 2. Use the \frame command. \startanimation \frame{First frame} \frame{Second frame} \frame{Third frame} \stopanimation In this case the \frame command is used store the content for each frame, this can be used when you create all frames with a loop like in your case, e.g. \dorecurse{10}{\expanded{\frame{\useMPPgraphic{…}{var=\recurselevel 3. Use the \startframe environment. \startanimation \startframe First frame \stopframe \startframe Second frame \stopframe \startframe Third frame \stopframe \stopaniamtion This is the same as the second method except that you use star/stop delimiters for each frame content instead of putting it into a argument. 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 ___
[NTG-context] \startanimation and \dorecurse
Hi, I tested the following simple code to generate enlarging circles as a test of animation. But it just draw 5 circles in a row. \usemodule[animation] \setupinteraction[state=start] \startbuffer[Circles] numeric u; u:= 1cm; draw fullcircle scaled \MPrawvar{Circles}{s}u; \stopbuffer \starttext \startanimation { \dorecurse{5}{% \setupMPvariables[Circles][s=\recurselevel] \processMPbuffer [Circles] }} \stopanimation \stoptext It seems to me that \startanimation just treat the figures {\dorecurse … } as just one figure. Is there a way to treat it 5 figures to generate animation? 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] \startanimation and \dorecurse
Am 20.10.2014 um 13:32 schrieb Jeong Dal hak...@me.com: Hi, I tested the following simple code to generate enlarging circles as a test of animation. But it just draw 5 circles in a row. \usemodule[animation] \setupinteraction[state=start] \startbuffer[Circles] numeric u; u:= 1cm; draw fullcircle scaled \MPrawvar{Circles}{s}u; \stopbuffer \starttext \startanimation { \dorecurse{5}{% \setupMPvariables[Circles][s=\recurselevel] \processMPbuffer [Circles] }} \stopanimation \stoptext It seems to me that \startanimation just treat the figures {\dorecurse … } as just one figure. Is there a way to treat it 5 figures to generate animation? Thank you for reading. 1. You have to expand the \recurselevel value. 2. Don’t put braces around \dorecurse because when \startanimation sees a opening braces it assumes you want to put each frame into a group of braces. Variant 1: \usemodule[animation] \setupinteraction[state=start] \startbuffer[Circles] numeric u; u:= 1cm; draw fullcircle scaled \MPrawvar{Circles}{s}u; \stopbuffer \starttext \startanimation \dorecurse{5} {\startexpanded \startframe \setupMPvariables[Circles][s=\recurselevel] \processMPbuffer [Circles] \stopframe \stopexpanded} \stopanimation \stoptext Variant 2: \usemodule[animation] \setupinteraction[state=start] \startuseMPgraphic{Circles}{s} numeric u; u:= 1cm; draw fullcircle scaled \MPvar{s}u; \stopuseMPgraphic \starttext \startanimation \dorecurse{5} {\startexpanded \frame{\useMPgraphic{Circles}{s=\recurselevel}}% \stopexpanded} \stopanimation \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] reset blocks with dorecurse
Please, can someone provide some assistance in resolving this problem, if possible. I need to prepare a worksheet for Friday and I'm having this problem, ie, each worksheet show the hints and the answers of all worksheets. thanks in advance Jorge 2014/1/14 DesdeChaves desdecha...@gmail.com Is there a way to empty the blocks after each recurse cycle. If i make three exams with the command \dorecurse[3], in the first exam i found the hints and the answers of all exams. I try with the commands \resetnumber[hint, answer], but don't work. begin question-hint-answer-blocks.tex \defineblock[question] \defineblock[hint] \defineblock[answer] \defineenumeration[question] [alternative=hanging, width=2.5cm, text={Question}, headstyle={\bi}, stopper={.}] \defineenumeration[hint] [alternative=hanging, width=4cm, text={Hint for question}, headstyle={\bi}, stopper={.}] \defineenumeration[answer] [alternative=hanging,width=4.5cm, text={Answer to question}, headstyle={\bi}, stopper={.}] \setupblock[question][before={\startquestion},after={\stopquestion}] \setupblock[hint][before={\starthint},after={\stophint}] \setupblock[answer][before={\startanswer},after={\stopanswer}] \keepblocks[question] \hideblocks[hint] \hideblocks[answer] \startsetups examn:make \resetnumber[answer] \resetnumber[question] \resetnumber[hint] \page \setcounter[userpage][1] \centerline{\kap{Maths}} \centerline{\kap{Worksheet}} \crlf Name:\thinrules[n=1]%, interlinespace=big] Evaluation:\thinrules[n=1]%, interlinespace=big] \getbuffer[examn] \stopsetups \starttext \setuppagenumbering[state=stop] \startbuffer[examn] \section{Questions} \beginquestion Compute $4\times 5$. \endquestion \beginhint Use the fact that $2\times 5 = 10$. \endhint \beginanswer $20$. \endanswer \beginquestion What is the value of $100 / 10$? \endquestion \beginhint Remember that $10\times 10 = 100$. \endhint \beginanswer $10$ \endanswer \section{Hints to all questions} \useblocks[hint] \section{Answers to all questions} \useblocks[answer] \setuppagenumber[number=1] \stopbuffer \setuprandomize[124] % set a seed \dorecurse{3} {\setups[examn:make]} \stoptext Thanks a lot Jorge -- Atentamente DesdeChaves ___ 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] reset blocks with dorecurse
Am 15.01.2014 um 15:06 schrieb DesdeChaves desdecha...@gmail.com: Please, can someone provide some assistance in resolving this problem, if possible. I need to prepare a worksheet for Friday and I'm having this problem, ie, each worksheet show the hints and the answers of all worksheets. There is no command to reset a block, to create the different worksheets you have to process your document three times (don’t forget to delete the temporary files because the randomseed won’t change otherwise). 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] reset blocks with dorecurse
Thank you. Jorge 2014/1/15 Wolfgang Schuster schuster.wolfg...@gmail.com Am 15.01.2014 um 15:06 schrieb DesdeChaves desdecha...@gmail.com: Please, can someone provide some assistance in resolving this problem, if possible. I need to prepare a worksheet for Friday and I'm having this problem, ie, each worksheet show the hints and the answers of all worksheets. There is no command to reset a block, to create the different worksheets you have to process your document three times (don’t forget to delete the temporary files because the randomseed won’t change otherwise). 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 ___ -- Atentamente DesdeChaves ___ 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] reset blocks with dorecurse
Is there a way to empty the blocks after each recurse cycle. If i make three exams with the command \dorecurse[3], in the first exam i found the hints and the answers of all exams. I try with the commands \resetnumber[hint, answer], but don't work. begin question-hint-answer-blocks.tex \defineblock[question] \defineblock[hint] \defineblock[answer] \defineenumeration[question] [alternative=hanging, width=2.5cm, text={Question}, headstyle={\bi}, stopper={.}] \defineenumeration[hint] [alternative=hanging, width=4cm, text={Hint for question}, headstyle={\bi}, stopper={.}] \defineenumeration[answer] [alternative=hanging,width=4.5cm, text={Answer to question}, headstyle={\bi}, stopper={.}] \setupblock[question][before={\startquestion},after={\stopquestion}] \setupblock[hint][before={\starthint},after={\stophint}] \setupblock[answer][before={\startanswer},after={\stopanswer}] \keepblocks[question] \hideblocks[hint] \hideblocks[answer] \startsetups examn:make \resetnumber[answer] \resetnumber[question] \resetnumber[hint] \page \setcounter[userpage][1] \centerline{\kap{Maths}} \centerline{\kap{Worksheet}} \crlf Name:\thinrules[n=1]%, interlinespace=big] Evaluation:\thinrules[n=1]%, interlinespace=big] \getbuffer[examn] \stopsetups \starttext \setuppagenumbering[state=stop] \startbuffer[examn] \section{Questions} \beginquestion Compute $4\times 5$. \endquestion \beginhint Use the fact that $2\times 5 = 10$. \endhint \beginanswer $20$. \endanswer \beginquestion What is the value of $100 / 10$? \endquestion \beginhint Remember that $10\times 10 = 100$. \endhint \beginanswer $10$ \endanswer \section{Hints to all questions} \useblocks[hint] \section{Answers to all questions} \useblocks[answer] \setuppagenumber[number=1] \stopbuffer \setuprandomize[124] % set a seed \dorecurse{3} {\setups[examn:make]} \stoptext Thanks a lot Jorge ___ 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] \dorecurse and \startcombination
Hello, Does anyone have a suggestion how to use \dorecurse within combinations? (without having to use lua...) Alan minimal example: \starttext \startcombination [2] \dorecurse{2}{{#1}{#1}} \stopcombination \stoptext ! Missing { inserted. system tex error on line 3 in file foo.tex: Missing { inserted ... 1 \starttext 2 \startcombination [2] 3 \dorecurse{2}{{#1}{#1}} 4 \stopcombination 5 \stoptext 6 to be read again \global \syst_helpers_recurse_x #1#2-\global \advance \outerrecurse \plusone \globa... l.3 \dorecurse{2}{{#1}{#1}} ? ___ 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] \dorecurse within TABLE
Does anyone have a solution to \dorecurse within TABLE? Alan Minimal example: \starttext \dorecurse{8}{\recurselevel\crlf} \bTABLE \dorecurse{8}{\bTR\bTD\recurselevel\eTD\eTR} \eTABLE \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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse within TABLE
On Fri, Oct 26, 2012 at 11:50 AM, Alan BRASLAU alan.bras...@cea.fr wrote: Does anyone have a solution to \dorecurse within TABLE? Alan Minimal example: \starttext \dorecurse{8}{\recurselevel\crlf} \bTABLE \dorecurse{8}{\bTR\bTD\recurselevel\eTD\eTR} \eTABLE \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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ table are strange, they can be parsed more than one time to achive the result If you use mkiv maybe the lua version is better \starttext \dorecurse{8}{\recurselevel\crlf} \startluacode global_cnt=0; \stopluacode \bTABLE %% ok, but why 17 ? \dorecurse{8}{\bTR\bTD\ctxlua{global_cnt=global_cnt+1;context(global_cnt-17)}:\recurselevel\eTD\eTR} \eTABLE %% straight \startluacode context.bTABLE() for i=1,8 do context.bTR() context.bTD() context(i) context.eTD() context.eTR() end context.eTABLE() \stopluacode \stoptext -- 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] \dorecurse within TABLE
2012-10-26 Alan BRASLAU: Does anyone have a solution to \dorecurse within TABLE? Alan Minimal example: \starttext \dorecurse{8}{\recurselevel\crlf} \bTABLE \dorecurse{8}{\bTR\bTD\recurselevel\eTD\eTR} \dorecurse{8}{\expanded{\bTR\bTD\recurselevel\eTD\eTR}} \eTABLE \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] \dorecurse within TABLE
On Fri, 26 Oct 2012 12:27:09 +0200 Marco Patzer home...@lavabit.com wrote: \dorecurse{8}{\expanded{\bTR\bTD\recurselevel\eTD\eTR}} Thank you. And I found something new to understand: http://wiki.contextgarden.net/System_Macros/Expansion_Control Now, is there some better way, or perhaps not, around creating my own counter (of course, I can use a counter for the column as well...) \starttext \bTABLE \definenumber[row] \dorecurse{8}{\incrementnumber[row] \bTR \dorecurse{5}{\expanded{\bTD \getnumber[row],\recurselevel \eTD}} \eTR } \eTABLE \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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse within TABLE
Am 26.10.2012 um 15:03 schrieb Alan BRASLAU alan.bras...@cea.fr: On Fri, 26 Oct 2012 12:27:09 +0200 Marco Patzer home...@lavabit.com wrote: \dorecurse{8}{\expanded{\bTR\bTD\recurselevel\eTD\eTR}} Thank you. And I found something new to understand: http://wiki.contextgarden.net/System_Macros/Expansion_Control Now, is there some better way, or perhaps not, around creating my own counter (of course, I can use a counter for the column as well...) \starttext \bTABLE \definenumber[row] \dorecurse{8}{\incrementnumber[row] \bTR \dorecurse{5}{\expanded{\bTD \getnumber[row],\recurselevel \eTD}} \eTR } \eTABLE \stoptext \starttext \bTABLE \dorecurse{8}{\bTR\dorecurse{5}{\bTD #1,##1 \eTD}\eTR} \eTBALE \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] \dorecurse within TABLE
2012-10-26 Alan BRASLAU: Now, is there some better way, or perhaps not, around creating my own counter (of course, I can use a counter for the column as well...) You can use \currentTABLEcolumn and \currentTABLErow \starttext \bTABLE \dorecurse{8}{ \bTR \dorecurse{5}{\bTD \currentTABLErow,\currentTABLEcolumn \eTD} \eTR } \eTABLE \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] \dorecurse within TABLE
Helps to read the wiki, with a link to: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ Simple enough: \starttext \bTABLE \dorecurse{8}{ \bTR \dorecurse{5}{\bTD \the\numexpr#1,\the\numexpr##1 \eTD} \eTR } \eTABLE \stoptext Alan On Fri, 26 Oct 2012 15:03:59 +0200 Alan BRASLAU alan.bras...@cea.fr wrote: On Fri, 26 Oct 2012 12:27:09 +0200 Marco Patzer home...@lavabit.com wrote: \dorecurse{8}{\expanded{\bTR\bTD\recurselevel\eTD\eTR}} Thank you. And I found something new to understand: http://wiki.contextgarden.net/System_Macros/Expansion_Control Now, is there some better way, or perhaps not, around creating my own counter (of course, I can use a counter for the column as well...) \starttext \bTABLE \definenumber[row] \dorecurse{8}{\incrementnumber[row] \bTR \dorecurse{5}{\expanded{\bTD \getnumber[row],\recurselevel \eTD}} \eTR } \eTABLE \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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] dorecurse in table
On Mon, 6 Sep 2010, Cecil Westerhof wrote: The following code does what I want: \blank \SetTableToWidth{\textwidth} \starttable[|lp(0.90\textwidth)|] Some text \SR \SR \HL \SR \HL \SR \HL \SR \HL \stoptable \blank The correct syntax is \NC ... \NC \SR but that doesn't solve the problem in this case. I would think that the following code is equivalent: \blank \SetTableToWidth{\textwidth} \starttable[|lp(0.90\textwidth)|] Some text \SR \dorecurse{4}{ \SR \HL } \stoptable \blank But it is not. I get: Underfull \hbox (badness 1) in alignment at lines 39--49 [][][][][] ! Misplaced \noalign. \TABLEnoalign -\noalign \bgroup \let \noalign \relax \let \next = \insertTABLEtail -\TABLEnoalign {\global \settrue \preventTABLEbreak \globa... \stoptable -\chuckTABLEautorow \insertTABLEtail \TABLEnoalign {\globalletem... l.60 \stoptable and h gives: I expect to see \noalign only after the \cr of an alignment. Proceed, and I'll ignore this case. What am I doing wrong? Table and expansion are tricky. The error is caused by the last \HL and goes away if you add another line. But if you only want four horizontal lines, why not use \thinrules \thinrules[n=4] Also have a look at m-educat.tex (look at the example in the end of the file) which is essentially a fancy wrapper around \thinrules. I don't know if \thinrules are documented in a manual, but pack-rul.mkiv gives a few examples: \starttext A couple of examples are given below. \startbuffer \setupthinrules[n=3,inbetween=,color=gray] test test \thinrules\ test test \par test test \thinrules [color=green] test test \par test test \thinrules [height=max, depth=max] test test \par \setupthinrules[height=.9,depth=.9] test test \thinrules\ test test \par test test \thinrules [alternativevariant=b] test test \par test test \thinrules [alternativevariant=c] test test \par test test \thinrules [alternativevariant=c,inbetween=\vskip2ex] test test \par \stopbuffer \typebuffer {\getbuffer} There are a couple of alternative ways to visualize rules using backgrounds. At first sight these may look strange, but they make sense in educational settings. The alternatives are more or less compatible with the more advanced \METAPOST\ based implementation. \startbuffer[a] \setupthinrules [n=2, backgroundcolor=gray , rulethickness=1pt, colorkleur=donkerblauw, after=\blank, before=\blank] \stopbuffer \typebuffer[a] \startbuffer[b] \thinrules[alternativevariant=a] \thinrules[alternativevariant=b] \thinrules[alternativevariant=c] \stopbuffer \typebuffer[b] \getbuffer[a,b] \startbuffer[b] \thinrules[alternativevariant=a,background=color] \thinrules[alternativevariant=b,background=color] \thinrules[alternativevariant=c,background=color] \stopbuffer \typebuffer[b] \getbuffer[a,b] \startbuffer[b] \thinrules[alternativevariant=a,height=.8,depth=.8,background=color] \thinrules[alternativevariant=b,height=.8,depth=.8,background=color] \thinrules[alternativevariant=c,height=.8,depth=.8,background=color] \stopbuffer \typebuffer[b] \getbuffer[a,b] \stoptext 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] dorecurse in table
Op maandag 6 sep 2010 23:18 CEST schreef Aditya Mahajan: The following code does what I want: \blank \SetTableToWidth{\textwidth} \starttable[|lp(0.90\textwidth)|] Some text \SR \SR \HL \SR \HL \SR \HL \SR \HL \stoptable \blank [CUT] Table and expansion are tricky. The error is caused by the last \HL and goes away if you add another line. But if you only want four horizontal lines, why not use \thinrules \thinrules[n=4] That is what I want. I have now defined the following much simpler macro: \def\GetComment[#1]{ \blank #1\par \thinrules[n=4] \blank } and I call it with: \GetComment[What was the most useful for you?] -- Cecil Westerhof M cldwester...@gmail.com O ascii ribbon campaign - stop html mail - www.asciiribbon.org Please do not send me Microsoft Office/Apple iWork documents. Send OpenDocument instead! http://fsf.org/campaigns/opendocument/ ___ 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] dorecurse...
Hello, I was busy to build a larger table with a lot of empty but numbered rows. So I thought to use the \dorecurse macro to help me. Now I can't recall the actual value of \recurselevel. Interestingly it fails only when calling for preparing whole rows in the table. When the \recurselevel is retrieved in normal text it works as expected. Please refer to the attached minimal example-file. Is there something changed in calling for the \recurselevel value? Kind regards Willi test-recurselevel.tex Description: Binary data ___ 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] dorecurse...
Am 21.02.10 11:37, schrieb Willi Egger: Hello, I was busy to build a larger table with a lot of empty but numbered rows. So I thought to use the \dorecurse macro to help me. Now I can't recall the actual value of \recurselevel. Interestingly it fails only when calling for preparing whole rows in the table. When the \recurselevel is retrieved in normal text it works as expected. Please refer to the attached minimal example-file. Is there something changed in calling for the \recurselevel value? No, that's normal for TABLE and tabulate. \starttext \bTABLE \dorecurse{3}{\expanded{\bTR\bTD\recurselevel\eTD\eTR}} \eTABLE \starttabulate[|l|] \dorecurse{3}{\expanded{\NC\recurselevel\NC\NR}} \stoptabulate \starttabulate[|p|] \NC\dorecurse{5}{\recurselevel\par}\NC\NR \stoptabulate \page \bTABLE \dorecurse{3}{\bTR\bTD#1\eTD\eTR} \eTABLE \starttabulate[|l|] \dorecurse{3}{\NC##1\NC\NR} \stoptabulate \starttabulate[|p|] \NC\dorecurse{5}{##1\par}\NC\NR \stoptabulate \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] dorecurse...
Hello Wolfgang, Thank yo very much, indeed! Hm, that I see your answer I think I have seen this earlier :-( Willi On Feb 21, 2010, at 12:07 PM, Wolfgang Schuster wrote: Am 21.02.10 11:37, schrieb Willi Egger: Hello, I was busy to build a larger table with a lot of empty but numbered rows. So I thought to use the \dorecurse macro to help me. Now I can't recall the actual value of \recurselevel. Interestingly it fails only when calling for preparing whole rows in the table. When the \recurselevel is retrieved in normal text it works as expected. Please refer to the attached minimal example-file. Is there something changed in calling for the \recurselevel value? No, that's normal for TABLE and tabulate. \starttext \bTABLE \dorecurse{3}{\expanded{\bTR\bTD\recurselevel\eTD\eTR}} \eTABLE \starttabulate[|l|] \dorecurse{3}{\expanded{\NC\recurselevel\NC\NR}} \stoptabulate \starttabulate[|p|] \NC\dorecurse{5}{\recurselevel\par}\NC\NR \stoptabulate \page \bTABLE \dorecurse{3}{\bTR\bTD#1\eTD\eTR} \eTABLE \starttabulate[|l|] \dorecurse{3}{\NC##1\NC\NR} \stoptabulate \starttabulate[|p|] \NC\dorecurse{5}{##1\par}\NC\NR \stoptabulate \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 __ _ ___ 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] dorecurse...
Am 21.02.10 17:51, schrieb Willi Egger: Hm, that I see your answer I think I have seen this earlier :-( http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ 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] dorecurse...
No! Even with a comment on my own account ;-( very bad! Thanks Willi On Feb 21, 2010, at 5:57 PM, Wolfgang Schuster wrote: Am 21.02.10 17:51, schrieb Willi Egger: Hm, that I see your answer I think I have seen this earlier :-( http://randomdeterminism.wordpress.com/2009/03/05/tex-programming- the-past-the-present-and-the-future/ 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 __ _ ___ 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] \dorecurse and \recurselevel in Natural Tables
Am 06.03.2009 um 07:41 schrieb luigi scarso: My summary of this thread: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ It's exactly what I think . Thank you very much. Nice article, it fits perfectly in the programming section of the wiki. Thank your for the summary. 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Hi Aditya, Happy luaTeXing. Great summary. Willi On Mar 6, 2009, at 4:05 AM, Aditya Mahajan wrote: On Thu, 5 Mar 2009, luigi scarso wrote: On Thu, Mar 5, 2009 at 12:09 PM, Wolfgang Schuster schuster.wolfg...@googlemail.com wrote: Am 05.03.2009 um 01:17 schrieb luigi scarso: \starttext %%% TeX version \bTABLE \dorecurse{5} {\bTR\expandafter \bTD \recurselevel. \eTD\expandafter \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} And you think it's a good idea to use \expandafter in your document? TeX version, not context ... :) btw \expandafer is not so bad, if used moderatly . \expanded is the tool for users to get this result without knowledge about TeX internals and expansion, this is from core-ntb: % permits \expanded{\bTD ... \eTD} \unexpanded\def\eTR{} \unexpanded\def\eTD{} \unexpanded\def\eTH{} \unexpanded\def\eTN{} yes, of course one need to know about \expandafter... so is not so different . But it's context style. %%% luatex version \startluacode tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end tprint('\\bTABLE') for j = 1,5 do tprint('\\bTR') tprint('\\bTD' .. j .. '.' .. '\\eTD' .. '\\bTD' .. j .. '\ \eTD') tprint('\\eTR') end tprint('\\eTABLE') \stopluacode \stoptext Nice solution and real alternative for package writers to avoid \expandafter and \expanded but nothing for a normal user, I should keep this in my mind. Are you sure ? What is a normal user ? As soon as you use \dorecurse , you become a programmer . And sooner or later, everyone become a programmer, because it's impossible to write a format that satisfied all your needs . My summary of this thread: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming- the-past-the-present-and-the-future/ 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 __ _ ___ 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Aditya Mahajan adityam at umich.edu writes: My summary of this thread: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ Aditya I like the Luatex code of Luigi. Though it is longer than what Wolfgang suggested (and in this case, I am using Wolfgang's solution now that I know about it), the luatex code seems to be the kind of programming that I am more comfortable with. In fact, in Latex when I was trying to achieve this, I used the python.sty package to code this in Python. To be able to do this using Lua (Luatex), do I need to learn the Lua programming language. Do I pick up any beginners book on Lua? Any recommendations based on experience of those who use Luatex here. For example, one of the lines in the code is tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end Is this Lua or LuaTex? Thanks. ___ 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Do I pick up any beginners book on Lua? There really is only one beginners book on Lua :-) _Programming in Lua_, by Roberto Ierusalimschy, the Lua author. There are a few other books, mostly about Lua and games, because Lua has become quite popular in the gamers' community, but Roberto's book is really excellent and makes a good tutorial. For example, one of the lines in the code is tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end Is this Lua or LuaTex? The question does not really makes sense if you put it that way. This line of code is pure Lua, it is completely syntactically correct; but you can't use as it a standalone Lua script, because it uses functions that only LuaTeX and ConTeXt define (think of it as the action of import in Python, except that here it's not available as a stand-alone library call; it's built into LuaTeX). Hence, if you want to become proficient in Lua programming in ConTeXt, you need to learn: * The Lua programming language, with its core libraries (covered in the aforementioned book). * The Lua libraries that LuaTeX adds to Lua, documented in the LuaTeX manual. * The Lua libraries that ConTeXt adds to LuaTeX. The above line of code is really a mixture of the three, but in any case, the ground stone is always Lua. 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
I like the Luatex code of Luigi. Though it is longer than what Wolfgang suggested (and in this case, I am using Wolfgang's solution now that I know about it), the luatex code seems to be the kind of programming that I am more comfortable with. In fact, in Latex when I was trying to achieve this, I used the python.sty package to code this in Python. The optimal solution is that one of Wolfgang that uses \expanded . The others are less than optimal. To be able to do this using Lua (Luatex), do I need to learn the Lua programming language. Do I pick up any beginners book on Lua? Any recommendations based on experience of those who use Luatex here. Programming in Lua , see www.lua.org For example, one of the lines in the code is tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end Is this Lua or LuaTex? luatex -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 06.03.2009 um 04:05 schrieb Aditya Mahajan: My summary of this thread: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ Nice article but I have a few corrections for you. Table setup: To achieve horizontal and vertical centered content in the table cell you need 'align={middle,lohi}'. Pure table code: You forgot the \bTR and \eTR before and after each row. Expandafter solution: You don't need as many \expandafter as you did in your example, one before \bTD in each loop is enough. \bTABLE \bTR \bTD $(+)$ \eTD \dorecurse{6} {\expandafter \bTD \recurselevel \eTD} \eTR \dorecurse{6} {\bTR \edef\firstrecurselevel{\recurselevel} \expandafter\bTD \recurselevel \eTD \dorecurse{6} {\expandafter \bTD \the\numexpr\firstrecurselevel+\recurselevel\relax \eTD} \eTR} \eTABLE \for loop: If you really want to show this loop you also the correct commands to access the counters. #1 did also work but only because the command is wrapped around \dostepwiserecurse. \bTABLE \bTR \bTD $(+)$ \eTD \for \y=1 \to 6 \step 1 \do {\bTD \y \eTD} \eTR \for \x=1 \to 6 \step 1 \do {\bTR \bTD \x \eTD \for \y=1 \to 6 \step 1 \do {\bTD \the\numexpr\x+\y \eTD} \eTR} \eTABLE Thank you for the article and I'm looking forward for the next. Best regards, 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Arthur and Luigi, thanks for your responses. Arthur, your response makes it very clear, what I need to do. I will start with the book you recommend. ___ 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Fri, 6 Mar 2009, Wolfgang Schuster wrote: Am 06.03.2009 um 04:05 schrieb Aditya Mahajan: My summary of this thread: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ Nice article but I have a few corrections for you. Table setup: To achieve horizontal and vertical centered content in the table cell you need 'align={middle,lohi}'. Hmm... align={middle,middle} also works. I haven't checked the code to see why. Pure table code: You forgot the \bTR and \eTR before and after each row. Thanks. Expandafter solution: You don't need as many \expandafter as you did in your example, one before \bTD in each loop is enough. \bTABLE \bTR \bTD $(+)$ \eTD \dorecurse{6} {\expandafter \bTD \recurselevel \eTD} \eTR \dorecurse{6} {\bTR \edef\firstrecurselevel{\recurselevel} \expandafter\bTD \recurselevel \eTD \dorecurse{6} {\expandafter \bTD \the\numexpr\firstrecurselevel+\recurselevel\relax \eTD} \eTR} \eTABLE Ah. I was experimenting without the \the\numexpr (replacing both by \relax) so that I could see the output. I did not realize that \numexpr expands its arguments anyways. \for loop: If you really want to show this loop you also the correct commands to access the counters. #1 did also work but only because the command is wrapped around \dostepwiserecurse. \bTABLE \bTR \bTD $(+)$ \eTD \for \y=1 \to 6 \step 1 \do {\bTD \y \eTD} \eTR \for \x=1 \to 6 \step 1 \do {\bTR \bTD \x \eTD \for \y=1 \to 6 \step 1 \do {\bTD \the\numexpr\x+\y \eTD} \eTR} \eTABLE This does not work, for the same reason that the \dorecurse solution does not work. You need to exapnad \x and \y in the first row and first column. Thank you for the article and I'm looking forward for the next. Thanks for the feedback. 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Thu, 5 Mar 2009, Aditya Mahajan wrote: On Thu, 5 Mar 2009, luigi scarso wrote: On Thu, Mar 5, 2009 at 12:09 PM, Wolfgang Schuster schuster.wolfg...@googlemail.com wrote: Am 05.03.2009 um 01:17 schrieb luigi scarso: \starttext %%% TeX version \bTABLE \dorecurse{5} {\bTR\expandafter \bTD \recurselevel. \eTD\expandafter \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} And you think it's a good idea to use \expandafter in your document? TeX version, not context ... :) btw \expandafer is not so bad, if used moderatly . \expanded is the tool for users to get this result without knowledge about TeX internals and expansion, this is from core-ntb: % permits \expanded{\bTD ... \eTD} \unexpanded\def\eTR{} \unexpanded\def\eTD{} \unexpanded\def\eTH{} \unexpanded\def\eTN{} yes, of course one need to know about \expandafter... so is not so different . But it's context style. %%% luatex version \startluacode tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end tprint('\\bTABLE') for j = 1,5 do tprint('\\bTR') tprint('\\bTD' .. j .. '.' .. '\\eTD' .. '\\bTD' .. j .. '\\eTD') tprint('\\eTR') end tprint('\\eTABLE') \stopluacode \stoptext Nice solution and real alternative for package writers to avoid \expandafter and \expanded but nothing for a normal user, I should keep this in my mind. Are you sure ? What is a normal user ? As soon as you use \dorecurse , you become a programmer . And sooner or later, everyone become a programmer, because it's impossible to write a format that satisfied all your needs . My summary of this thread: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ For fun: Using metapost \setupcolors[state=start] \setupTABLE[each][each][width=2em,height=2em,align={middle,middle}] \setupTABLE[r][1][background=color,backgroundcolor=gray] \setupTABLE[c][1][background=color,backgroundcolor=gray] \let\normalbTABLE\bTABLE \let\normaleTABLE\eTABLE \unexpanded\def\bTABLE{\normalbTABLE} \unexpanded\def\eTABLE{\normaleTABLE} \unexpanded\def\dobTR{\dodoubleempty\parseTR} \unexpanded\def\dobTD{\dodoubleempty\parseTD} \unexpanded\def\dobTH{\dodoubleempty\parseTH} \unexpanded\def\dobTN{\dodoubleempty\parseTN} \let\bTR\dobTR \let\bTD\dobTD \let\bTH\dobTH \let\bTN\dobTN \starttext \startMPcode string table ; table = \bTABLE \bTR \bTD $(+)$ \eTD for y = 1 upto 6 : \bTD decimal y \eTD endfor \eTR for x = 1 upto 6 : \bTR \bTD decimal x \eTD for y = 1 upto 6 : \bTD decimal (x+y) \eTD endfor \eTR endfor \eTABLE ; label(textext(table), origin) ; \stopMPcode \stoptext 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 06.03.2009 um 17:33 schrieb Aditya Mahajan: Table setup: To achieve horizontal and vertical centered content in the table cell you need 'align={middle,lohi}'. Hmm... align={middle,middle} also works. I haven't checked the code to see why. I hadn't known this before but it's feature of framed, good to know. Expandafter solution: Ah. I was experimenting without the \the\numexpr (replacing both by \relax) so that I could see the output. I did not realize that \numexpr expands its arguments anyways. The first recurselevel was expanded with your \edef and the second with the \expandafter before \bTD. \for loop: This does not work, for the same reason that the \dorecurse solution does not work. You need to exapnad \x and \y in the first row and first column. I should next time check the output. Sure, the same rules as \dorecurse apply to the \for loop. 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Wed, Mar 4, 2009 at 8:53 PM, luigi scarso luigi.sca...@gmail.com wrote: On Wed, Mar 4, 2009 at 8:35 PM, Curious Learn curiousle...@gmail.com wrote: Can someone please explain why the second example below works but the first does not work? Thanks very much. \starttext \bTABLE \dorecurse{5} {\bTR \bTD \recurselevel. \eTD \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} \stoptext works ok here with latest minimals This is LuaTeX, Version snapshot-0.35.0-2009022702 (Web2C 7.5.7) ConTeXt ver: 2008.11.10 21:40 MKIV fmt: 2009.3.4 int: english/english oops...I forget my code sorry \starttext %%% TeX version \bTABLE \dorecurse{5} {\bTR\expandafter \bTD \recurselevel. \eTD\expandafter \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} %%% luatex version \startluacode tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end tprint('\\bTABLE') for j = 1,5 do tprint('\\bTR') tprint('\\bTD' .. j .. '.' .. '\\eTD' .. '\\bTD' .. j .. '\\eTD') tprint('\\eTR') end tprint('\\eTABLE') \stopluacode \stoptext -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 05.03.2009 um 01:17 schrieb luigi scarso: \starttext %%% TeX version \bTABLE \dorecurse{5} {\bTR\expandafter \bTD \recurselevel. \eTD\expandafter \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} And you think it's a good idea to use \expandafter in your document? \expanded is the tool for users to get this result without knowledge about TeX internals and expansion, this is from core-ntb: % permits \expanded{\bTD ... \eTD} \unexpanded\def\eTR{} \unexpanded\def\eTD{} \unexpanded\def\eTH{} \unexpanded\def\eTN{} %%% luatex version \startluacode tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end tprint('\\bTABLE') for j = 1,5 do tprint('\\bTR') tprint('\\bTD' .. j .. '.' .. '\\eTD' .. '\\bTD' .. j .. '\ \eTD') tprint('\\eTR') end tprint('\\eTABLE') \stopluacode \stoptext Nice solution and real alternative for package writers to avoid \expandafter and \expanded but nothing for a normal user, I should keep this in my mind. 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Thu, Mar 5, 2009 at 12:09 PM, Wolfgang Schuster schuster.wolfg...@googlemail.com wrote: Am 05.03.2009 um 01:17 schrieb luigi scarso: \starttext %%% TeX version \bTABLE \dorecurse{5} {\bTR\expandafter \bTD \recurselevel. \eTD\expandafter \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} And you think it's a good idea to use \expandafter in your document? TeX version, not context ... :) btw \expandafer is not so bad, if used moderatly . \expanded is the tool for users to get this result without knowledge about TeX internals and expansion, this is from core-ntb: % permits \expanded{\bTD ... \eTD} \unexpanded\def\eTR{} \unexpanded\def\eTD{} \unexpanded\def\eTH{} \unexpanded\def\eTN{} yes, of course one need to know about \expandafter... so is not so different . But it's context style. %%% luatex version \startluacode tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end tprint('\\bTABLE') for j = 1,5 do tprint('\\bTR') tprint('\\bTD' .. j .. '.' .. '\\eTD' .. '\\bTD' .. j .. '\\eTD') tprint('\\eTR') end tprint('\\eTABLE') \stopluacode \stoptext Nice solution and real alternative for package writers to avoid \expandafter and \expanded but nothing for a normal user, I should keep this in my mind. Are you sure ? What is a normal user ? As soon as you use \dorecurse , you become a programmer . And sooner or later, everyone become a programmer, because it's impossible to write a format that satisfied all your needs . -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 05.03.2009 um 12:27 schrieb luigi scarso: And you think it's a good idea to use \expandafter in your document? TeX version, not context ... :) btw \expandafer is not so bad, if used moderatly . But don't make a beginner used to it, e.g. Stefan Kottwitz mentioned a few times how to append something to a existing macro in LaTeX forums and this is what I try to avoid for people who don't know what they are doing. http://texblog.net/latex-archive/plaintex/expandafter/ Nice solution and real alternative for package writers to avoid \expandafter and \expanded but nothing for a normal user, I should keep this in my mind. Are you sure ? What is a normal user ? People who want to use TeX to write a document but copy code from examples, old list messages etc. but don't why they have to do it something like this. As soon as you use \dorecurse , you become a programmer . And sooner or later, everyone become a programmer, because it's impossible to write a format that satisfied all your needs . OK, it's hard to write a fancy layout without defining your own header styles etc. without a definition but use then as many high level contructs (\framed, \define, ...) as possible and try to avoid things like \vbox or \expandafter. 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
People who want to use TeX to write a document but copy code from examples, old list messages etc. but don't why they have to do it something like this. OK, it's hard to write a fancy layout without defining your own header styles etc. without a definition but use then as many high level contructs (\framed, \define, ...) as possible and try to avoid things like \vbox or \expandafter. This is my point of view : use TeX to write a document = write a program in TeX programming language TeX programming language is not like lua, python, c++ , java and so on; TeX programming language is like m4, ie a macro language. If you write a simple document (= a simple program) context high-level const.s will almost completly hide the programming aspect ; but it's impossible that context high-level cover *all* program; so sooner or later one will use lua(tex) expression (which can be a natural choice for most of programmer but can be slow) , or ContTeXt macro (which can be less slow but not so natural ) , or even TeX macro - primitive . http://texblog.net/latex-archive/plaintex/expandafter/ hey, this is not a moderate use of expandafter as I intended .. I dropped latex for similar examples . In this situation please, grep setvalue base/* -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 05.03.2009 um 14:23 schrieb luigi scarso: http://texblog.net/latex-archive/plaintex/expandafter/ hey, this is not a moderate use of expandafter as I intended .. I dropped latex for similar examples . In this situation please, grep setvalue base/* ??? I can't understand the relation between \setvalue and the expandafter trick in the example on the webpage, setvalue hides the csname ... endcsname part but the example tries to avoid the \let\oldmacro\macro \def \macro{\oldmacro...} redefinition. 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Thu, Mar 5, 2009 at 2:52 PM, Wolfgang Schuster schuster.wolfg...@googlemail.com wrote: Am 05.03.2009 um 14:23 schrieb luigi scarso: http://texblog.net/latex-archive/plaintex/expandafter/ hey, this is not a moderate use of expandafter as I intended .. I dropped latex for similar examples . In this situation please, grep setvalue base/* ??? I can't understand the relation between \setvalue and the expandafter trick in the example on the webpage, setvalue hides the csname ... endcsname part but the example tries to avoid the \let\oldmacro\macro \def\macro{\oldmacro...} redefinition. I don't like the \let\oldmacro\macro \def\macro{\oldmacro...} construct because sometimes the \def\macro{\oldmacro...} can cause unexpected behaviour I prefear \setvalue{quote small}{\quote\small} {\getvalue{quote small} foo } -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 05.03.2009 um 15:23 schrieb luigi scarso: I prefear \setvalue{quote small}{\quote\small} {\getvalue{quote small} foo } This is non trivial example, normally I would define a new quote command with \definedelimitedtext[quotesmall][quote] but you above code can't be achieved with this because the results are either small text or text with quotes at both sides but not a combination of them. How about: \define\quotesmall{\groupedcommand{\quote\small}{}} 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Thu, Mar 5, 2009 at 3:53 PM, Wolfgang Schuster schuster.wolfg...@googlemail.com wrote: Am 05.03.2009 um 15:23 schrieb luigi scarso: I prefear \setvalue{quote small}{\quote\small} {\getvalue{quote small} foo } This is non trivial example, normally I would define a new quote command with \definedelimitedtext[quotesmall][quote] but you above code can't be achieved with this because the results are either small text or text with quotes at both sides but not a combination of them. How about: \define\quotesmall{\groupedcommand{\quote\small}{}} sound good. Does it work \setvalue{quote:small}{\groupedcommand{\quote\small}{}} ? -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Thu, 5 Mar 2009, luigi scarso wrote: On Thu, Mar 5, 2009 at 12:09 PM, Wolfgang Schuster schuster.wolfg...@googlemail.com wrote: Am 05.03.2009 um 01:17 schrieb luigi scarso: \starttext %%% TeX version \bTABLE \dorecurse{5} {\bTR\expandafter \bTD \recurselevel. \eTD\expandafter \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} And you think it's a good idea to use \expandafter in your document? TeX version, not context ... :) btw \expandafer is not so bad, if used moderatly . \expanded is the tool for users to get this result without knowledge about TeX internals and expansion, this is from core-ntb: % permits \expanded{\bTD ... \eTD} \unexpanded\def\eTR{} \unexpanded\def\eTD{} \unexpanded\def\eTH{} \unexpanded\def\eTN{} yes, of course one need to know about \expandafter... so is not so different . But it's context style. %%% luatex version \startluacode tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end tprint('\\bTABLE') for j = 1,5 do tprint('\\bTR') tprint('\\bTD' .. j .. '.' .. '\\eTD' .. '\\bTD' .. j .. '\\eTD') tprint('\\eTR') end tprint('\\eTABLE') \stopluacode \stoptext Nice solution and real alternative for package writers to avoid \expandafter and \expanded but nothing for a normal user, I should keep this in my mind. Are you sure ? What is a normal user ? As soon as you use \dorecurse , you become a programmer . And sooner or later, everyone become a programmer, because it's impossible to write a format that satisfied all your needs . My summary of this thread: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
My summary of this thread: http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ It's exactly what I think . Thank you very much. -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] \dorecurse and \recurselevel in Natural Tables
Can someone please explain why the second example below works but the first does not work? Thanks very much. \starttext \bTABLE \dorecurse{5} {\bTR \bTD \recurselevel. \eTD \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} \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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Wed, Mar 4, 2009 at 8:35 PM, Curious Learn curiousle...@gmail.com wrote: Can someone please explain why the second example below works but the first does not work? Thanks very much. \starttext \bTABLE \dorecurse{5} {\bTR \bTD \recurselevel. \eTD \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} \stoptext works ok here with latest minimals This is LuaTeX, Version snapshot-0.35.0-2009022702 (Web2C 7.5.7) ConTeXt ver: 2008.11.10 21:40 MKIV fmt: 2009.3.4 int: english/english ___ 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 ___ -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Wed, Mar 4, 2009 at 8:53 PM, luigi scarso luigi.sca...@gmail.com wrote: On Wed, Mar 4, 2009 at 8:35 PM, Curious Learn curiousle...@gmail.com wrote: Can someone please explain why the second example below works but the first does not work? Thanks very much. \starttext \bTABLE \dorecurse{5} {\bTR \bTD \recurselevel. \eTD \bTD \recurselevel \eTD\eTR} \eTABLE \dorecurse{2} {\recurselevel. \recurselevel\crlf} \stoptext works ok here with latest minimals This is LuaTeX, Version snapshot-0.35.0-2009022702 (Web2C 7.5.7) ConTeXt ver: 2008.11.10 21:40 MKIV fmt: 2009.3.4 int: english/english and also OK with minimals beta This is LuaTeX, Version snapshot-0.35.0 (test-curios.tex ConTeXt ver: 2009.03.04 17:30 MKIV fmt: 2009.3.4 int: english/english -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 04.03.2009 um 20:35 schrieb Curious Learn: Can someone please explain why the second example below works but the first does not work? Thanks very much. \starttext \bTABLE \dorecurse{5} {\bTR \bTD \recurselevel. \eTD \bTD \recurselevel \eTD\eTR} \eTABLE \bTABLE \dorecurse{5}{\bTR\expanded{\bTD\recurselevel\eTD}\eTR} \eTABLE 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Wolfgang Schuster schuster.wolfgang at googlemail.com writes: \bTABLE \dorecurse{5}{\bTR\expanded{\bTD\recurselevel\eTD}\eTR} \eTABLE Wolfgang As your other solutions, this worked great. I suppose I have to use \expanded for every \bTD \eTD pair. Can you please explain why this is necessary or point me to a document that contains the explanation. Thanks very much. ___ 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 04.03.2009 um 21:57 schrieb Curious Learn: Wolfgang Schuster schuster.wolfgang at googlemail.com writes: \bTABLE \dorecurse{5}{\bTR\expanded{\bTD\recurselevel\eTD}\eTR} \eTABLE As your other solutions, this worked great. I suppose I have to use \expanded for every \bTD \eTD pair. Not really. \bTABLE \dorecurse{5}{\bTR\bTD#1\eTD\eTR} \eTABLE 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
On Wed, 4 Mar 2009, Wolfgang Schuster wrote: \bTABLE \dorecurse{5}{\bTR\bTD#1\eTD\eTR} \eTABLE This is evil genious! 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 04.03.2009 um 22:43 schrieb Aditya Mahajan: On Wed, 4 Mar 2009, Wolfgang Schuster wrote: \bTABLE \dorecurse{5}{\bTR\bTD#1\eTD\eTR} \eTABLE This is evil genious! Can be used nested too. \starttext \bTABLE \dorecurse{5} {\bTR \dorecurse{5}{\bTD#1:##1\eTD} \eTR} \eTABLE \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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Not really. \bTABLE \dorecurse{5}{\bTR\bTD#1\eTD\eTR} \eTABLE Wolfgang Awesome How does one learn these things? Is this Tex programming or Context programming. Thanks very much. ___ 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 ___
Re: [NTG-context] \dorecurse and \recurselevel in Natural Tables
Am 04.03.2009 um 23:17 schrieb Curious Learn: Not really. \bTABLE \dorecurse{5}{\bTR\bTD#1\eTD\eTR} \eTABLE Wolfgang Awesome How does one learn these things? Follow the mailing list and read parts of the source. Is this Tex programming or Context programming. It's a ConTeXt future. You can use inside of \dorecurse #1 to get the expanded level and #2 to get the recurse depth. 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 ___