Re: [NTG-context] question about frames

2020-11-26 Thread Hans Hagen

On 11/26/2020 10:03 PM, Pablo Rodriguez wrote:

On 11/26/20 5:26 PM, Wolfgang Schuster wrote:

Pablo Rodriguez schrieb am 25.11.2020 um 22:43:

[...]
Which is the way to avoid any vertical space between frames?


Variant 1:

 \offinterlineskip}


Many thanks for your reply, Wolfgang.

As always, your solution is straight to the point and works like a
charm. And it’s also highly instructive.

This is the first time I see \offinterlineskip. Thanks to “TeX for the
Impatient”, I see that this is a TeX command.


beware, it's a macro, not a primitive (and context has a bit different 
definition)


Hans

-
  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] mathmatrix and internal lines

2020-11-26 Thread Hans Hagen

On 11/26/2020 8:43 PM, Otared Kavian wrote:

Hi Jean-Philippe,

A few weeks ago I saw briefly the discussion about Hans' message regarding 
\noalign and the the new definitions of \HR and \VR that you are sending. 
Indeed your solution works great !
Just for the case other people may have the same question about writing block 
matrix, I copy below the whole example which can be found later in the mail 
archive.
(For mkiv, I don't know how to do the same thing…).


The \noaligned permits a \protected definition. Otherwise one has to do 
something


\def\VR{\noalign\bgroup
  that command then does the rule and ends the noalign. Also, that one 
cannot be \protected (a pitty in case one uses \expanded or so)


So ... a multistep approach. Plenty of that in mkiv.


%%% begin block-matrix.tex
% in LMTX defining \HR and \VR to create block matrices:
\pushoverloadmode
\noaligned\tolerant\protected\def\HR[#1]{\noalign{\hrule #1}}
\popoverloadmode

\def\VR{\dosingleempty\doVR}
\def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}


given the \HR definition that should be

\tolerant\protected\def\VR[#1]{\NC ...\NC}


\definemathmatrix[mymatrix]
[left={\left(\,},
right={\, \right)}]

\starttext  

\startformula
\startmymatrix
\NC A \VR  B \NR
\HR
\NC C \VR  D \NR
\stopmymatrix
\stopformula

\stoptext


Anyway, a feature like this should be in sync with other table 
mechanisms, so


\definemathmatrix
  [mymatrix]
  [left={\left\lparent\thinspace},
   right={\thinspace\right\rparent}]

\starttext

\startformula
\startmymatrix
\NC A \VL  B \NR
\HL
\NC C \VL  D \NR
\stopmymatrix
\stopformula

\startformula
\startmymatrix
\NC A \VL[3,green]  B \NR
\HL[10,red]
\NC C \VL  D \NR
\stopmymatrix
\stopformula

\stoptext

A bit more code needed but the next upload will have it. Of course you 
have to wikify it.


Hans

-
  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] question about frames

2020-11-26 Thread Andres Conrado Montoya
A bit late to the party but maybe this helps... try "frameoffset":

\defineframed[caja][frameoffset=\zeropoint,width=5cm,height=2cm]
\starttext
\dorecurse{5}{\caja[frame=on]{Hello}}
\stoptext

-- 
Andrés Conrado Montoya
___
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] Orphan issue with \startitemize

2020-11-26 Thread Marco Patzer
On Thu, 26 Nov 2020 21:11:25 +
Bruce Horrocks  wrote:

> With \dorecurse{34} all of the items move to the second page even
> though only one extra line has been added and there is now quite a
> large gap at the bottom of the first page.
> 
> Is there a setting that controls this a bit more precisely, please?
> (So that \dorecurse{34} and possibly even 35 would still split one
> and three.)

You could adjust the clubpenalty and widowpenalty:

\startsetups [mypenalties]
  %% \setdefaultpenalties
  \setpenalties\widowpenalties {2}{100}
  \setpenalties\clubpenalties  {2}{100}
\stopsetups

\setuplayout [setups=mypenalties]

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


Re: [NTG-context] question about frames

2020-11-26 Thread Andres Conrado Montoya
Disregard that... that is the default... it doesn't work as I thought
initially. Sorry for the noise.
___
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] Orphan issue with \startitemize

2020-11-26 Thread Bruce Horrocks
With the following MWE:

\def\Lorem{Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. }

\showframe
\starttext

%\dorecurse{32}{ ~ \par }
%\dorecurse{33}{ ~ \par }
\dorecurse{34}{ ~ \par }

The following items are blah blah blsh:
\startitemize
\sym{-} \Lorem
\sym{-} \Lorem
\sym{-} \Lorem
\sym{-} \Lorem
\stopitemize
\stoptext

I find that \dorecurse{32} fits two items on the bottom of the first page and 
two at the top of the next. This is fine.

With \dorecurse{33} I get one and three - which is also fine.

With \dorecurse{34} all of the items move to the second page even though only 
one extra line has been added and there is now quite a large gap at the bottom 
of the first page.

Is there a setting that controls this a bit more precisely, please? (So that 
\dorecurse{34} and possibly even 35 would still split one and three.)

--
Bruce Horrocks
Hampshire, UK

___
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] question about frames

2020-11-26 Thread Pablo Rodriguez
On 11/26/20 5:26 PM, Wolfgang Schuster wrote:
> Pablo Rodriguez schrieb am 25.11.2020 um 22:43:
>> [...]
>> Which is the way to avoid any vertical space between frames?
>
> Variant 1:
>
> \offinterlineskip}

Many thanks for your reply, Wolfgang.

As always, your solution is straight to the point and works like a
charm. And it’s also highly instructive.

This is the first time I see \offinterlineskip. Thanks to “TeX for the
Impatient”, I see that this is a TeX command.

> Variant 2:
>
> \setuparranging
>[XY]

I wonder whether arranging is a more proper way of doing labels.

Maybe I’m too lazy, but I see this variant also as a more complex way to
achieve it.

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
___


Re: [NTG-context] Vertical space when surrounding with textbackground

2020-11-26 Thread Johann Birnick
On Thu, 2020-11-26 at 21:01 +0100, Johann Birnick wrote:
> On Thu, 2020-11-26 at 20:11 +0100, Wolfgang Schuster wrote:
> > Johann Birnick schrieb am 26.11.2020 um 19:42:
> > > Ah, sorry again. I use
> > > 
> > > \usemodule[Scite]
> > > 
> > > at the begin of the document. Removing this helps. But I need it for the C
> > > and
> > > Cpp pretty printer. So do you know what's going on with Scite module?
> > 
> > 1. There is still no working minimal example, just another piece.
> > 
> > 2. There is no option line for me in the following example (LuaTeX and 
> > LMTX) with the current version (2020.11.26 15:41).
> > 
> > \usemodule[scite]
> > 
> > \definetextbackground
> >    [CodeBackground]
> >    [  frame=off,
> >  background=color,
> >     backgroundcolor=lightgray,
> >    location=paragraph,
> >  before=\blank,
> >   after=\blank]
> > 
> > \setuptyping
> >    [CPP]
> >    [before=\startCodeBackground,
> >  after=\stopCodeBackground]
> > 
> > \starttext
> > 
> > \samplefile{ward}
> > 
> > \startCPP
> > #include 
> > 
> > int main(void)
> > {
> >  printf("hello, world\n");
> > }
> > \stopCPP
> > 
> > \samplefile{weisman}
> > 
> > \stoptext
> > 
> > Wolfgang
> 
> Hello Wolfgang,
> 
> let's take your code as a MWE. I compiled exactly your code and there is a
> line
> at the end. I attached my compiled PDF.
> 
> I compiled it using "context test" where the file name is "test.tex" with
> exactly your content.
> 
> I am using the latest version from the Arch Linux Repo, `context --version`
> gives:
> 
> mtx-context | ConTeXt Process Management 1.03
> mtx-context |
> mtx-context | main context file: /usr/share/texmf-
> dist/tex/context/base/mkiv/context.mkiv
> mtx-context | current version: 2020.03.10 14:44
> mtx-context | main context file: /usr/share/texmf-
> dist/tex/context/base/mkiv/context.mkxl
> mtx-context | current version: 2020.03.10 14:44
> 
> So probably I should upgrade..
> 
> Greetings,
> Johann

I have updated and now it works. Thank you very much for all your efforts.

Now let's come to my second problem: the sidebar. Proudly, I present to you my
first MWE:

\definetyping[CPP] 
   [before=\startsidebar,
 after=\stopsidebar]

\starttext

\samplefile{ward}

\startCPP
#include 

int main(void)
{
 printf("hello, world\n");
}
\stopCPP

\samplefile{weisman}

\stoptext

Can you see that there is an additional line before and after the code?
How can I get rid of these?

I greatly appreciate your help.

Thanks,
Johann

___
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] Vertical space when surrounding with textbackground

2020-11-26 Thread Wolfgang Schuster

Johann Birnick schrieb am 26.11.2020 um 21:40:
I have updated and now it works. Thank you very much for all your 
efforts. 


The problem was fixed at the end of march.


Now let's come to my second problem: the sidebar. Proudly, I present to you my
first MWE:

\definetyping[CPP]
[before=\startsidebar,
  after=\stopsidebar]

\starttext

\samplefile{ward}

\startCPP
#include 

int main(void)
{
  printf("hello, world\n");
}
\stopCPP

\samplefile{weisman}

\stoptext

Can you see that there is an additional line before and after the code?
How can I get rid of these?


You have to use the textbackground environment with a custom background
to draw the line, the sidebar environment doesn't work because the code
blocks forces a line break at the begin and end.

You can look at Adityas blog for a example to create such a background:
https://adityam.github.io/context-blog/post/frame-with-solid-left-line-redux/

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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Keith McKay
/First « //uniformdeviate(1) - 0.5// » could be modified to « 
//uniformdeviate(0.5)//»./

/
/
/To add noise, you can use the randomized function of Metafun. For 
exemple, you can write:/

/
/
/draw pp randomized 1cm ;/
/
/
That's true Fabrice but in this use case I wanted a random number 
between -0.5 and +0.5, and I wasn't sure I would get that with randomized.

Thanks again
Keith McKay/
/
On 26/11/2020 17:20, Fabrice L wrote:

Keith,

Le 26 nov. 2020 à 12:12, Keith McKay > a écrit :


Thanks Fabrice and Hans.

I now see I can simplify some lines of the code:

pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm); now becomes pp:= a[i];

and

pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm); now 
becomes pp := pp --- a[i +1] ;


However I still have the problem in the calculation of xcoord and 
ycoord which are used in the creation of path pp:

