Re: [NTG-context] MetaFun: how to check the number of arguments

2019-01-16 Thread Hans Hagen

On 1/16/2019 12:53 AM, Jeong Dal wrote:

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.


vardef textlength(text t) =
save n ; n := 0 ;
for i = t :
n := n + 1 ;
endfor;
n
enddef;

def drawGridF (expr nb) (text s) =
if textlength(s) = 0 :
   draw textext("A grid!");
else :
   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;
fi ;
enddef;



Thank you again.

Best regards,

Dalyoung

2019. 1. 16. 오전 2:04, Hans Hagen > 작성:


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 
To: mailing list for ConTeXt users , "Jan U.
Hasecke" 
Subject: Re: [NTG-context] Manipulating the left blank page when
chapter starts on the right page
Message-ID: 
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

[NTG-context] How to adjust inter item vertical space

2019-01-16 Thread jdh


I want to fit a page with an itemized group of items.
The normal vertical spacing is to large and the [packed] doesn't give enough 
seperation between
items.  I should think that there's a simple way to adjust this with 
\setupitemize  command or even with \startitemize.  Is there?

I did try  \setupitemize[inbetween=\whitespace[medium]] , but it didn't do much 
or seemed to be applied
to every line and not just between item and 'medium' doesn't give much 
information.  Is there some way to specify a measurement to seperate between 
items such as   .5cm  for example?



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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to adjust inter item vertical space

2019-01-16 Thread Otared Kavian
Hi,

You can define your own white space and then attribute it to each item, as in 
the following:

\setupwhitespace[big]
\startsetups[mywhitespace]
\setupwhitespace[small]
\setupblank[small]
\stopsetups
\setupitemize[each][inner=\directsetup{mywhitespace}]

\starttext
\input knuth

\startitemize
\dorecurse{3}{%
\startitem 
\input ward
\stopitem}
\stopitemize
\stoptext

Best regards: OK


> On 16 Jan 2019, at 10:48, jdh  wrote:
> 
> 
> 
> I want to fit a page with an itemized group of items.
> The normal vertical spacing is to large and the [packed] doesn't give enough 
> seperation between
> items.  I should think that there's a simple way to adjust this with 
> \setupitemize  command or even with \startitemize.  Is there?
> 
> I did try  \setupitemize[inbetween=\whitespace[medium]] , but it didn't do 
> much or seemed to be applied
> to every line and not just between item and 'medium' doesn't give much 
> information.  Is there some way to specify a measurement to seperate between 
> items such as   .5cm  for example?
> 
> 
> 
> 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://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
___

[NTG-context] \startcolumns and multi-line footnotes

2019-01-16 Thread Taco Hoekwater
Hi,

With the new version of columns, how do I get multi-line footnotes?
I tried various things with \setupnotation but nothing seems to work?


MWE:

\starttext
\startcolumns
\dorecurse{3}{\input ward\footnote{\input zapf} }
\stopcolumns
\stoptext


Best wishes,
Taco


footn.pdf
Description: Adobe PDF document




___
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] inline textbackgrounds across linebreaks

2019-01-16 Thread Aditya Mahajan

On Tue, 15 Jan 2019, Taco Hoekwater wrote:


On 15 Jan 2019, at 15:08, Mohammad Hossein Bateni  wrote:

I guess it works fine for me on beta 2019.01.07 16:10.


Thanks for testing. Sorry, I should have checked myself.


On 15 Jan 2019, at 15:22, Hans Hagen  wrote:
works her ebut better is probably:

\definebar[tacobar] [method=1,dy=-0.4,offset=-0.3,continue=yes]


I had that earlier, but unfortunately there is also the  tag,
and this does not work the way I want:

%%%
\definebar[tacobar] [method=1,dy=-0.4,offset=-0.3,continue=yes]
\definebar[tacoover][method=1,dy=-0.4,offset=0.5,continue=yes]


