Dear Hans, Thank you for a solution.
In my memory, it is possible to check the argument in Lua, so I hope that there is a similar method in MetaFun. It may be easier to draw grid using lines instead of squares. Thank you again. Best regards, Dalyoung > 2019. 1. 16. 오전 2:04, Hans Hagen <j.ha...@xs4all.nl> 작성: > > On 1/14/2019 10:44 PM, Jeong Dal wrote: >> Dear all, >> In the following sample, it draws squares with label which is given. >> I’d like to know how to check the number of elements in the second argument? >> If it is 0, then I just draw grids only. >> Thank you for reading. >> Best regards, >> Dalyoung >> ******** >> \startbuffer[defs] >> def drawGridF (expr nb) (text s) = >> p := unitsquare scaled wu; >> n:= 0; >> for m = s: >> i:= n mod nb; >> j:= n div nb; >> pic := image (draw p; label(textext(m), center p); ); >> draw pic shifted (i*wu, j*wu); >> n:= n+ 1; >> endfor; >> enddef; >> \stopbuffer >> \startbuffer[3x3b] >> wu := \MPvar{width}; >> drawGridF (3) (1,2,3,0,1, 1,4,5,8); >> \stopbuffer >> \starttext >> \setupMPvariables[width=30pt] >> \processMPbuffer[defs,3x3b] >> \stoptext > > > \startbuffer[defs] > def drawGridF (expr nb) (text s) = > path p ; > picture pic ; > numeric n; > p := unitsquare scaled wu; > n:= 0; > for m = s: > i:= n mod nb; > j:= n div nb; > pic := image (draw p; label(textext(m), center p); ); > draw pic shifted (i*wu, j*wu); > n:= n+ 1; > endfor; > if n == 0 : > draw textext("A grid!"); > fi ; > enddef; > \stopbuffer > > \startbuffer[3x3b] > wu := \MPvar{width}; > drawGridF (3) (1,2,3,0,1, 1,4,5,8); > currentpicture := currentpicture shifted (bbwidth(currentpicture),0); > drawGridF (3) (); > \stopbuffer > > \setupMPvariables[width=30pt] > \processMPbuffer[defs,3x3b] > > > > >>> 2019. 1. 14. 오후 8:00, 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. Re: Manipulating the left blank page when chapter starts on >>> the right page (Wolfgang Schuster) >>> 2. Re: Footnotes in float combinations missing in output >>> (Wolfgang Schuster) >>> 3. Re: Manipulating the left blank page when chapter starts on >>> the right page (Jan U. Hasecke) >>> >>> >>> ---------------------------------------------------------------------- >>> >>> Message: 1 >>> Date: Sun, 13 Jan 2019 16:56:40 +0100 >>> From: Wolfgang Schuster <wolfgang.schuster.li...@gmail.com> >>> To: mailing list for ConTeXt users <ntg-context@ntg.nl>, "Jan U. >>> Hasecke" <juh+ntg-cont...@mailbox.org> >>> Subject: Re: [NTG-context] Manipulating the left blank page when >>> chapter starts on the right page >>> Message-ID: <cad2dcf9-ce2c-203a-88c2-41315bd5f...@gmail.com> >>> Content-Type: text/plain; charset=utf-8; format=flowed >>> >>> Jan U. Hasecke schrieb am 12.01.19 um 22:08: >>>> Hi Aditya, >>>> >>>> Am 12.01.19 um 20:11 schrieb Aditya Mahajan: >>>>> On Sat, 12 Jan 2019, Jan U. Hasecke wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> in my document \startchapter and \starttitle starts a new chapter on the >>>>>> right (odd) page. So sometimes, there is a blank even page just before a >>>>>> new chapter. >>>>>> >>>>>> I would like to manipulate this blank even page. >>>>>> >>>>>> There are several things I would like to do, eg. having no headers and >>>>>> footers, setting the background color to a named color, placing an image >>>>>> or some graphics on the page. >>>>>> >>>>>> Is there a way to define such a page, name it and call it in >>>>>> \startchapter so that it is placed on the left side. >>>>> See https://tex.stackexchange.com/q/457428/323 >>>> Thanks a lot, but I wasn't looking for a way to just delete page numbers >>>> but to style the empty page in arbitrary ways. >>>> >>>> Maybe it is better to do this manually. >>>> >>>> I would let chapter open on even pages too and just insert a styled page >>>> by hand. >>> >>> Here is a example which shows how you can change the background color >>> of a empty page before the chapter title. >>> >>> \setuppagenumbering >>> [alternative=doublesided] >>> >>> \startsetups [chapter:before] >>> \doifoddpageelse >>> {} >>> {\pushbackground[page] >>> \setupbackgrounds[page][background=color,backgroundcolor=black] >>> \page[empty,right] >>> \popbackground} >>> \stopsetups >>> >>> \setuphead >>> [chapter] >>> [page=yes, >>> before=\directsetup{chapter:before}] >>> >>> \starttext >>> >>> \startchapter[title={Knuth}] >>> \dorecurse{10}{\samplefile{knuth}} >>> \stopchapter >>> >>> \startchapter[title={Zapf}] >>> \dorecurse{10}{\samplefile{zapf}} >>> \stopchapter >>> >>> \startchapter[title={Ward}] >>> \dorecurse{10}{\samplefile{ward}} >>> \stopchapter >>> >>> \stoptext >>> >>> Wolfgang >>> >>> >>> >>> ------------------------------ >>> >>> Message: 2 >>> Date: Sun, 13 Jan 2019 21:06:42 +0100 >>> From: Wolfgang Schuster <wolfgang.schuster.li...@gmail.com> >>> To: mailing list for ConTeXt users <ntg-context@ntg.nl>, Lars >>> <axteff...@gmail.com> >>> Subject: Re: [NTG-context] Footnotes in float combinations missing in >>> output >>> Message-ID: <e14cd1c5-400e-14bf-d8bf-a47ef28b6...@gmail.com> >>> Content-Type: text/plain; charset=utf-8; format=flowed >>> >>> Lars schrieb am 09.01.19 um 23:01: >>>> Hi there, hi Hans, >>>> >>>> I just want to let you know that footnotes insterted in >>>> float-combinations don't get rendered properly, i. e. only the last >>>> footnote is placed in the output. MWE: >>>> >>>> \starttext >>>> \startplacefigure[title={OuterCap\footnote{Outer footnote}}] >>>> >>>> \startfloatcombination[nx=3] >>>> \placefigure{Fnote1\footnote{Hello}}{\externalfigure[cow][width={.2\textwidth}]} >>>> \placefigure{Fnote2\footnote{small}}{\externalfigure[cow][width={.2\textwidth}]} >>>> \placefigure{Fnote3\footnote{world}}{\externalfigure[cow][width={.2\textwidth}]} >>>> \stopfloatcombination >>>> >>>> \stopplacefigure >>>> \stoptext >>> >>> Not very nice but the following works. You would have less problems with >>> local footnotes which are placed in the float block. >>> >>> \starttext >>> >>> \startpostponingnotes >>> \startplacefigure[title={...}] >>> ... >>> \stopplacefigure >>> \stoppostponingnotes >>> >>> \stoptext >>> >>> Wolfgang >>> >>> >>> ------------------------------ >>> >>> Message: 3 >>> Date: Mon, 14 Jan 2019 08:39:45 +0100 >>> From: "Jan U. Hasecke" <juh+ntg-cont...@mailbox.org> >>> To: Wolfgang Schuster <wolfgang.schuster.li...@gmail.com>, mailing >>> list for ConTeXt users <ntg-context@ntg.nl> >>> Subject: Re: [NTG-context] Manipulating the left blank page when >>> chapter starts on the right page >>> Message-ID: <d88401b5-1ada-6f97-ee9b-f0e8fe83c...@mailbox.org> >>> Content-Type: text/plain; charset=utf-8 >>> >>> >>> Am 13.01.19 um 16:56 schrieb Wolfgang Schuster: >>> >>>> Here is a example which shows how you can change the background color >>>> of a empty page before the chapter title. >>>> >>>> \setuppagenumbering >>>> [alternative=doublesided] >>>> >>>> \startsetups [chapter:before] >>>> \doifoddpageelse >>>> {} >>>> {\pushbackground[page] >>>> \setupbackgrounds[page][background=color,backgroundcolor=black] >>>> \page[empty,right] >>>> \popbackground} >>>> \stopsetups >>>> >>>> \setuphead >>>> [chapter] >>>> [page=yes, >>>> before=\directsetup{chapter:before}] >>>> >>>> \starttext >>>> >>>> \startchapter[title={Knuth}] >>>> \dorecurse{10}{\samplefile{knuth}} >>>> \stopchapter >>>> >>>> \startchapter[title={Zapf}] >>>> \dorecurse{10}{\samplefile{zapf}} >>>> \stopchapter >>>> >>>> \startchapter[title={Ward}] >>>> \dorecurse{10}{\samplefile{ward}} >>>> \stopchapter >>>> >>>> \stoptext >>> >>> Thanks a lot Wolfgang! >>> >>> This was just the thing I was looking for. These setups seems to be the >>> golden bullet in ConTeXt but I often have difficulties to understand the >>> mechanism. >>> >>> I'll try to wikify this later this week. >>> >>> The push-pop-background pair is mentionend in x-setups-overview together >>> with some other push-pop-pairs or push single commands. Are they >>> documented somewhere? >>> >>> juh >>> >>> >>> >>> ------------------------------ >>> >>> Subject: Digest Footer >>> >>> ___________________________________________________________________________________ >>> 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 >>> ___________________________________________________________________________________ >>> >>> ------------------------------ >>> >>> End of ntg-context Digest, Vol 175, Issue 27 >>> ******************************************** >> ___________________________________________________________________________________ >> If your question is of interest to others as well, please add an entry to >> the Wiki! >> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / >> http://www.ntg.nl/mailman/listinfo/ntg-context >> <http://www.ntg.nl/mailman/listinfo/ntg-context> >> webpage : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / >> http://context.aanhet.net <http://context.aanhet.net/> >> archive : https://bitbucket.org/phg/context-mirror/commits/ >> <https://bitbucket.org/phg/context-mirror/commits/> >> wiki : http://contextgarden.net <http://contextgarden.net/> >> ___________________________________________________________________________________ > > > -- > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl <http://www.pragma-ade.nl/> | > www.pragma-pod.nl <http://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 ___________________________________________________________________________________