for squig = 1 step 1 until 15:
xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);
endfor;
I'm adding a small random amount to the x and ypart of the pair a[i] 
to produce a path that is like a squiggle (gribouiller in French, 
according to Google). I have to use cf to convert to the x and yparts 
to centimeters since they seem to loose the centimeter units on 
separation. I can't see anyway round this, or am I missing something?

Thanks
Keith McKay


First « uniformdeviate(1) - 0.5 » could be modified to « 
uniformdeviate(0.5)».


To add noise, you can use the randomized function of Metafun. For 
exemple, you can write:


draw pp randomized 1cm ;

Fabrice.




On 26/11/2020 15:19, Fabrice L wrote:

Hi keith,

Le 26 nov. 2020 à 10:09, Keith McKay > a écrit :


Hi,

I have been using xpart and ypart to extract these values from 
pairs of points in a path but I wasn't getting the correct result. 
I was expecting:


pair (2cm, 11cm) to give xpart 2 and ypart 11

However I was getting:

pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096

After much head scratching and reading the MetaPost and MetaFun 
manuals, I realised that the units of xpart or ypart are in 
Postcript points or Big Points (bp), and 1 bp is 1/72 of an inch, 
and thus to get the values of xpart or ypart in cm I would have to 
use a correction factor. I had made the assumption that since the x 
and ypart in the pair was in cm that the result would be in cm, but 
I see now that this is not the case. Will I have to continue doing 
this or is there some magic within MetaFun which takes account of 
the units in a pair and outputs the result of x and ypart in the 
same units?


The MWE belows shows what I have been doing.

Thanks

Keith McKay

%%% MWE %%%
\setuppapersize [A5, landscape][A4, portrait]
\usecolors[crayola]
\starttext
\startMPpage
StartPage;
width := PaperWidth ; height := PaperHeight ; unit := cm ;
numeric squig;
pair a[]; a0 = (2cm,11cm); a1 = (4cm,10cm); a2 = (6cm,9cm); a3 = 
(8cm,8cm);
show xpart a[0], ypart a[0]; %Example of result from x and ypart 
before applying correction factor (cf) %

cf := 72/2.54; %Converts points/in to points/cm%
path pp;
for i = 0 step 1 until 3:
pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);
for squig = 1 step 1 until 15:
xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);
endfor;
pp := pp --- cycle;
if i < 3 :
pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);
fi;
f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to 
lighten/darken colour %
draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
withcolor (f[white,\MPcolor{BurntSienna}]);

endfor;
StopPage;
\stopMPpage
\stoptext
%%



MetaPost (MetaFun) is taking care of everything regarding units. As 
you ave discovered, everything is translated to a unique internal 
dimension. So you can write:


 a := (1cm,2in) ;

with no problem. The « cm » and « in » parts of the expression will 
become numbers to translate this number on the right unit.

Fabrice.


___ 
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 

Re: [NTG-context] new upload

2020-11-26 Thread Bruce Horrocks


> On 26 Nov 2020, at 18:43, Mojca Miklavec  
> wrote:
> 
> There are three options:
> - the existing Intel binaries should work just fine
> - yes, you should be able to compile the binaries yourself
> - we should eventually get hold of one device for our build farm, or
> in the meantime just ask someone for the initial build which should
> keep you covered for a while

There's a 4th option: use Xcode on an Intel Mac to generate a fat binary 
containing both ARM and intel code. After all, if Xcode can cross-compile to 
produce native ARM iPad and iPhone apps then there's no reason why it shouldn't 
be able to do so for Mac apps.

The M1 code would be untested of course, but beyond that... ;-)

--
Bruce Horrocks
Hampshire, UK

___
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] Testing for LMTX

2020-11-26 Thread Pablo Rodriguez
On 11/26/20 8:06 PM, Jean-Philippe Rey wrote:
> [...]
> Do you know a way to distinguish between LMTX and MkIV ?

Hi Jean-Philippe,

I guess this is what you are looking for:

  \starttext
  \startTEXpage[offset=1em]
  \startlmtxmode LMTX\stoplmtxmode
  \startmkivmode MkIV\stopmkivmode
  \stopTEXpage
  \stoptext

Just in case it helps,

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
___


Re: [NTG-context] Vertical space when surrounding with textbackground

2020-11-26 Thread Johann Birnick
On Thu, 2020-11-26 at 20:11 +0100, Wolfgang Schuster wrote:
> Johann Birnick schrieb am 26.11.2020 um 19:42:
> > Ah, sorry again. I use
> > 
> > \usemodule[Scite]
> > 
> > at the begin of the document. Removing this helps. But I need it for the C
> > and
> > Cpp pretty printer. So do you know what's going on with Scite module?
> 
> 1. There is still no working minimal example, just another piece.
> 
> 2. There is no option line for me in the following example (LuaTeX and 
> LMTX) with the current version (2020.11.26 15:41).
> 
> \usemodule[scite]
> 
> \definetextbackground
>    [CodeBackground]
>    [  frame=off,
>  background=color,
>     backgroundcolor=lightgray,
>    location=paragraph,
>  before=\blank,
>   after=\blank]
> 
> \setuptyping
>    [CPP]
>    [before=\startCodeBackground,
>  after=\stopCodeBackground]
> 
> \starttext
> 
> \samplefile{ward}
> 
> \startCPP
> #include 
> 
> int main(void)
> {
>  printf("hello, world\n");
> }
> \stopCPP
> 
> \samplefile{weisman}
> 
> \stoptext
> 
> Wolfgang

Hello Wolfgang,

let's take your code as a MWE. I compiled exactly your code and there is a line
at the end. I attached my compiled PDF.

I compiled it using "context test" where the file name is "test.tex" with
exactly your content.

I am using the latest version from the Arch Linux Repo, `context --version`
gives:

mtx-context | ConTeXt Process Management 1.03
mtx-context |
mtx-context | main context file: /usr/share/texmf-
dist/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2020.03.10 14:44
mtx-context | main context file: /usr/share/texmf-
dist/tex/context/base/mkiv/context.mkxl
mtx-context | current version: 2020.03.10 14:44

So probably I should upgrade..

Greetings,
Johann


test.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] new upload

2020-11-26 Thread Keith McKay
Thanks for your interesting and very helpful reply Mojca. It's given me 
lots to think about.


Best wishes

Keith McKay

On 26/11/2020 18:43, Mojca Miklavec wrote:

On Thu, 26 Nov 2020 at 16:26, Keith McKay wrote:

I was planning on getting the new entry level MAC min M1 with 8GB
unified memory but I see that there will be no ConTeXt binaries for
these new M1 chip Macs.

It's not that there will not be, it's just that none of us has
purchased a piece of hardware yet.

A few months back it was possible to purchase one, but:
- it was just a one year rental fee rather than the ability to purchase it
- definitely not available in my country
- one had to enrol to the payed developer program
- and then do a bunch of other bureaucracy (get some special business
number etc.)
- and it wasn't even guaranteed that you would get a device at the end

I was contemplating what to do this time around since 8 GB of memory
is not even sufficient to run a web browser, and the TeX Live hardly
fits on their drive :), but it should do the job purely as a build
machine. (Not that they have "none in stock", but I could smuggle one
from elsewhere as long as the postal services keep running ...)


Would it be possible for a ConTeXt user like
myself to build the binaries on my proposed new Mac? I'm not a computer
professional.

There are three options:
- the existing Intel binaries should work just fine
- yes, you should be able to compile the binaries yourself
- we should eventually get hold of one device for our build farm, or
in the meantime just ask someone for the initial build which should
keep you covered for a while

Discussing when TeX Live will be available for arm is "out of
context". We should get those binaries working before TL 2021.

Mojca
___
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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Keith McKay
Thanks again Hans and Fabrice, for the time you have both taken with my 
question and thanks for the code snippet Hans. Just one last 
confirmation from the snippet. Hans uses the correction factor cf on the 
x and yparts of a[i]. I taking this as meaning that this has to be done 
because the x and yparts of a[i] are returned as postscript points units 
and not as centimeters as in the pair. I maybe didn't make this clear in 
my original query.


Thanks for your patience.

Keith McKay

On 26/11/2020 17:25, Hans Hagen wrote:

On 11/26/2020 6:12 PM, Keith McKay wrote:

Thanks Fabrice and Hans.

I now see I can simplify some lines of the code:

pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm); now becomes pp:= a[i];

and

pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm); now 
becomes pp := pp --- a[i +1] ;


However I still have the problem in the calculation of xcoord and 
ycoord which are used in the creation of path pp:


for squig = 1 step 1 until 15:
xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);
endfor;
I'm adding a small random amount to the x and ypart of the pair a[i] 
to produce a path that is like a squiggle (gribouiller in French, 
according to Google). I have to use cf to convert to the x and yparts 
to centimeters since they seem to loose the centimeter units on 
separation. I can't see anyway round this, or am I missing something?



for squig = 1 step 1 until 15:
    xcoord := (xpart a[i]/cf);
    ycoord := (ypart a[i]/cf);
    xcoord := xcoord randomized (xcoord/50);
    ycoord := ycoord randomized (ycoord/50);
    pp := pp  .. { curl 100 } (xcoord*cm, ycoord*cm);
endfor;



Thanks
Keith McKay

On 26/11/2020 15:19, Fabrice L wrote:

Hi keith,

Le 26 nov. 2020 à 10:09, Keith McKay > a écrit :


Hi,

I have been using xpart and ypart to extract these values from 
pairs of points in a path but I wasn't getting the correct result. 
I was expecting:


pair (2cm, 11cm) to give xpart 2 and ypart 11

However I was getting:

pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096

After much head scratching and reading the MetaPost and MetaFun 
manuals, I realised that the units of xpart or ypart are in 
Postcript points or Big Points (bp), and 1 bp is 1/72 of an inch, 
and thus to get the values of xpart or ypart in cm I would have to 
use a correction factor. I had made the assumption that since the x 
and ypart in the pair was in cm that the result would be in cm, but 
I see now that this is not the case. Will I have to continue doing 
this or is there some magic within MetaFun which takes account of 
the units in a pair and outputs the result of x and ypart in the 
same units?


The MWE belows shows what I have been doing.

Thanks

Keith McKay

%%% MWE %%%
\setuppapersize [A5, landscape][A4, portrait]
\usecolors[crayola]
\starttext
\startMPpage
StartPage;
width := PaperWidth ; height := PaperHeight ; unit := cm ;
numeric squig;
pair a[]; a0 = (2cm,11cm); a1 = (4cm,10cm); a2 = (6cm,9cm); a3 = 
(8cm,8cm);
show xpart a[0], ypart a[0]; %Example of result from x and ypart 
before applying correction factor (cf) %