Here is the start of the paragraph
{\tacobar hello! ({\tacoover this} looks fine)}
and some extra text running on to the next line
%%%

Because the \tacoover makes the \tacobar disappear :(


If the text has constant interline spacing, you can try to mimick the old 
(mkii) underbar mechanism. See https://tex.stackexchange.com/a/125486/323 
for an example. I haven't tested this with nested backgrounds, but it 
should work.


Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] \startcolumns and multi-line footnotes

2019-01-16 Thread Otared Kavian
Hi Taco,

There two documents 

/context-minimal/tex/texmf-context/doc/context/documents/general/manuals/notnow.pdf
and

/context-minimal/tex/texmf-context/doc/context/documents/general/manuals/pagecolumns.pdf
written by Hans in which he says that long footnotes and columns cannot be 
treated correctly yet (in the first one) and in the second he says that 
pagecolumns can handle a « sane » usage of columns and footnotes…

Indeed the following works but not with your example :-(
Best regards: OK

\definepagecolumns [example]
[n=2,
distance=5mm]

\starttext

\startpagecolumns[example]
\dorecurse {7} {
\samplefile{tufte}
\footnote{This is a short footnote.}
\par 
}
\stoppagecolumns
\stoptext

> On 16 Jan 2019, at 14:14, Taco Hoekwater  wrote:
> 
> Hi,
> 
> With the new version of columns, how do I get multi-line footnotes?
> I tried various things with \setupnotation but nothing seems to work?
> 
> 
> MWE:
> 
> \starttext
> \startcolumns
> \dorecurse{3}{\input ward\footnote{\input zapf} }
> \stopcolumns
> \stoptext
> 
> 
> Best wishes,
> Taco
> 
> 
> 
> 
> ___
> 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] MetaFun: how to check the number of arguments

2019-01-16 Thread Jeong Dal
Dear Hans,

> vardef textlength(text t) =
>save n ; n := 0 ;
>for i = t :
>   n := n + 1 ;
>endfor;
>n
> enddef;
> 

Thank you for a  good method!
It can be used in another program.

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] \startcolumns and multi-line footnotes

2019-01-16 Thread Taco Hoekwater


> On 16 Jan 2019, at 15:05, Otared Kavian  wrote:
> 
> Hi Taco,
> 
> There two documents 
>   
> /context-minimal/tex/texmf-context/doc/context/documents/general/manuals/notnow.pdf
> and
>   
> /context-minimal/tex/texmf-context/doc/context/documents/general/manuals/pagecolumns.pdf
> written by Hans in which he says that long footnotes and columns cannot be 
> treated correctly yet 

Which is a tad annoying, as my example worked in both mkii and mkiv
just fine before the switch to the new mixed column system. It worked
ok for decades, in fact.

The weird bit here is that the new mixed columns do actually reserve 
the correct amount of vertical space for the footnote, they just 
seem to ‘forget’ to break the footnote into lines in the end.

Best wishes,
Taco

___
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] Scaling down symbols and emojis

2019-01-16 Thread User 19087
I'm having trouble scaling down symbols and emojis. For a while I assumed
these don't scale with the current font size. Then I scoured the mailing
list and realized that while scaling down seems broken, scaling up works as
expected:


\usesymbols[mvs]

\setupsymbolset[martinvogel 2]

%\showallmakeup

\starttext
% Progressively larger as expected.
\symbol[ShortForty]
{\tfa\symbol[ShortForty]}
{\tfb\symbol[ShortForty]}
{\tfc\symbol[ShortForty]}
{\tfd\symbol[ShortForty]}

% Unexpectedly all the same size.
\symbol[ShortForty]
{\tfx\symbol[ShortForty]}
{\tfxx\symbol[ShortForty]}

% This works, but why? Isn't \small just a synonym for \tfx via
% \definealternativestyle? Anyway there is no synonym for \tfxx.
\symbol[ShortForty]
{\switchtobodyfont[small]\symbol[ShortForty]}
{\small\symbol[ShortForty]}

