From: Jeong Dal <haksan@me.com>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: MetaFun: how to check the number of arguments
Date: Wed, 16 Jan 2019 08:53:34 +0900 [thread overview]
Message-ID: <68F6C64A-BBE2-48A6-9DA4-B0720DE19E36@me.com> (raw)
In-Reply-To: <7905f6c9-1d40-0b0f-2c5c-2a73449c9850@xs4all.nl>
[-- Attachment #1.1: Type: text/plain, Size: 10916 bytes --]
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.hagen@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-request@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-request@ntg.nl
>>>
>>> You can reach the person managing the list at
>>> ntg-context-owner@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.lists@gmail.com>
>>> To: mailing list for ConTeXt users <ntg-context@ntg.nl>, "Jan U.
>>> Hasecke" <juh+ntg-context@mailbox.org>
>>> Subject: Re: [NTG-context] Manipulating the left blank page when
>>> chapter starts on the right page
>>> Message-ID: <cad2dcf9-ce2c-203a-88c2-41315bd5f825@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.lists@gmail.com>
>>> To: mailing list for ConTeXt users <ntg-context@ntg.nl>, Lars
>>> <axteffekt@gmail.com>
>>> Subject: Re: [NTG-context] Footnotes in float combinations missing in
>>> output
>>> Message-ID: <e14cd1c5-400e-14bf-d8bf-a47ef28b6550@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-context@mailbox.org>
>>> To: Wolfgang Schuster <wolfgang.schuster.lists@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-f0e8fe83cb45@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/>
> -----------------------------------------------------------------
[-- Attachment #1.2: Type: text/html, Size: 52764 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2019-01-15 23:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1.1547463601.11666.ntg-context@ntg.nl>
2019-01-14 21:44 ` Jeong Dal
2019-01-15 17:04 ` Hans Hagen
2019-01-15 23:53 ` Jeong Dal [this message]
2019-01-16 8:35 ` Hans Hagen
2019-01-16 14:32 ` Jeong Dal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=68F6C64A-BBE2-48A6-9DA4-B0720DE19E36@me.com \
--to=haksan@me.com \
--cc=j.hagen@xs4all.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).