cf := 72/2.54; %Converts points/in to points/cm%
path pp;
for i = 0 step 1 until 3:
pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);
for squig = 1 step 1 until 15:
xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);
endfor;
pp := pp --- cycle;
if i < 3 :
pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);
fi;
f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to 
lighten/darken colour %
draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
withcolor (f[white,\MPcolor{BurntSienna}]);

endfor;
StopPage;
\stopMPpage
\stoptext
%%



MetaPost (MetaFun) is taking care of everything regarding units. As 
you ave discovered, everything is translated to a unique internal 
dimension. So you can write:


 a := (1cm,2in) ;

with no problem. The « cm » and « in » parts of the expression will 
become numbers to translate this number on the right unit.

Fabrice.


___ 
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] Vertical space when surrounding with textbackground

2020-11-26 Thread Wolfgang Schuster

Johann Birnick schrieb am 26.11.2020 um 19:42:

Ah, sorry again. I use

\usemodule[Scite]

at the begin of the document. Removing this helps. But I need it for the C and
Cpp pretty printer. So do you know what's going on with Scite module?


1. There is still no working minimal example, just another piece.

2. There is no option line for me in the following example (LuaTeX and 
LMTX) with the current version (2020.11.26 15:41).


\usemodule[scite]

\definetextbackground
  [CodeBackground]
  [  frame=off,
background=color,
   backgroundcolor=lightgray,
  location=paragraph,
before=\blank,
 after=\blank]

\setuptyping
  [CPP]
  [before=\startCodeBackground,
after=\stopCodeBackground]

\starttext

\samplefile{ward}

\startCPP
#include 

int main(void)
{
printf("hello, world\n");
}
\stopCPP

\samplefile{weisman}

\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] mathmatrix and internal lines

2020-11-26 Thread Otared Kavian
Hi Jean-Philippe,

A few weeks ago I saw briefly the discussion about Hans' message regarding 
\noalign and the the new definitions of \HR and \VR that you are sending. 
Indeed your solution works great !
Just for the case other people may have the same question about writing block 
matrix, I copy below the whole example which can be found later in the mail 
archive.
(For mkiv, I don't know how to do the same thing…).

%%% begin block-matrix.tex
% in LMTX defining \HR and \VR to create block matrices:
\pushoverloadmode
\noaligned\tolerant\protected\def\HR[#1]{\noalign{\hrule #1}}
\popoverloadmode

\def\VR{\dosingleempty\doVR}
\def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}

\definemathmatrix[mymatrix]
[left={\left(\,},
right={\, \right)}]

\starttext  

\startformula
\startmymatrix
\NC A \VR  B \NR
\HR
\NC C \VR  D \NR
\stopmymatrix
\stopformula

\stoptext
%%% end block-matrix.tex

Best regards: Otared K.

> On 26 Nov 2020, at 19:46, Jean-Philippe Rey 
>  wrote:
> 
> Hi Otared,
> 
> Thank you very much.
> 
> I used your example to write the following macros. They are far from perfect 
> but suit my needs.  A few days ago, Hans warned not to use \noalign in LMTX, 
> so I used the trick he gave to the list even if I don't really understand it.
> 
> === LMTX version 
> %D \macros{HR, VR}
> %D \type{\HR} draws a horizontal rule between two rows of a matrix
> %D \type{\VR} is used in place of \type{\NC} to draw a vertical rule between 
> two columns of a matrix
> %D each macro takes an optional parameter giving the rule dimensions
> %D Example
> %D  \type{\startmatrix \NC A \VR[depth 2mm] B \NR \HR[height 0.6pt] \NC C \VR 
> D \NR \stopmatrix}
>  
> \pushoverloadmode
> \noaligned\tolerant\protected\def\HR[#1]{\noalign{\hrule #1}}
> \popoverloadmode
> 
> \def\VR{\dosingleempty\doVR}
> \def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}
> ===
> 
> === MkIV version 
> %D \macros{HR, VR}
> %D \type{\HR} draws a horizontal rule between two rows of a matrix
> %D \type{\VR} is used in place of \type{\NC} to draw a vertical rule between 
> two columns of a matrix
> %D it takes an optional parameter giving the rule dimensions
> %D Example
> %D  \type{\startmatrix \NC A \VR[depth 2mm] B \NR \HR \NC C \VR D \NR 
> \stopmatrix}
>  
> \def\HR{\noalign{\hrule}}
> 
> \def\VR{\dosingleempty\doVR}
> \def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}
> ===
> 
> For the MkIV version I haven't been able to add an optional parameter to \HR 
> the code
> 
> \def\HR{\dosingleempty\doHR}
> \def\doHR[#1]{\noalign{\hrule #1}}
> 
> complains about "Misplaced \noalign"
> 
> Best regards,
> 
> 
> 
>> Le 26 nov. 2020 à 13:40, Otared Kavian  a écrit :
>> 
>> Hi Jean-Philippe,
>> 
>> The following is better than the one I sent earlier:
>> 
>> \definemathmatrix[mymatrix]
>>  [left={\left(\,},
>>  right={\ \right)}]
>>  
>> \starttext
>> \startformula
>>  \startmymatrix
>>  \NC A \NC\hskip-.5em \vrule  \NC\hskip-.5em B \NR
>>  \noalign{\hrule}
>>  \NC C \NC \hskip-.5em\vrule \NC \hskip-.5em D \NR
>>  \stopmymatrix
>> \stopformula
>> \stoptext
>> 
>> Best regards: Otared K.
>> 
>>> On 26 Nov 2020, at 10:19, Jean-Philippe Rey 
>>>  wrote:
>>> 
>>> Dear list,
>>> 
>>> I would like to draw matrices with internal lines as can be done with LaTeX 
>>> (cf pdf output) :
>>> 
>>> 
>>> \documentclass{article}
>>> \begin{document}
>>> $M =\left( \begin{array}{c|c}
>>> A & B \\
>>> \hline
>>> C & D \\
>>> \end{array} \right)$
>>> \end{document}
>>> 
>>> 
>>> I didn't find out how to use mathmatrix to achieve this. My best result to 
>>> date is 
>>> 
>>> 
>>> \starttext
>>> $M = \left( \bTABLE[frame=off]
>>> \bTR
>>> \bTD[rightframe=on, bottomframe=on] $A$ \eTD
>>> \bTD[bottomframe=on] $B$ \eTD
>>> \eTR\bTR
>>> \bTD[rightframe=on] $C$ \eTD
>>> \bTD $D$ \eTD
>>> \eTR
>>> \eTABLE \right)$
>>> \stoptext
>>> 
>>> 
>>> The code is rather ugly, and I get a spurious space at the bottom of the 
>>> table.
>>> 
>>> Any hints?
>>> 
>>> Thank you,
> 
> -- 
> Jean-Philippe Rey
> jean-philippe@centralesupelec.fr
> 91192 Gif-sur-Yvette Cedex - France
> Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
> 
> ___
> 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] Testing for LMTX

2020-11-26 Thread Jairo A. del Rio
Hi

I'm not sure whether or not there's a better way, but a bit of grepping
allows you to find the following conditional:

\starttext
\ifcase\contextlmtxmode
MKIV %Whatever you want in MkIV
\else
LMTX %Whatever you want in LMTX
\fi
\stoptext

Best regards,

Jairo

El jue, 26 de nov. de 2020 a la(s) 14:06, Jean-Philippe Rey (
jean-philippe@centralesupelec.fr) escribió:

> Dear list,
>
> I would like to determine if LMTX is being used. Mimicking system modes I
> tried
>
>   \startmode[*lmtx] . . . \stopmode
>
> however, LMTX doesn't define this mode but apparently defines *mkiv.
>
> Do you know a way to distinguish between LMTX and MkIV ?
>
> Thank you,
>
> --
> Jean-Philippe Rey
> jean-philippe@centralesupelec.fr
> 91192 Gif-sur-Yvette Cedex - France
> Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
>
>
> ___
> 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] new upload

2020-11-26 Thread luigi scarso
On Thu, Nov 26, 2020 at 6:10 PM Hans Hagen  wrote:

> On 11/26/2020 6:07 PM, luigi scarso wrote:
> >
> >
> > Il Gio 26 Nov 2020, 18:00 Hans Hagen  > > ha scritto:
> >
> > On 11/26/2020 5:10 PM, luigi scarso wrote:
> >  >
> >  >
> >  > On Thu, Nov 26, 2020 at 5:00 PM Hans Hagen  > 
> >  > >> wrote:
> >  >
> >  >   Of course, if they care about luatex cs support they
> >  > could send an M1 mini to Mojca for the compile farm for some
> real
> >  > testing.
> >  >
> >  >
> >  > very likely luatex will run full native on M1 on next texlive,
> > following
> >  > http://www.tug.org/mactex/aboutarm.html
> > 
> >  >  > >
> > that's with universal binaries (as happened before when apple
> switched
> > from powerpc to intel)
> >
> >
> > Full native:
> > """
> > Full native Arm support will arrive with MacTeX-2021 next spring.
> > """
>
> sure, but by using a unversal bin:
>

it's not bad,  13MB (or less, due the shared data) vs 6.5MB for downloading
is  still acceptable for the user.
Of course for the provider it doubles the space, but I fear that this
cannot be avoided for the next five years.

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


[NTG-context] Testing for LMTX

2020-11-26 Thread Jean-Philippe Rey
Dear list,

I would like to determine if LMTX is being used. Mimicking system modes I tried

  \startmode[*lmtx] . . . \stopmode

however, LMTX doesn't define this mode but apparently defines *mkiv.

Do you know a way to distinguish between LMTX and MkIV ?

Thank you,

-- 
Jean-Philippe Rey
jean-philippe@centralesupelec.fr
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51

___
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] new upload

2020-11-26 Thread Wolfgang Schuster

Mojca Miklavec schrieb am 26.11.2020 um 19:43:

There are three options:
- the existing Intel binaries should work just fine
- yes, you should be able to compile the binaries yourself
- we should eventually get hold of one device for our build farm, or
in the meantime just ask someone for the initial build which should
keep you covered for a while


For the moment a normal intel mac should work to create a universal binary:

https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary

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] mathmatrix and internal lines

2020-11-26 Thread Jean-Philippe Rey
Hi Otared,

Thank you very much.

I used your example to write the following macros. They are far from perfect 
but suit my needs.  A few days ago, Hans warned not to use \noalign in LMTX, so 
I used the trick he gave to the list even if I don't really understand it.