% This also works but is less than ideal when matching surrounding font
sizes.
% Which factor should I use to match \tfxx?
\symbol[ShortForty]
\scale[factor=4]{\symbol[ShortForty]}

% Same as above comment, more or less.
\symbol[ShortForty]
{\switchtobodyfont[5pt]\symbol[ShortForty]}
\stoptext


* MWE for builtin symbols; emojis require local fonts. I assume whichever
solution would apply equally to either.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Scaling down symbols and emojis

2019-01-16 Thread Wolfgang Schuster

User 19087 schrieb am 16.01.19 um 21:56:
I'm having trouble scaling down symbols and emojis. For a while I 
assumed these don't scale with the current font size. Then I scoured 
the mailing list and realized that while scaling down seems broken, 
scaling up works as expected:
\tx (or \tfx, \bfx etc.) and \txx are ignored in some cases unlike the 
other size switches (\tfa etc.).


When you need a switch for a smaller size which doesn’t has these 
limitations you can just create them:


\definefontsize [m]
\definefontsize [n]

\setupbodyfontenvironment
  [default]
  [m=0.8,
   n=0.6]


\usesymbols[mvs]

\setupsymbolset[martinvogel 2]

%\showallmakeup

\starttext
% Progressively larger as expected.
\symbol[ShortForty]
{\tfa\symbol[ShortForty]}
{\tfb\symbol[ShortForty]}
{\tfc\symbol[ShortForty]}
{\tfd\symbol[ShortForty]}

% Unexpectedly all the same size.
\symbol[ShortForty]
{\tfx\symbol[ShortForty]}
{\tfxx\symbol[ShortForty]}

% This works, but why? Isn't \small just a synonym for \tfx via
% \definealternativestyle? Anyway there is no synonym for \tfxx.
\symbol[ShortForty]
{\switchtobodyfont[small]\symbol[ShortForty]}
{\small\symbol[ShortForty]}

No, \small us the same as \switchtobodyfont[small]
% This also works but is less than ideal when matching surrounding 
font sizes.

% Which factor should I use to match \tfxx?
\symbol[ShortForty]
\scale[factor=4]{\symbol[ShortForty]}

x = 0.8
xx = 0.6

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] Scaling down symbols and emojis

2019-01-16 Thread User 19087
On Wed, Jan 16, 2019 at 4:24 PM Wolfgang Schuster
 wrote:
> When you need a switch for a smaller size which doesn’t has these
> limitations you can just create them:
>
> \definefontsize [m]
> \definefontsize [n]
>
> \setupbodyfontenvironment
>[default]
>[m=0.8,
> n=0.6]

In case the current bodyfontenvironment overrides the smaller sizes is
it possible to define 'n' and 'm' in terms of 'x' and 'xx'?

% this should happen after \setupbodyfont so the correct values are fetched
\setupbodyfontenvironment
[default]
[m=\getcurrentbodyfontenvironment{x},
 n=\getcurrentbodyfontenvironment{xx}]

> > % This also works but is less than ideal when matching surrounding
> > font sizes.
> > % Which factor should I use to match \tfxx?
> > \symbol[ShortForty]
> > \scale[factor=4]{\symbol[ShortForty]}
> x = 0.8
> xx = 0.6

Or I use {\switchtobodyfont[...]\symbol[ShortForty]} in the document.
At that point the body font may have been switched to a size whose
environment defines different values for 'x' and 'xx'. Or perhaps the
current or default body font, via \definebodyfont, overrides the 'x'
and 'xx' sizes. In either case it would be more flexible to query the
current values of 'x' and 'xx' rather than hardcoding the values of
'n' and 'm'. Is something like this possible:

% provide size name ('xx', 'x', 'a', 'b', 'c', 'd') and contents
\define[2]\at_size_unrestricted{\switchtobodyfont[\getcurrentsize[#1]]#2}

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___