=== LMTX version 
%D \macros{HR, VR}
%D \type{\HR} draws a horizontal rule between two rows of a matrix
%D \type{\VR} is used in place of \type{\NC} to draw a vertical rule between 
two columns of a matrix
%D each macro takes an optional parameter giving the rule dimensions
%D Example
%D  \type{\startmatrix \NC A \VR[depth 2mm] B \NR \HR[height 0.6pt] \NC C \VR D 
\NR \stopmatrix}
 
\pushoverloadmode
\noaligned\tolerant\protected\def\HR[#1]{\noalign{\hrule #1}}
\popoverloadmode

\def\VR{\dosingleempty\doVR}
\def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}
===

=== MkIV version 
%D \macros{HR, VR}
%D \type{\HR} draws a horizontal rule between two rows of a matrix
%D \type{\VR} is used in place of \type{\NC} to draw a vertical rule between 
two columns of a matrix
%D it takes an optional parameter giving the rule dimensions
%D Example
%D  \type{\startmatrix \NC A \VR[depth 2mm] B \NR \HR \NC C \VR D \NR 
\stopmatrix}
 
\def\HR{\noalign{\hrule}}

\def\VR{\dosingleempty\doVR}
\def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}
===

For the MkIV version I haven't been able to add an optional parameter to \HR 
the code

\def\HR{\dosingleempty\doHR}
\def\doHR[#1]{\noalign{\hrule #1}}

complains about "Misplaced \noalign"

Best regards,



> Le 26 nov. 2020 à 13:40, Otared Kavian  a écrit :
> 
> Hi Jean-Philippe,
> 
> The following is better than the one I sent earlier:
> 
> \definemathmatrix[mymatrix]
>   [left={\left(\,},
>   right={\ \right)}]
>   
> \starttext
> \startformula
>   \startmymatrix
>   \NC A \NC\hskip-.5em \vrule  \NC\hskip-.5em B \NR
>   \noalign{\hrule}
>   \NC C \NC \hskip-.5em\vrule \NC \hskip-.5em D \NR
>   \stopmymatrix
> \stopformula
> \stoptext
> 
> Best regards: Otared K.
> 
>> On 26 Nov 2020, at 10:19, Jean-Philippe Rey 
>>  wrote:
>> 
>> Dear list,
>> 
>> I would like to draw matrices with internal lines as can be done with LaTeX 
>> (cf pdf output) :
>> 
>> 
>> \documentclass{article}
>> \begin{document}
>> $M =\left( \begin{array}{c|c}
>> A & B \\
>> \hline
>> C & D \\
>> \end{array} \right)$
>> \end{document}
>> 
>> 
>> I didn't find out how to use mathmatrix to achieve this. My best result to 
>> date is 
>> 
>> 
>> \starttext
>> $M = \left( \bTABLE[frame=off]
>> \bTR
>>  \bTD[rightframe=on, bottomframe=on] $A$ \eTD
>>  \bTD[bottomframe=on] $B$ \eTD
>> \eTR\bTR
>>  \bTD[rightframe=on] $C$ \eTD
>>  \bTD $D$ \eTD
>> \eTR
>> \eTABLE \right)$
>> \stoptext
>> 
>> 
>> The code is rather ugly, and I get a spurious space at the bottom of the 
>> table.
>> 
>> Any hints?
>> 
>> Thank you,


-- 
Jean-Philippe Rey
jean-philippe@centralesupelec.fr 

91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51

___
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] new upload

2020-11-26 Thread Mojca Miklavec
On Thu, 26 Nov 2020 at 16:26, Keith McKay wrote:
>
> I was planning on getting the new entry level MAC min M1 with 8GB
> unified memory but I see that there will be no ConTeXt binaries for
> these new M1 chip Macs.

It's not that there will not be, it's just that none of us has
purchased a piece of hardware yet.

A few months back it was possible to purchase one, but:
- it was just a one year rental fee rather than the ability to purchase it
- definitely not available in my country
- one had to enrol to the payed developer program
- and then do a bunch of other bureaucracy (get some special business
number etc.)
- and it wasn't even guaranteed that you would get a device at the end

I was contemplating what to do this time around since 8 GB of memory
is not even sufficient to run a web browser, and the TeX Live hardly
fits on their drive :), but it should do the job purely as a build
machine. (Not that they have "none in stock", but I could smuggle one
from elsewhere as long as the postal services keep running ...)

> Would it be possible for a ConTeXt user like
> myself to build the binaries on my proposed new Mac? I'm not a computer
> professional.

There are three options:
- the existing Intel binaries should work just fine
- yes, you should be able to compile the binaries yourself
- we should eventually get hold of one device for our build farm, or
in the meantime just ask someone for the initial build which should
keep you covered for a while

Discussing when TeX Live will be available for arm is "out of
context". We should get those binaries working before TL 2021.

Mojca
___
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] Vertical space when surrounding with textbackground

2020-11-26 Thread Johann Birnick
On Thu, 2020-11-26 at 19:39 +0100, Johann Birnick wrote:
> On Thu, 2020-11-26 at 19:35 +0100, Wolfgang Schuster wrote:
> > Johann Birnick schrieb am 26.11.2020 um 19:26:
> > > I didn't want to copy paste it :D Just add [option=XML] to \starttext like
> > > this:
> > 
> > Why do pass a option for the typing environment to \starttext?
> > 
> > > \definetextbackground[code][background=color, backgroundcolor=lightgray,
> > > frame=off, location=paragraph]
> > > 
> > > \setuptyping[before={\startbackground[code]}, after={\stopbackground}]
> > > 
> > > \starttext[option=XML]
> > > \starttyping
> > > This is some code
> > > a second line
> > > \stoptyping
> > > \stoptext
> > > 
> > > When I use \definetyping[Mytyping][option=XML] and then use \startMytyping
> > > ...
> > > \stopMytyping nothing changes.
> > ???
> > 
> > \definetextbackground
> >    [Code]
> >    [  frame=off,
> >  background=color,
> >     backgroundcolor=lightgray,
> >    location=paragraph]
> > 
> > \definetyping
> >    [Mytyping]
> >    [option=XML]
> > 
> > \setuptyping
> >   %[Mytyping]
> >    [before={\blank\starttextbackground[Code]},
> >  after={\stoptextbackground\blank}]
> > 
> > \starttext
> > 
> > \startMytyping
> > 
> > \stopMytyping
> > 
> > \starttyping[option=XML]
> > 
> > \stoptyping
> > 
> > \stoptext
> > 
> > Wolfgang
> > 
> 
> Sorry for confusing \starttext with \starttyping.
> 
> @Wolfgang this is exactly what I mean. It doesn't work. There is an extra line
> at the end. If you remove [option=XML] it works. So what is going wrong?
> 
> Thank you,
> Johann

Ah, sorry again. I use

\usemodule[Scite]

at the begin of the document. Removing this helps. But I need it for the C and
Cpp pretty printer. So do you know what's going on with Scite module?

Thanks,
Johann

___
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] Vertical space when surrounding with textbackground

2020-11-26 Thread Johann Birnick
On Thu, 2020-11-26 at 19:35 +0100, Wolfgang Schuster wrote:
> Johann Birnick schrieb am 26.11.2020 um 19:26:
> > I didn't want to copy paste it :D Just add [option=XML] to \starttext like
> > this:
> 
> Why do pass a option for the typing environment to \starttext?
> 
> > \definetextbackground[code][background=color, backgroundcolor=lightgray,
> > frame=off, location=paragraph]
> > 
> > \setuptyping[before={\startbackground[code]}, after={\stopbackground}]
> > 
> > \starttext[option=XML]
> > \starttyping
> > This is some code
> > a second line
> > \stoptyping
> > \stoptext
> > 
> > When I use \definetyping[Mytyping][option=XML] and then use \startMytyping
> > ...
> > \stopMytyping nothing changes.
> ???
> 
> \definetextbackground
>    [Code]
>    [  frame=off,
>  background=color,
>     backgroundcolor=lightgray,
>    location=paragraph]
> 
> \definetyping
>    [Mytyping]
>    [option=XML]
> 
> \setuptyping
>   %[Mytyping]
>    [before={\blank\starttextbackground[Code]},
>  after={\stoptextbackground\blank}]
> 
> \starttext
> 
> \startMytyping
> 
> \stopMytyping
> 
> \starttyping[option=XML]
> 
> \stoptyping
> 
> \stoptext
> 
> Wolfgang
> 

Sorry for confusing \starttext with \starttyping.

@Wolfgang this is exactly what I mean. It doesn't work. There is an extra line
at the end. If you remove [option=XML] it works. So what is going wrong?

Thank you,
Johann

___
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] Vertical space when surrounding with textbackground

2020-11-26 Thread Wolfgang Schuster

Johann Birnick schrieb am 26.11.2020 um 19:26:

I didn't want to copy paste it :D Just add [option=XML] to \starttext like this:


Why do pass a option for the typing environment to \starttext?


\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\setuptyping[before={\startbackground[code]}, after={\stopbackground}]

\starttext[option=XML]
\starttyping
This is some code
a second line
\stoptyping
\stoptext

When I use \definetyping[Mytyping][option=XML] and then use \startMytyping ...
\stopMytyping nothing changes.

???

\definetextbackground
  [Code]
  [  frame=off,
    background=color,
   backgroundcolor=lightgray,
  location=paragraph]

\definetyping
  [Mytyping]
  [option=XML]

\setuptyping
 %[Mytyping]
  [before={\blank\starttextbackground[Code]},
    after={\stoptextbackground\blank}]

\starttext

\startMytyping

\stopMytyping

\starttyping[option=XML]

\stoptyping

\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] Vertical space when surrounding with textbackground

2020-11-26 Thread Aditya Mahajan
On Thu, 26 Nov 2020, Johann Birnick wrote:

> On Thu, 2020-11-26 at 19:17 +0100, Wolfgang Schuster wrote:
> > Johann Birnick schrieb am 26.11.2020 um 19:10:
> > > On Thu, 2020-11-26 at 17:31 +0100, Wolfgang Schuster wrote:
> > > > Johann Birnick schrieb am 26.11.2020 um 17:00:
> > > > > On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:
> > > > > > On Thu, 26 Nov 2020, Johann Birnick wrote:
> > > > > > 
> > > > > > > How to surround such things properly? I just want a background to
> > > > > > > these
> > > > > > > and
> > > > > > > a
> > > > > > > sidebar. No addition spacing / empty lines.
> > > > > > A MWE will help...
> > > > > > 
> > > > > > Aditya
> > > > > For example, take:
> > > > > 
> > > > > \definetextbackground[code][background=color, 
> > > > > backgroundcolor=lightgray,
> > > > > frame=off, location=paragraph]
> > > > > 
> > > > > \starttextbackground[code]
> > > > > \starttyping
> > > > > This is some code
> > > > > a second line
> > > > > \stoptyping
> > > > > \stoptextbackground
> > > > You missed the W (working) in MWE.
> > > > 
> > > > \definetextbackground
> > > >     [Code]
> > > >     [  frame=off,
> > > >   background=color,
> > > >  backgroundcolor=lightgray,
> > > >     location=paragraph]
> > > > 
> > > > \setuptyping
> > > >     [before={\blank\starttextbackground[Code]},
> > > >   after={\stoptextbackground\blank}]
> > > > 
> > > > \starttext
> > > > 
> > > > \starttyping
> > > > This is some code
> > > > a second line
> > > > \stoptyping
> > > > 
> > > > \stoptext
> > > > 
> > > > Wolfgang
> > > Okay so first sorry that the example missed the \starttext ... \stoptext.
> > > Won't
> > >   
> 
> I didn't want to copy paste it :D Just add [option=XML] to \starttext like 
> this:

\starttext does not take an `option=XML` argument.

> \definetextbackground[code][background=color, backgroundcolor=lightgray,
> frame=off, location=paragraph]
> 
> \setuptyping[before={\startbackground[code]}, after={\stopbackground}]
> 
> \starttext[option=XML]
> \starttyping
> This is some code
> a second line
> \stoptyping
> \stoptext
> 
> When I use \definetyping[Mytyping][option=XML] and then use \startMytyping ...
> \stopMytyping nothing changes.

Again, a MWE help to understand what is going wrong.


\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\setuptyping[before={\startbackground[code]}, after={\stopbackground}]

\definetyping[XMLtyping]
 [
   option=XML,
   before={\startbackground[code]},
   after={\stopbackground},
 ]

\starttext
\startXMLtyping
This is some code
a second line
\stopXMLtyping
\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Vertical space when surrounding with textbackground

2020-11-26 Thread Johann Birnick
On Thu, 2020-11-26 at 19:17 +0100, Wolfgang Schuster wrote:
> Johann Birnick schrieb am 26.11.2020 um 19:10:
> > On Thu, 2020-11-26 at 17:31 +0100, Wolfgang Schuster wrote:
> > > Johann Birnick schrieb am 26.11.2020 um 17:00:
> > > > On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:
> > > > > On Thu, 26 Nov 2020, Johann Birnick wrote:
> > > > > 
> > > > > > How to surround such things properly? I just want a background to
> > > > > > these
> > > > > > and
> > > > > > a
> > > > > > sidebar. No addition spacing / empty lines.
> > > > > A MWE will help...
> > > > > 
> > > > > Aditya
> > > > For example, take:
> > > > 
> > > > \definetextbackground[code][background=color, backgroundcolor=lightgray,
> > > > frame=off, location=paragraph]
> > > > 
> > > > \starttextbackground[code]
> > > > \starttyping
> > > > This is some code
> > > > a second line
> > > > \stoptyping
> > > > \stoptextbackground
> > > You missed the W (working) in MWE.
> > > 
> > > \definetextbackground
> > >     [Code]
> > >     [  frame=off,
> > >   background=color,
> > >  backgroundcolor=lightgray,
> > >     location=paragraph]
> > > 
> > > \setuptyping
> > >     [before={\blank\starttextbackground[Code]},
> > >   after={\stoptextbackground\blank}]
> > > 
> > > \starttext
> > > 
> > > \starttyping
> > > This is some code
> > > a second line
> > > \stoptyping
> > > 
> > > \stoptext
> > > 
> > > Wolfgang
> > Okay so first sorry that the example missed the \starttext ... \stoptext.
> > Won't
> > 

I didn't want to copy paste it :D Just add [option=XML] to \starttext like this:

\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\setuptyping[before={\startbackground[code]}, after={\stopbackground}]

\starttext[option=XML]
\starttyping
This is some code
a second line
\stoptyping
\stoptext

When I use \definetyping[Mytyping][option=XML] and then use \startMytyping ...
\stopMytyping nothing changes.

___
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] Vertical space when surrounding with textbackground

2020-11-26 Thread Wolfgang Schuster

Johann Birnick schrieb am 26.11.2020 um 19:10:

On Thu, 2020-11-26 at 17:31 +0100, Wolfgang Schuster wrote:

Johann Birnick schrieb am 26.11.2020 um 17:00:

On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:

On Thu, 26 Nov 2020, Johann Birnick wrote:


How to surround such things properly? I just want a background to these
and
a
sidebar. No addition spacing / empty lines.

A MWE will help...

Aditya

For example, take:

\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\starttextbackground[code]
\starttyping
This is some code
a second line
\stoptyping
\stoptextbackground

You missed the W (working) in MWE.

\definetextbackground
    [Code]
    [  frame=off,
  background=color,
     backgroundcolor=lightgray,
    location=paragraph]

\setuptyping
    [before={\blank\starttextbackground[Code]},
  after={\stoptextbackground\blank}]

\starttext

\starttyping
This is some code
a second line
\stoptyping

\stoptext

Wolfgang

Okay so first sorry that the example missed the \starttext ... \stoptext. Won't
happen again.

So unfortunately my MWE was too minimal. Actually this works:

\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\setuptyping[before={\startbackground[code]}, after={\stopbackground}]

\starttext
\starttyping
This is some code
a second line
\stoptyping
\stoptext

However, I use pretty printing. When you add [option=XML] to \starttext it
breaks.

Why?


Do you have a example.

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] Vertical space when surrounding with textbackground

2020-11-26 Thread Johann Birnick
On Thu, 2020-11-26 at 17:31 +0100, Wolfgang Schuster wrote:
> Johann Birnick schrieb am 26.11.2020 um 17:00:
> > On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:
> > > On Thu, 26 Nov 2020, Johann Birnick wrote:
> > > 
> > > > How to surround such things properly? I just want a background to these
> > > > and
> > > > a
> > > > sidebar. No addition spacing / empty lines.
> > > 
> > > A MWE will help...
> > > 
> > > Aditya
> > 
> > For example, take:
> > 
> > \definetextbackground[code][background=color, backgroundcolor=lightgray,
> > frame=off, location=paragraph]
> > 
> > \starttextbackground[code]
> > \starttyping
> > This is some code
> > a second line
> > \stoptyping
> > \stoptextbackground
> 
> You missed the W (working) in MWE.
> 
> \definetextbackground
>    [Code]
>    [  frame=off,
>  background=color,
>     backgroundcolor=lightgray,
>    location=paragraph]
> 
> \setuptyping
>    [before={\blank\starttextbackground[Code]},
>  after={\stoptextbackground\blank}]
> 
> \starttext
> 
> \starttyping
> This is some code
> a second line
> \stoptyping
> 
> \stoptext
> 
> Wolfgang

Okay so first sorry that the example missed the \starttext ... \stoptext. Won't
happen again.

So unfortunately my MWE was too minimal. Actually this works:

\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\setuptyping[before={\startbackground[code]}, after={\stopbackground}]

\starttext
\starttyping
This is some code
a second line
\stoptyping
\stoptext

However, I use pretty printing. When you add [option=XML] to \starttext it
breaks.

Why?

Thank you,
Johann

___
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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Fabrice L
Keith,

> Le 26 nov. 2020 à 12:12, Keith McKay  a écrit :
> Thanks Fabrice and Hans.
> 
> I now see I can simplify some lines of the code:
> 
> pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm); now becomes pp:= a[i];
> 
> and
> 
> pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm); now becomes pp := 
> pp --- a[i +1] ;
> 
> However I still have the problem in the calculation of xcoord and ycoord 
> which are used in the creation of path pp:
>   
>   for squig = 1 step 1 until 15:
> 
>   xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
> 
>   ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
> 
>   pp := pp  .. {curl 100}(xcoord*cm, ycoord*cm);
> 
>   endfor;
> 
> I'm adding a small random amount to the x and ypart of the pair a[i] to 
> produce a path that is like a squiggle (gribouiller in French, according to 
> Google). I have to use cf to convert to the x and yparts to centimeters since 
> they seem to loose the centimeter units on separation. I can't see anyway 
> round this, or am I missing something?
> 
> Thanks
> Keith McKay

First « uniformdeviate(1) - 0.5 » could be modified to « uniformdeviate(0.5)».

To add noise, you can use the randomized function of Metafun. For exemple, you 
can write:

draw pp randomized 1cm ;

Fabrice.



> 
> On 26/11/2020 15:19, Fabrice L wrote:
>> Hi keith,
>> 
>>> Le 26 nov. 2020 à 10:09, Keith McKay >> > a écrit :
>>> 
>>> Hi,
>>> 
>>> I have been using xpart and ypart to extract these values from pairs of 
>>> points in a path but I wasn't getting the correct result. I was expecting:
>>> 
>>> pair (2cm, 11cm) to give xpart 2 and ypart 11
>>> 
>>> However I was getting:
>>> 
>>> pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096
>>> 
>>> After much head scratching and reading the MetaPost and MetaFun manuals, I 
>>> realised that the units of xpart or ypart are in Postcript points or Big 
>>> Points (bp), and 1 bp is 1/72 of an inch, and thus to get the values of 
>>> xpart or ypart in cm I would have to use a correction factor. I had made 
>>> the assumption that since the x and ypart in the pair was in cm that the 
>>> result would be in cm, but I see now that this is not the case. Will I have 
>>> to continue doing this or is there some magic within MetaFun which takes 
>>> account of the units in a pair and outputs the result of x and ypart in the 
>>> same units?
>>> 
>>> The MWE belows shows what I have been doing.
>>> 
>>> Thanks
>>> 
>>> Keith McKay
>>> 
>>> %%% MWE %%%
>>> \setuppapersize [A5, landscape][A4, portrait]
>>> \usecolors[crayola]
>>> \starttext
>>> \startMPpage
>>> StartPage;
>>> width := PaperWidth ; height := PaperHeight ; unit := cm ;
>>> numeric squig;
>>> pair a[]; a0 = (2cm,11cm);  a1 = (4cm,10cm);  a2 = (6cm,9cm);  a3 = 
>>> (8cm,8cm);
>>> show xpart a[0], ypart a[0]; %Example of result from x and ypart before 
>>> applying correction factor (cf) %
>>> cf := 72/2.54; %Converts points/in to points/cm%
>>> path pp;
>>> for i = 0 step 1 until 3:
>>> pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);
>>> for squig = 1 step 1 until 15:
>>> xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
>>> ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
>>> pp := pp  .. {curl 100}(xcoord*cm, ycoord*cm);
>>> endfor;
>>> pp := pp --- cycle;
>>> if i < 3 :
>>> pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);
>>> fi; 
>>> f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to lighten/darken 
>>> colour %
>>> draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
>>> withcolor (f[white,\MPcolor{BurntSienna}]);
>>> endfor;
>>> StopPage;
>>> \stopMPpage
>>> \stoptext
>>> %%
>>> 
>> 
>> MetaPost (MetaFun) is taking care of everything regarding units. As you ave 
>> discovered, everything is translated to a unique internal dimension. So you 
>> can write:
>> 
>>  a := (1cm,2in) ;
>> 
>> with no problem. The « cm » and « in » parts of the expression will become 
>> numbers to translate this number on the right unit. 
>> Fabrice.
>>> ___
>>> 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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Hans Hagen

On 11/26/2020 6:12 PM, Keith McKay wrote:

Thanks Fabrice and Hans.

I now see I can simplify some lines of the code:

pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm); now becomes pp:= a[i];

and

pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm); now becomes 
pp := pp --- a[i +1] ;


However I still have the problem in the calculation of xcoord and ycoord 
which are used in the creation of path pp:


for squig = 1 step 1 until 15:
xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);
endfor;
I'm adding a small random amount to the x and ypart of the pair a[i] to 
produce a path that is like a squiggle (gribouiller in French, according 
to Google). I have to use cf to convert to the x and yparts to 
centimeters since they seem to loose the centimeter units on separation. 
I can't see anyway round this, or am I missing something?



for squig = 1 step 1 until 15:
xcoord := (xpart a[i]/cf);
ycoord := (ypart a[i]/cf);
xcoord := xcoord randomized (xcoord/50);
ycoord := ycoord randomized (ycoord/50);
pp := pp  .. { curl 100 } (xcoord*cm, ycoord*cm);
endfor;



Thanks
Keith McKay

On 26/11/2020 15:19, Fabrice L wrote:

Hi keith,

Le 26 nov. 2020 à 10:09, Keith McKay > a écrit :


Hi,

I have been using xpart and ypart to extract these values from pairs 
of points in a path but I wasn't getting the correct result. I was 
expecting:


pair (2cm, 11cm) to give xpart 2 and ypart 11

However I was getting:

pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096

After much head scratching and reading the MetaPost and MetaFun 
manuals, I realised that the units of xpart or ypart are in Postcript 
points or Big Points (bp), and 1 bp is 1/72 of an inch, and thus to 
get the values of xpart or ypart in cm I would have to use a 
correction factor. I had made the assumption that since the x and 
ypart in the pair was in cm that the result would be in cm, but I see 
now that this is not the case. Will I have to continue doing this or 
is there some magic within MetaFun which takes account of the units 
in a pair and outputs the result of x and ypart in the same units?


The MWE belows shows what I have been doing.

Thanks

Keith McKay

%%% MWE %%%
\setuppapersize [A5, landscape][A4, portrait]
\usecolors[crayola]
\starttext
\startMPpage
StartPage;
width := PaperWidth ; height := PaperHeight ; unit := cm ;
numeric squig;
pair a[]; a0 = (2cm,11cm); a1 = (4cm,10cm); a2 = (6cm,9cm); a3 = 
(8cm,8cm);
show xpart a[0], ypart a[0]; %Example of result from x and ypart 
before applying correction factor (cf) %

cf := 72/2.54; %Converts points/in to points/cm%
path pp;
for i = 0 step 1 until 3:
pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);
for squig = 1 step 1 until 15:
xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);
endfor;
pp := pp --- cycle;
if i < 3 :
pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);
fi;
f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to 
lighten/darken colour %
draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
withcolor (f[white,\MPcolor{BurntSienna}]);

endfor;
StopPage;
\stopMPpage
\stoptext
%%



MetaPost (MetaFun) is taking care of everything regarding units. As 
you ave discovered, everything is translated to a unique internal 
dimension. So you can write:


 a := (1cm,2in) ;

with no problem. The « cm » and « in » parts of the expression will 
become numbers to translate this number on the right unit.

Fabrice.


___ 
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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Keith McKay

Thanks Fabrice and Hans.

I now see I can simplify some lines of the code:

pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm); now becomes pp:= a[i];

and

pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm); now becomes 
pp := pp --- a[i +1] ;


However I still have the problem in the calculation of xcoord and ycoord 
which are used in the creation of path pp:


for squig = 1 step 1 until 15:
xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);
endfor;
I'm adding a small random amount to the x and ypart of the pair a[i] to 
produce a path that is like a squiggle (gribouiller in French, according 
to Google). I have to use cf to convert to the x and yparts to 
centimeters since they seem to loose the centimeter units on separation. 
I can't see anyway round this, or am I missing something?

Thanks
Keith McKay

On 26/11/2020 15:19, Fabrice L wrote:

Hi keith,

Le 26 nov. 2020 à 10:09, Keith McKay > a écrit :


Hi,

I have been using xpart and ypart to extract these values from pairs 
of points in a path but I wasn't getting the correct result. I was 
expecting:


pair (2cm, 11cm) to give xpart 2 and ypart 11

However I was getting:

pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096

After much head scratching and reading the MetaPost and MetaFun 
manuals, I realised that the units of xpart or ypart are in Postcript 
points or Big Points (bp), and 1 bp is 1/72 of an inch, and thus to 
get the values of xpart or ypart in cm I would have to use a 
correction factor. I had made the assumption that since the x and 
ypart in the pair was in cm that the result would be in cm, but I see 
now that this is not the case. Will I have to continue doing this or 
is there some magic within MetaFun which takes account of the units 
in a pair and outputs the result of x and ypart in the same units?


The MWE belows shows what I have been doing.

Thanks

Keith McKay

%%% MWE %%%
\setuppapersize [A5, landscape][A4, portrait]
\usecolors[crayola]
\starttext
\startMPpage
StartPage;
width := PaperWidth ; height := PaperHeight ; unit := cm ;
numeric squig;
pair a[]; a0 = (2cm,11cm); a1 = (4cm,10cm); a2 = (6cm,9cm); a3 = 
(8cm,8cm);
show xpart a[0], ypart a[0]; %Example of result from x and ypart 
before applying correction factor (cf) %

cf := 72/2.54; %Converts points/in to points/cm%
path pp;
for i = 0 step 1 until 3:
pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);
for squig = 1 step 1 until 15:
xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);
endfor;
pp := pp --- cycle;
if i < 3 :
pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);
fi;
f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to 
lighten/darken colour %
draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
withcolor (f[white,\MPcolor{BurntSienna}]);

endfor;
StopPage;
\stopMPpage
\stoptext
%%



MetaPost (MetaFun) is taking care of everything regarding units. As 
you ave discovered, everything is translated to a unique internal 
dimension. So you can write:


 a := (1cm,2in) ;

with no problem. The « cm » and « in » parts of the expression will 
become numbers to translate this number on the right unit.

Fabrice.


___ 
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] new upload

2020-11-26 Thread Hans Hagen

On 11/26/2020 6:07 PM, luigi scarso wrote:



Il Gio 26 Nov 2020, 18:00 Hans Hagen > ha scritto:


On 11/26/2020 5:10 PM, luigi scarso wrote:
 >
 >
 > On Thu, Nov 26, 2020 at 5:00 PM Hans Hagen mailto:j.ha...@xs4all.nl>
 > >> wrote:
 >
 >       Of course, if they care about luatex cs support they
 >     could send an M1 mini to Mojca for the compile farm for some real
 >     testing.
 >
 >
 > very likely luatex will run full native on M1 on next texlive,
following
 > http://www.tug.org/mactex/aboutarm.html

 > >
that's with universal binaries (as happened before when apple switched
from powerpc to intel)


Full native:
"""
Full native Arm support will arrive with MacTeX-2021 next spring.
"""


sure, but by using a unversal bin:

from 2021 on they will contain both Intel and Arm code packaged together 
as a universal binary. Thus MacTeX will support Intel and Arm machines 
on an equal footing for many years to come.



-
  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] new upload

2020-11-26 Thread luigi scarso
Il Gio 26 Nov 2020, 18:00 Hans Hagen  ha scritto:

> On 11/26/2020 5:10 PM, luigi scarso wrote:
> >
> >
> > On Thu, Nov 26, 2020 at 5:00 PM Hans Hagen  > > wrote:
> >
> >   Of course, if they care about luatex cs support they
> > could send an M1 mini to Mojca for the compile farm for some real
> > testing.
> >
> >
> > very likely luatex will run full native on M1 on next texlive, following
> > http://www.tug.org/mactex/aboutarm.html
> > 
> that's with universal binaries (as happened before when apple switched
> from powerpc to intel)


Full native:
"""
Full native Arm support will arrive with MacTeX-2021 next spring.
"""

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


Re: [NTG-context] new upload

2020-11-26 Thread Hans Hagen

On 11/26/2020 5:10 PM, luigi scarso wrote:



On Thu, Nov 26, 2020 at 5:00 PM Hans Hagen > wrote:


  Of course, if they care about luatex cs support they
could send an M1 mini to Mojca for the compile farm for some real
testing.


very likely luatex will run full native on M1 on next texlive, following
http://www.tug.org/mactex/aboutarm.html 

that's with universal binaries (as happened before when apple switched 
from powerpc to intel)


i suppose the buildnot can generate small arm M1 only bins

Hans

-
  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] Vertical space when surrounding with textbackground

2020-11-26 Thread Wolfgang Schuster

Johann Birnick schrieb am 26.11.2020 um 17:00:

On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:

On Thu, 26 Nov 2020, Johann Birnick wrote:


How to surround such things properly? I just want a background to these and
a
sidebar. No addition spacing / empty lines.


A MWE will help...

Aditya


For example, take:

\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\starttextbackground[code]
\starttyping
This is some code
a second line
\stoptyping
\stoptextbackground


You missed the W (working) in MWE.

\definetextbackground
  [Code]
  [  frame=off,
background=color,
   backgroundcolor=lightgray,
  location=paragraph]

\setuptyping
  [before={\blank\starttextbackground[Code]},
after={\stoptextbackground\blank}]

\starttext

\starttyping
This is some code
a second line
\stoptyping

\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] Vertical space when surrounding with textbackground

2020-11-26 Thread Aditya Mahajan
On Thu, 26 Nov 2020, Johann Birnick wrote:

> On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:
> > On Thu, 26 Nov 2020, Johann Birnick wrote:
> > 
> > > How to surround such things properly? I just want a background to these 
> > > and
> > > a
> > > sidebar. No addition spacing / empty lines.
> > 
> > A MWE will help...
> > 
> > Aditya
> 
> For example, take:
> 
> \definetextbackground[code][background=color, backgroundcolor=lightgray,
> frame=off, location=paragraph]
> 
> \starttextbackground[code]
> \starttyping
> This is some code
> a second line
> \stoptyping
> \stoptextbackground


\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\setuptyping[before={\startbackground[code]}, after={\stopbackground}]

\starttext
\starttyping
This is some code
a second line
\stoptyping
\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] question about frames

2020-11-26 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 25.11.2020 um 22:43:

Dear list,

here is a minimal sample of frames to make up labels:

   \setuplayout[page]
   \starttext
   \dorecurse{16}{\dontleavehmode\dorecurse{4}
   {\framed[width=52.5mm, height=18.5mm, align=right]{\null}}\\}
   \stoptext

Which is the way to avoid any vertical space between frames?


Variant 1:

\setuplayout
  [page]
  [backspace=5mm,
   topspace=10mm]

\setuplayout
  [page]

\starttext

\dorecurse{14}
  {\dontleavehmode
   \dorecurse{4}
 {\framed[width=5cm,height=2cm]{}}%
   \par
   \offinterlineskip}

\stoptext

Variant 2:

\definepapersize
  [etikett]
  [width=5cm,
   height=2cm]

\setuppapersize
  [etikett] [A4]

\setuplayout
  [page]

\setuppaper
  [nx=4,
   ny=14]

\setuppaper
  [dx=1sp,
   dy=1sp,
   backspace=5mm,
   topspace=10mm]

\setuparranging
  [XY]

\setuplayout
  [location=middle]

\starttext

\dorecurse{56}
  {\framed[width=max,height=max]{}}

\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] new upload

2020-11-26 Thread luigi scarso
On Thu, Nov 26, 2020 at 5:00 PM Hans Hagen  wrote:

>  Of course, if they care about luatex cs support they
> could send an M1 mini to Mojca for the compile farm for some real testing.
>

very likely luatex will run full native on M1 on next texlive, following
http://www.tug.org/mactex/aboutarm.html

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


Re: [NTG-context] Vertical space when surrounding with textbackground

2020-11-26 Thread Johann Birnick
On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:
> On Thu, 26 Nov 2020, Johann Birnick wrote:
> 
> > How to surround such things properly? I just want a background to these and
> > a
> > sidebar. No addition spacing / empty lines.
> 
> A MWE will help...
> 
> Aditya

For example, take:

\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\starttextbackground[code]
\starttyping
This is some code
a second line
\stoptyping
\stoptextbackground

Johann

___
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] new upload

2020-11-26 Thread Hans Hagen

On 11/26/2020 4:26 PM, Keith McKay wrote:

Hi,

I'm planning in the next few weeks to retire my 2012 16GB Mac mini which 
has served me well with ConTeXt (and other software) over these past few 
years. I was planning on getting the new entry level MAC min M1 with 8GB 
unified memory but I see that there will be no ConTeXt binaries for 
these new M1 chip Macs. Would it be possible for a ConTeXt user like 
myself to build the binaries on my proposed new Mac? I'm not a computer 
professional.
At some point yes  (because once stable the code will be in the 
distribition) but even then you probably need to mess with compilers


https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary

Maybe Mojca has to configure the build to either generate arm bins (in 
addition) or universal apple bins (of course these are larger).


We actually discussed it before but apple has been kind of secretive 
about all this. Of course, if they care about luatex cs support they 
could send an M1 mini to Mojca for the compile farm for some real testing.


Btw, aren't intel bins supposed to run on the M1 in some emulation mode?

Hans

-
  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] question about frames

2020-11-26 Thread Pablo Rodriguez
On 11/26/20 9:42 AM, Henning Hraban Ramm wrote:
>> Am 25.11.2020 um 22:43 schrieb Pablo Rodriguez:
>> [...]
>> Which is the way to avoid any vertical space between frames?
>>
>> Sorry, this may be obvious, but I don’t know how to do it now.
>
> try offset=overlay
> don’t know if that goes all the way.

Many thanks for your reply, Hraban.

I’m afraid that offset is related to the space between frame and its
content.

Or at least, I couldn’t make it work.

> How about \blank[none,back,disable]?

Nope. But this contains the key to the solution.

\blank[-0.395mm] corrects the extra vertical space between frames in
this case.

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
___


Re: [NTG-context] new upload

2020-11-26 Thread Keith McKay

Hi,

I'm planning in the next few weeks to retire my 2012 16GB Mac mini which 
has served me well with ConTeXt (and other software) over these past few 
years. I was planning on getting the new entry level MAC min M1 with 8GB 
unified memory but I see that there will be no ConTeXt binaries for 
these new M1 chip Macs. Would it be possible for a ConTeXt user like 
myself to build the binaries on my proposed new Mac? I'm not a computer 
professional.


Best Wishes

Keith McKay

On 24/11/2020 19:07, Hans Hagen wrote:

Hi,

A new upload. Mojca upgraded the build manager and we also updated 
some machines so all binaries (platforms) should be in sync now. (No 
binaries for apples M1 and microsofts SQ2 as we don't have these 
machines, so just good old intel and arm it is.)


On my rusty laptop the luametatex manual takes between 10 and 10.5 sec 
(depending on load). On the raspberry pi 64 bit it takes 32.5 sec 
(ubuntu, ssd on usb 3). The Windows Linux Subsystem (version 1) takes 
some 11.5 seconds and the domotica fitlet with a low power AMD A10 
needs 27.5 sec.) The ratios match measurements of a while ago. In the 
meantime the format file got smaller, memory more dynamic and the mem 
footprint also smaller. I expect a modern intel laptop cpu to need 
some 5 seconds and a decent desktop less but who knows. It's not easy 
to squeeze out more (the bottleneck is in the lua code as the 
(con)tex(t) code is pretty efficient so we pay a price for flexibility).


(In the process I saw that I bugged the xetex logo but that has to 
wait for a next upload. Hardly critital I suspect.)


Hans



-
  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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Hans Hagen

On 11/26/2020 4:09 PM, Keith McKay wrote:

Hi,

I have been using xpart and ypart to extract these values from pairs of 
points in a path but I wasn't getting the correct result. I was expecting:


pair (2cm, 11cm) to give xpart 2 and ypart 11

However I was getting:

pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096

After much head scratching and reading the MetaPost and MetaFun manuals, 
I realised that the units of xpart or ypart are in Postcript points or 
Big Points (bp), and 1 bp is 1/72 of an inch, and thus to get the values 
of xpart or ypart in cm I would have to use a correction factor. I had 
made the assumption that since the x and ypart in the pair was in cm 
that the result would be in cm, but I see now that this is not the case. 
Will I have to continue doing this or is there some magic within MetaFun 
which takes account of the units in a pair and outputs the result of x 
and ypart in the same units?


The MWE belows shows what I have been doing.


cm is not really a unit but a multiplier

cf := 72/2.54; %Converts points/in to points/cm%

message(cm);
message(cf);




Thanks

Keith McKay

%%% MWE %%%

\setuppapersize [A5, landscape][A4, portrait]

\usecolors[crayola]

\starttext

\startMPpage

StartPage;

width := PaperWidth ; height := PaperHeight ; unit := cm ;

numeric squig;

pair a[]; a0 = (2cm,11cm); a1 = (4cm,10cm); a2 = (6cm,9cm); a3 = (8cm,8cm);

show xpart a[0], ypart a[0]; %Example of result from x and ypart before 
applying correction factor (cf) %


cf := 72/2.54; %Converts points/in to points/cm%

path pp;

for i = 0 step 1 until 3:

pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);

for squig = 1 step 1 until 15:

xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);

ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);

pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);

endfor;

pp := pp --- cycle;

if i < 3 :

pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);

fi;

f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to lighten/darken 
colour %


draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
withcolor (f[white,\MPcolor{BurntSienna}]);


endfor;

StopPage;

\stopMPpage

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




--

-
  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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Fabrice L
Hi keith,

> Le 26 nov. 2020 à 10:09, Keith McKay  a écrit :
> 
> Hi,
> 
> I have been using xpart and ypart to extract these values from pairs of 
> points in a path but I wasn't getting the correct result. I was expecting:
> 
> pair (2cm, 11cm) to give xpart 2 and ypart 11
> 
> However I was getting:
> 
> pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096
> 
> After much head scratching and reading the MetaPost and MetaFun manuals, I 
> realised that the units of xpart or ypart are in Postcript points or Big 
> Points (bp), and 1 bp is 1/72 of an inch, and thus to get the values of xpart 
> or ypart in cm I would have to use a correction factor. I had made the 
> assumption that since the x and ypart in the pair was in cm that the result 
> would be in cm, but I see now that this is not the case. Will I have to 
> continue doing this or is there some magic within MetaFun which takes account 
> of the units in a pair and outputs the result of x and ypart in the same 
> units?
> 
> The MWE belows shows what I have been doing.
> 
> Thanks
> 
> Keith McKay
> 
> %%% MWE %%%
> \setuppapersize [A5, landscape][A4, portrait]
> \usecolors[crayola]
> \starttext
> \startMPpage
> StartPage;
> width := PaperWidth ; height := PaperHeight ; unit := cm ;
> numeric squig;
> pair a[]; a0 = (2cm,11cm);  a1 = (4cm,10cm);  a2 = (6cm,9cm);  a3 = (8cm,8cm);
> show xpart a[0], ypart a[0]; %Example of result from x and ypart before 
> applying correction factor (cf) %
> cf := 72/2.54; %Converts points/in to points/cm%
> path pp;
> for i = 0 step 1 until 3:
>   pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);
>   for squig = 1 step 1 until 15:
>   xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
>   ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
>   pp := pp  .. {curl 100}(xcoord*cm, ycoord*cm);
>   endfor;
>   pp := pp --- cycle;
>   if i < 3 :
>   pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);
>   fi; 
>   f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to lighten/darken 
> colour %
>   draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
> withcolor (f[white,\MPcolor{BurntSienna}]);
> endfor;
> StopPage;
> \stopMPpage
> \stoptext
> %%
> 

MetaPost (MetaFun) is taking care of everything regarding units. As you ave 
discovered, everything is translated to a unique internal dimension. So you can 
write:

 a := (1cm,2in) ;

with no problem. The « cm » and « in » parts of the expression will become 
numbers to translate this number on the right unit. 
Fabrice.
> ___
> 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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Keith McKay

Hi,

I have been using xpart and ypart to extract these values from pairs of 
points in a path but I wasn't getting the correct result. I was expecting:


pair (2cm, 11cm) to give xpart 2 and ypart 11

However I was getting:

pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096

After much head scratching and reading the MetaPost and MetaFun manuals, 
I realised that the units of xpart or ypart are in Postcript points or 
Big Points (bp), and 1 bp is 1/72 of an inch, and thus to get the values 
of xpart or ypart in cm I would have to use a correction factor. I had 
made the assumption that since the x and ypart in the pair was in cm 
that the result would be in cm, but I see now that this is not the case. 
Will I have to continue doing this or is there some magic within MetaFun 
which takes account of the units in a pair and outputs the result of x 
and ypart in the same units?


The MWE belows shows what I have been doing.

Thanks

Keith McKay

%%% MWE %%%

\setuppapersize [A5, landscape][A4, portrait]

\usecolors[crayola]

\starttext

\startMPpage

StartPage;

width := PaperWidth ; height := PaperHeight ; unit := cm ;

numeric squig;

pair a[]; a0 = (2cm,11cm); a1 = (4cm,10cm); a2 = (6cm,9cm); a3 = (8cm,8cm);

show xpart a[0], ypart a[0]; %Example of result from x and ypart before 
applying correction factor (cf) %


cf := 72/2.54; %Converts points/in to points/cm%

path pp;

for i = 0 step 1 until 3:

pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);

for squig = 1 step 1 until 15:

xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);

ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);

pp := pp .. {curl 100}(xcoord*cm, ycoord*cm);

endfor;

pp := pp --- cycle;

if i < 3 :

pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);

fi;

f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to lighten/darken 
colour %


draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
withcolor (f[white,\MPcolor{BurntSienna}]);


endfor;

StopPage;

\stopMPpage

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


Re: [NTG-context] Vertical space when surrounding with textbackground

2020-11-26 Thread Aditya Mahajan
On Thu, 26 Nov 2020, Johann Birnick wrote:

> How to surround such things properly? I just want a background to these and a
> sidebar. No addition spacing / empty lines.

A MWE will help...

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] mathmatrix and internal lines

2020-11-26 Thread Otared Kavian
Hi Jean-Philippe,

The following is better than the one I sent earlier:

\definemathmatrix[mymatrix]
[left={\left(\,},
right={\ \right)}]

\starttext
\startformula
\startmymatrix
\NC A \NC\hskip-.5em \vrule  \NC\hskip-.5em B \NR
\noalign{\hrule}
\NC C \NC \hskip-.5em\vrule \NC \hskip-.5em D \NR
\stopmymatrix
\stopformula
\stoptext

Best regards: Otared K.

> On 26 Nov 2020, at 10:19, Jean-Philippe Rey 
>  wrote:
> 
> Dear list,
> 
> I would like to draw matrices with internal lines as can be done with LaTeX 
> (cf pdf output) :
> 
> 
> \documentclass{article}
> \begin{document}
> $M =\left( \begin{array}{c|c}
> A & B \\
> \hline
> C & D \\
> \end{array} \right)$
> \end{document}
> 
> 
> I didn't find out how to use mathmatrix to achieve this. My best result to 
> date is 
> 
> 
> \starttext
> $M = \left( \bTABLE[frame=off]
> \bTR
>   \bTD[rightframe=on, bottomframe=on] $A$ \eTD
>   \bTD[bottomframe=on] $B$ \eTD
> \eTR\bTR
>   \bTD[rightframe=on] $C$ \eTD
>   \bTD $D$ \eTD
> \eTR
> \eTABLE \right)$
> \stoptext
> 
> 
> The code is rather ugly, and I get a spurious space at the bottom of the 
> table.
> 
> Any hints?
> 
> Thank you,
> 
> -- 
> Jean-Philippe Rey
> jean-philippe@centralesupelec.fr
> 91192 Gif-sur-Yvette Cedex - France
> Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
> ___
> 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] Vertical space when surrounding with textbackground

2020-11-26 Thread Johann Birnick
Hi there,

in my document(s) I have enumerations (created with \defineenumeration) and
"typing"s (created with \definetyping) and I need to give a specific layout to
them. In particular, I want to add textbackground (created with
\definetextbackground) and sometimes a sidebar (created with \definesidebar) to
them.

However, when I surround for example my typing with a textbackground like this

\starttextbackground[code]
\startCpp
...
\stopCpp
\stoptextbackground

or by putting the textbackground commands in "before=" and "after=" of my
typing, then there will be an additional empty line at the end of the typing.

Same with the enumerations and when I surround it with a sidebar instead of a
textbackground. Often there is even an additional line / additional space before
the typing/enumeration.

How to surround such things properly? I just want a background to these and a
sidebar. No addition spacing / empty lines.

I would greatly appreciate your help.

Thank you,
Johann

___
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] Strange bug with obayspaces and tagging

2020-11-26 Thread Hans Hagen

On 11/26/2020 10:47 AM, Christoph Reller wrote:

Hi,

With the currently latest version of ConTeXt LMTX 2020.11.25 21:42, this 
MNWE fails with the following error message:




\setuptagging[state=start]
\starttext
\obeyspaces\obeylines
   patch
\stoptext



tex error       > tex error on line 4 in file ./scratch1.tex: Valid 
keyword expected, likely 'plus'


   pa
     tch

1     \setuptagging[state=start]
2     \starttext
3     \obeyspaces\obeylines
4 >>    patch
5     \stoptext



This may be a bug in the tagging feature.

i'll fix it

-
  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] mathmatrix and internal lines

2020-11-26 Thread Otared Kavian
Hi Jean-Philippe,

For a simple case like the one you sent, a rather not optimal solution can be 
this:

\definemathmatrix[mymatrix]
[left={\left(\,},
right={\ \right)}]

\starttext
\startformula
\startmymatrix
\NC A \hskip .5em |\hskip-.5em  \NC B \NR
\noalign{\hrule}
\NC C \hskip .5em |\hskip-.5em \NC D \NR
\stopmymatrix
\stopformula
\stoptext

However I think I have seen sometime ago a more elegant solution, but I could 
not find it right now…

Best regards: Otared K.

> On 26 Nov 2020, at 10:19, Jean-Philippe Rey 
>  wrote:
> 
> Dear list,
> 
> I would like to draw matrices with internal lines as can be done with LaTeX 
> (cf pdf output) :
> 
> 
> \documentclass{article}
> \begin{document}
> $M =\left( \begin{array}{c|c}
> A & B \\
> \hline
> C & D \\
> \end{array} \right)$
> \end{document}
> 
> 
> I didn't find out how to use mathmatrix to achieve this. My best result to 
> date is 
> 
> 
> \starttext
> $M = \left( \bTABLE[frame=off]
> \bTR
>   \bTD[rightframe=on, bottomframe=on] $A$ \eTD
>   \bTD[bottomframe=on] $B$ \eTD
> \eTR\bTR
>   \bTD[rightframe=on] $C$ \eTD
>   \bTD $D$ \eTD
> \eTR
> \eTABLE \right)$
> \stoptext
> 
> 
> The code is rather ugly, and I get a spurious space at the bottom of the 
> table.
> 
> Any hints?
> 
> Thank you,
> 
> -- 
> Jean-Philippe Rey
> jean-philippe@centralesupelec.fr
> 91192 Gif-sur-Yvette Cedex - France
> Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
> ___
> 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] Strange bug with obayspaces and tagging

2020-11-26 Thread Christoph Reller
Hi,

With the currently latest version of ConTeXt LMTX 2020.11.25 21:42, this
MNWE fails with the following error message:



\setuptagging[state=start]
\starttext
\obeyspaces\obeylines
  patch
\stoptext



tex error   > tex error on line 4 in file ./scratch1.tex: Valid keyword
expected, likely 'plus'

   pa
tch

1 \setuptagging[state=start]
2 \starttext
3 \obeyspaces\obeylines
4 >>patch
5 \stoptext



This may be a bug in the tagging feature.

Cheers,

Christoph
___
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] mathmatrix and internal lines

2020-11-26 Thread Jean-Philippe Rey
Dear list,

I would like to draw matrices with internal lines as can be done with LaTeX (cf 
pdf output) :


\documentclass{article}
\begin{document}
$M =\left( \begin{array}{c|c}
A & B \\
\hline
C & D \\
\end{array} \right)$
\end{document}


I didn't find out how to use mathmatrix to achieve this. My best result to date 
is 


\starttext
$M = \left( \bTABLE[frame=off]
\bTR
\bTD[rightframe=on, bottomframe=on] $A$ \eTD
\bTD[bottomframe=on] $B$ \eTD
\eTR\bTR
\bTD[rightframe=on] $C$ \eTD
\bTD $D$ \eTD
\eTR
\eTABLE \right)$
\stoptext


The code is rather ugly, and I get a spurious space at the bottom of the table.

Any hints?

Thank you,

-- 
Jean-Philippe Rey
jean-philippe@centralesupelec.fr
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51


blocmatrices-latex.pdf
Description: Adobe PDF document


blocmatrices-context.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] question about frames

2020-11-26 Thread Henning Hraban Ramm


> Am 25.11.2020 um 22:43 schrieb Pablo Rodriguez :
> 
> Dear list,
> 
> here is a minimal sample of frames to make up labels:
> 
>  \setuplayout[page]
>  \starttext
>  \dorecurse{16}{\dontleavehmode\dorecurse{4}
>  {\framed[width=52.5mm, height=18.5mm, align=right]{\null}}\\}
>  \stoptext
> 
> Which is the way to avoid any vertical space between frames?
> 
> Sorry, this may be obvious, but I don’t know how to do it now.

try offset=overlay
don’t know if that goes all the way.
How about \blank[none,back,disable]?

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] Setting and measuring boxes TeX/Lua

2020-11-26 Thread Hans Hagen

On 11/25/2020 10:28 PM, Jano Kula wrote:

Hello Hans!

On Wed, 25 Nov 2020 at 21:25, Hans Hagen > wrote:


\startluacode
context.stepwise (function()
      context.step()
end)
\stopluacode


Thank you very much!

I was trying context.stepwise several times (and \dowithnextbox, 
\nextboxht and other things). I bet there was no example of empty 
context.step().


The usage was: stepping in TeX end with 
context.step("\\texcommands\\with\\doubleslashes") without leaving Lua.

What is the purpose of empty context.step()? Knocking on TeX's door?

no, kind of quit, goto tex and then pickup again (coroutine magic)

(this mechanism is already kind of old, there are also other cheats 
possible)


Hans

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