[NTG-context] Re: digital signing in ConTeXt

2024-06-17 Thread Hans Hagen via ntg-context

On 6/17/2024 7:51 PM, Pablo Rodriguez via ntg-context wrote:

Dear list,

the latest version of LMTX can digitally sign PDF documents. It requires
OpenSSL installed (since it does the crypto part).

I have two issues that I would like to be tested by others.

A sample certificate may be found at
https://mailman.ntg.nl/archives/list/ntg-context@ntg.nl/message/ECSXLVMT3TMQBIHA2UZJPWJN7OVV5334/attachment/2/mycert.pfx
(I sent it myself).

Here is a sample document (actually provided by Hans):

   \setupinteraction[state=start]
   \definefield[signature][signed]
   \defineoverlay[signature][my signature]
   \starttext
 \startTEXpage[offset=1ts,frame=on,framecolor=darkblue]
   sign: \inframed[background=signature,framecolor=darkred]
   {\fieldbody[signature][width=3cm,option=hidden]}
 \stopTEXpage
   \stoptext

After compiling the sample, you need to run:

mtxrun --script pdf --sign --certificate=c.pfx --password=ABCabc doc.pdf


i use a pem


Password will be prompted again ("ABCabc"), since it is an encrypted
certificate (also for the public part).

Could anyone confirm the following issues?

1. The signature I get is wrong, unless I apply this patch
(https://mailman.ntg.nl/archives/list/dev-cont...@ntg.nl/message/T3OCKVZWTUTIXCSOKIFRVJ4X76MROZHE/attachment/3/byterange.diff
[sent by myself to the devel list]).

2. I cannot get any signature display in Acrobat. Does any PDF viewer (I
have tested this with pdfsig from poppler and MuPDF-GL) display the
digital signature at all?

this whole digitial signing is a bit of a scam imo ...

- one has to buy a specific kind of certificate
- often one is supposed to use some token
- when the root cert expires one has to resign
- reader has root certs built in and checking is supposed to be online
- it doesn't come cheap and supporting / testing is not something one 
can expect for free (so i can't really test it)


... so just some business model and not really something one can do out 
of the box


... apart from ...

- just sign with some certificate and don't expect viewers to do something
- offer a service to upload the document for checking when a user is in 
doubt
- that can be done without root cert and basically works as long as the 
service works


concerning the suggested patches: this <whatever> boundary is a 
bit fuzzy and i found that different viewers / checkers expect either or 
not +/- 1 but i didn't check recently if things have improved


if we know the specs and  have way to test ... no big deal to fix a few 
offsets


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] digital signing in ConTeXt

2024-06-17 Thread Pablo Rodriguez via ntg-context
Dear list,

the latest version of LMTX can digitally sign PDF documents. It requires
OpenSSL installed (since it does the crypto part).

I have two issues that I would like to be tested by others.

A sample certificate may be found at
https://mailman.ntg.nl/archives/list/ntg-context@ntg.nl/message/ECSXLVMT3TMQBIHA2UZJPWJN7OVV5334/attachment/2/mycert.pfx
(I sent it myself).

Here is a sample document (actually provided by Hans):

  \setupinteraction[state=start]
  \definefield[signature][signed]
  \defineoverlay[signature][my signature]
  \starttext
\startTEXpage[offset=1ts,frame=on,framecolor=darkblue]
  sign: \inframed[background=signature,framecolor=darkred]
  {\fieldbody[signature][width=3cm,option=hidden]}
\stopTEXpage
  \stoptext

After compiling the sample, you need to run:

mtxrun --script pdf --sign --certificate=c.pfx --password=ABCabc doc.pdf

Password will be prompted again ("ABCabc"), since it is an encrypted
certificate (also for the public part).

Could anyone confirm the following issues?

1. The signature I get is wrong, unless I apply this patch
(https://mailman.ntg.nl/archives/list/dev-cont...@ntg.nl/message/T3OCKVZWTUTIXCSOKIFRVJ4X76MROZHE/attachment/3/byterange.diff
[sent by myself to the devel list]).

2. I cannot get any signature display in Acrobat. Does any PDF viewer (I
have tested this with pdfsig from poppler and MuPDF-GL) display the
digital signature at all?

Many thanks for your help,

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Pocket Diary Photo Calendar: how to specify on which day the week begins?

2024-06-15 Thread Michael Guravage
Bruce,

Yes, I remember encountering this problem. The two files you need are:
sun-MP.tex and moons-MP.tex. I don't recall where I found them so I've
attached them below. Drop them into their respective pocketdiary
directories Solar and Moonphase and run mtxrun --generate.

Your suggestion of the Day key was the first thing I tried myself.
Unfortunately, it has no effect.

Thanks for thinking along.

With kind regards,

Michael



On Sat, Jun 15, 2024 at 10:51 PM Bruce Horrocks  wrote:

>
>
> > On 15 Jun 2024, at 17:55, Michael Guravage <
> gurav...@literatesolutions.com> wrote:
> >
> > Hi,
> >
> > I am trying to use the Pocket Diary module to create a photo calendar as
> described in the Calendar Examples. The examples work fine. By default
> weeks begin on Monday. Does anyone know how to specify that weeks begin on
> Sunday? I have searched through all the setvariable assignments, but
> nothing seems applicable.
> >
> > I have attached an example file so you needn't retrieve all the
> examples. Any help would be appreciated.
>
> Your example didn't work for me - I didn't have PocketDiary installed and
> then after installing it I got an error about Moons.tex. Life's too short
> to faff trying to fix it so this suggestion is untested.
>
> The variables setting allows a Day= value so try experimenting with
>
> \setvariables
>   [PocketDiary]
>   [Year=2025,
>Day=7]
>
> as the default value is 1 which I assume is Monday.
>
> —
> 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 /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>
% Metafun
% filename: moons.tex
% Boede 2021

% \setupbodyfont[plex,ss,14pt]

\defineMPinstance
	[Moon]
	[metafun]
  []
	
\startMPinclusions[]{Moon}
	numeric w,h;
	path p[];
	pair ip[];
	
	w = OverlayWidth;
	h = OverlayHeight;
	
	p[1] := fullcircle scaled h;
	p[2] := p[1] shifted (0.2 w,0);
	
	ip[1] := p[1] intersectionpoint p[2];
	ip[2] := reverse p[1] intersectionpoint p[2];

	p[3] := p[1] cutbefore ip[1] cutafter ip[2];	
	p[4] := p[2] cutbefore ip[1] cutafter ip[2];
	
  drawoptions (withpen pencircle scaled 2pt);
	
\stopMPinclusions

\startuniqueMPgraphic{Moon::Waning_moon}
  draw  p[3] ;
	draw  p[4] ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{Moon::Growing_moon}
  draw  p[3] ;
	draw  p[4] ;
	currentpicture := (currentpicture reflectedabout (ip[1],ip[2]));
\stopuniqueMPgraphic

\startuniqueMPgraphic{Moon::Fullmoon}
	draw p[1];
\stopuniqueMPgraphic

\startuniqueMPgraphic{Moon::Newmoon}
	fill p[1] withcolor 0.625 white;
	draw p[1];
\stopuniqueMPgraphic


\defineoverlay[waningmoon][\useMPgraphic{Moon::Waning_moon}]
\defineoverlay[growingmoon][\useMPgraphic{Moon::Growing_moon}]
\defineoverlay[newmoon][\useMPgraphic{Moon::Newmoon}]
\defineoverlay[fullmoon][\useMPgraphic{Moon::Fullmoon}]

\defineframed
	[Moon]
	[height=\bodyfontsize,
	 width=\bodyfontsize,
 	 frame=off]


% \starttext
% Results with \type{framed}
%
% \blank
%
%  Heute ist abnehmender Mond	{\Moon[background=waningmoon]{\strut}}
%
%  Heute ist Vollmond \Moon[background=fullmoon]{}
%
%  Heute haben wir Neumond \Moon[background=newmoon]{}
%
%  Und heute haben wir zunehmenden Mond \Moon[background=growingmoon]{}
%
% \stoptext% Metafun
% filename: moons.tex
% Boede 2021

% \setupbodyfont[plex,ss,14pt]

\defineMPinstance
	[Sun]
	[metafun]
  []
	
\startMPinclusions[]{Sun}
	numeric w,h;
	path p[];
	pair ip[];
	
	w = OverlayWidth;
	h = OverlayHeight;
	
	p[1]  := fullcircle scaled h;
	p[100] := tcircle scaled 0.5h; %h
	p[2] := tcircle scaled 0.6h;  %1.2h;
	p[3] := tcircle scaled 0.75h; %1.6h;
	p[4] := tcircle scaled h; %2h;
	p[5] := (0,0)--point 1 of p[4] ;
	p[6] := p[5] cutbefore point .3 of p[5];
	p[7] := p[6] rotatedaround (center p[1],18);
	 
  ip[1] :=  p[2] intersectionpoint p[7];
  ip[2] :=  p[3] intersectionpoint p[7];
	
  p[10] := ip[1]--ip[2];

	ip[3] :=  ip[1];
	ip[4] :=  point 1 of p[7];

	p[11] := ip[3]--ip[4];
	
  drawoptions (withpen pencircle scaled 0.25pt withcolor red);
	
\stopMPinclusions

\startreusableMPgraphic{Sun::Sunrise}
  drawoptions (withpen pencircle scaled 0.25pt withcolor red);
  draw p[100];
	for i = 36 step 36 until 154  :
	  draw p[10] rotatedaround (center p[1],i-18);
	endfor;
	for i = 18 step 36 until 180  :
	  draw p[11] rotatedaround (center p[1],i-18);
 endfor;
 drawarrow ((0,0)--(0,h)) shifted (0,-0.05h);
\stopreusableMPgraphic

\startreusableMPgraphic{Sun:

[NTG-context] background= key not working in \startbackground and \starttextbackground

2024-06-06 Thread Aditya Mahajan
Hi,

I am testing some of my old styles on latest context and find that the 
background key of \startbackground and \starttextbackground doesn't work 
(\framed is working as expected). Here is a MWE:

\startuseMPgraphic{background:test}
fill OverlayBox withcolor 0.75[red,white];
draw OverlayBox withcolor red withpen pencircle scaled 2bp;
\stopuseMPgraphic

\defineoverlay[background:test][\useMPgraphic{background:test}]

\definetextbackground
[testA]
[ 
location=paragraph,
background=background:test,
frame=off,
]

\definebackground
[testB]
[ 
location=paragraph,
background=background:test,
frame=off,
]

\defineframedtext
[testC]
[ 
background=background:test,
frame=off,
width=broad,
]

\starttext
\starttestA
  \input tufte
\stoptestA

\starttestB
  \input tufte
\stoptestB

\starttestC
  \input tufte
\stoptestC
\stoptext

testA gives nothing, testB gives a gray(!) background, and testC works as 
expected.

The output is attached. I am using 2024.05.31.

Aditya

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] issue with signing

2024-06-03 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following sample

  \setupinteraction[state=start]
  \definefield[signature][signed]
  \defineoverlay[signature][my signature]
  \starttext
\startTEXpage[offset=1ts,frame=on,framecolor=darkblue]
  sign: \inframed[background=signature,framecolor=darkred]
  {\fieldbody[signature][width=3cm,option=hidden]}
\stopTEXpage
  \stoptext

After compiling, I sign it with the following command (in latest from
2024.05.31 18:50):

 mtxrun --script pdf --sign --certificate=mycert.pfx --password=ABCabc a

It requires the pass phrase (again?) and I get a signed PDF document.

But Acrobat cannot find (or display) any signature in that PDF document.

pdfsig (from poppler-utils-24.02.0) complains about digest mismatch:

  $ pdfsig a.pdf
  Digital Signature Info of: a.pdf
  Signature #1:
- Signature Field Name: signature
- Signer Certificate Common Name: John Doe
- Signer full Distinguished Name: CN=John Doe,O=No Brainer
- Signing Time: Jun 03 2024 16:24:03
- Signing Hash Algorithm: SHA-256
- Signature Type: adbe.pkcs7.detached
- Signed Ranges: [0 - 6428], [10527 - 10912]
- Not total document signed
- Signature Validation: Digest Mismatch.

mutool sign (from mupdf-1.24.1) also complains about modified document
after signing:

  $ mutool sign -v a.pdf
  Verifying signature 3:
Distinguished name: cn=John Doe, o=No Brainer, ou=, email=, c=XX
Certificate error: Self-signed certificate.
Digest error: Signature invalidated by change to document.

Sorry, but what am I doing wrong here?

Many thanks for your help,

Pablo

mycert.pfx
Description: application/pkcs12
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Number in a circle

2024-05-28 Thread Kip Warner
On Tue, 2024-05-28 at 15:02 -0700, Kip Warner wrote:
> On Tue, 2024-05-28 at 17:38 +0200, Wolfgang Schuster wrote:
> > Add
> > 
> >  framecolor=colour_text,
> > 
> > to the frame settings.
> 
> Thanks Wolfgang. That does work.
> 
> But another problem I've found is the font and circle are not
> automatically resized when used in a formula:
> 
>    \definecolor[colour_text][r=0.754,g=0.516,b=0.324] % RGB 0xc08453
>    
>    \setupcolors[
>    state=start,
>    textcolor=colour_text,
>    pagecolormodel=rgb] % gray rgb cmyk auto none
>    
>    % Commands for MetaPost interpreter to draw a circle...
>    \startuseMPgraphic{textcircle}
>     draw fullcircle
>     xscaled OverlayWidth
>     yscaled OverlayWidth
>     withcolor OverlayLineColor;
>    \stopuseMPgraphic
>    
>    % Define an overlay using the above image...
>    \defineoverlay[textcircle][\useMPgraphic{textcircle}]
>    
>    % Define a frame we can use via \textcircled{X} that uses as its
>    background
>    %  the above overlay...
>    \defineframed
>   [textcircled]
>   [width=1.4em,
>    height=1.4em,
>    frame=off,
>    background=textcircle,
>    framecolor=colour_text,
>    location=low,
>    offset=none]
>    
>    \starttext
>    Here are the numbers \textcircled{1}, \textcircled{2}, and
>    \textcircled{3}.
>    
>    And when used in formula, \math{\Sigma_{i^b
> x_{\textcircled{3}}^i}}
>    \stoptext
> 
> What I was hoping would happen there was the circled 3 in the formula
> would shrink to look like a subscript for the x variable. Any help
> appreciated.

Wolfgang, please don't tax yourself further on this. I've managed to
find another way of expressing the same ideas in my publication without
having to resort to the above magic. Thanks again.

-- 
Kip Warner
OpenPGP signed/encrypted mail preferred
https://www.thevertigo.com


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Number in a circle

2024-05-28 Thread Kip Warner
On Tue, 2024-05-28 at 17:38 +0200, Wolfgang Schuster wrote:
> Add
> 
>  framecolor=colour_text,
> 
> to the frame settings.

Thanks Wolfgang. That does work.

But another problem I've found is the font and circle are not
automatically resized when used in a formula:

   \definecolor[colour_text][r=0.754,g=0.516,b=0.324] % RGB 0xc08453
   
   \setupcolors[
   state=start,
   textcolor=colour_text,
   pagecolormodel=rgb] % gray rgb cmyk auto none
   
   % Commands for MetaPost interpreter to draw a circle...
   \startuseMPgraphic{textcircle}
draw fullcircle
xscaled OverlayWidth
yscaled OverlayWidth
withcolor OverlayLineColor;
   \stopuseMPgraphic
   
   % Define an overlay using the above image...
   \defineoverlay[textcircle][\useMPgraphic{textcircle}]
   
   % Define a frame we can use via \textcircled{X} that uses as its
   background
   %  the above overlay...
   \defineframed
  [textcircled]
  [width=1.4em,
   height=1.4em,
   frame=off,
   background=textcircle,
   framecolor=colour_text,
   location=low,
   offset=none]
   
   \starttext
   Here are the numbers \textcircled{1}, \textcircled{2}, and
   \textcircled{3}.
   
   And when used in formula, \math{\Sigma_{i^b x_{\textcircled{3}}^i}}
   \stoptext

What I was hoping would happen there was the circled 3 in the formula
would shrink to look like a subscript for the x variable. Any help
appreciated.

-- 
Kip Warner
OpenPGP signed/encrypted mail preferred
https://www.thevertigo.com


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Number in a circle

2024-05-28 Thread Wolfgang Schuster

Kip Warner schrieb am 28.05.2024 um 06:29:

On Mon, 2024-05-27 at 19:44 +0200, Wolfgang Schuster wrote:

You can use the \framed solution and modify it to use a metapost
graphic as background, it also easy to replace the circle with a
hexagon etc.

\startuseMPgraphic{textcircle}
  draw fullcircle
  xscaled OverlayWidth
  yscaled OverlayWidth
  withcolor OverlayLineColor ;
\stopuseMPgraphic

\defineoverlay[textcircle][\useMPgraphic{textcircle}]

\defineframed
    [textcircled]
    [  width=1.5em,
  height=1.5em,
  frame=off,
     background=textcircle,
   location=low,
     offset=none]

\starttext
\dostepwiserecurse{0}{9}{1}{#1 = \textcircled{#1}\blank}
\stoptext


Thank you again Wolfgang. This is very helpful and works well.

One question I have for you is how to set the colour of the circle to
match the other text on my page. I currently do the following in my
environment file:

\definecolor[colour_text][r=0.754,g=0.516,b=0.324]
   
\setupcolors[state=start,textcolor=colour_text,pagecolormodel=rgb]


Add

framecolor=colour_text,

to the frame settings.

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Number in a circle

2024-05-27 Thread Kip Warner
On Mon, 2024-05-27 at 19:44 +0200, Wolfgang Schuster wrote:
> You can use the \framed solution and modify it to use a metapost
> graphic as background, it also easy to replace the circle with a
> hexagon etc.
> 
> \startuseMPgraphic{textcircle}
>  draw fullcircle
>  xscaled OverlayWidth
>  yscaled OverlayWidth
>  withcolor OverlayLineColor ;
> \stopuseMPgraphic
> 
> \defineoverlay[textcircle][\useMPgraphic{textcircle}]
> 
> \defineframed
>    [textcircled]
>    [  width=1.5em,
>  height=1.5em,
>  frame=off,
>     background=textcircle,
>   location=low,
>     offset=none]
> 
> \starttext
> \dostepwiserecurse{0}{9}{1}{#1 = \textcircled{#1}\blank}
> \stoptext

Thank you again Wolfgang. This is very helpful and works well.

One question I have for you is how to set the colour of the circle to
match the other text on my page. I currently do the following in my
environment file:

   \definecolor[colour_text][r=0.754,g=0.516,b=0.324]
  
   \setupcolors[state=start,textcolor=colour_text,pagecolormodel=rgb]

-- 
Kip Warner
OpenPGP signed/encrypted mail preferred
https://www.thevertigo.com


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Number in a circle

2024-05-27 Thread Wolfgang Schuster

Kip Warner schrieb am 27.05.2024 um 19:23:

On Mon, 2024-05-27 at 05:43 -0400, seyal zavira wrote:

if you don't want to use metapost you can also use svg for background
for example:

\startuniqueMPgraphic{centered_svg}
   draw lmt_svg [
     filename = "badge.svg",
     width  = OverlayWidth,
     y      = OverlayHeight/2,  ] ;
\stopuniqueMPgraphic

\defineoverlay
   [svgback]
   [\useMPgraphic{centered_svg}]

\defineframed[Sback][location=low,background=svgback,frame=off,offset=8pt]

\starttext
this is a sample \Sback{1} text
\stoptext


Hello Seyal,

This does work but it's a bit annoying that I have to create an SVG of
just a circle and store it somewhere. I'm fine with using MetaPost,
especially if it makes this easier, but I just don't know how.


You can use the \framed solution and modify it to use a metapost graphic 
as background, it also easy to replace the circle with a hexagon etc.


\startuseMPgraphic{textcircle}
draw fullcircle
xscaled OverlayWidth
yscaled OverlayWidth
withcolor OverlayLineColor ;
\stopuseMPgraphic

\defineoverlay[textcircle][\useMPgraphic{textcircle}]

\defineframed
  [textcircled]
  [  width=1.5em,
height=1.5em,
frame=off,
   background=textcircle,
 location=low,
   offset=none]

\starttext
\dostepwiserecurse{0}{9}{1}{#1 = \textcircled{#1}\blank}
\stoptext

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Number in a circle

2024-05-27 Thread Kip Warner
On Mon, 2024-05-27 at 05:43 -0400, seyal zavira wrote:
> if you don't want to use metapost you can also use svg for background
> for example:
> 
> \startuniqueMPgraphic{centered_svg}
>   draw lmt_svg [
>     filename = "badge.svg",
>     width  = OverlayWidth,
>     y      = OverlayHeight/2,  ] ;
> \stopuniqueMPgraphic
> 
> \defineoverlay
>   [svgback]
>   [\useMPgraphic{centered_svg}]
> 
> \defineframed[Sback][location=low,background=svgback,frame=off,offset
> =8pt]
> 
> \starttext
> this is a sample \Sback{1} text
> \stoptext

Hello Seyal,

This does work but it's a bit annoying that I have to create an SVG of
just a circle and store it somewhere. I'm fine with using MetaPost,
especially if it makes this easier, but I just don't know how.

-- 
Kip Warner
OpenPGP signed/encrypted mail preferred
https://www.thevertigo.com


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Number in a circle

2024-05-27 Thread seyal zavira
if you don't want to use metapost you can also use svg for background
for example:

\startuniqueMPgraphic{centered_svg}
  draw lmt_svg [
filename = "badge.svg",
width  = OverlayWidth,
y  = OverlayHeight/2,  ] ;
\stopuniqueMPgraphic

\defineoverlay
  [svgback]
  [\useMPgraphic{centered_svg}]

\defineframed[Sback][location=low,background=svgback,frame=off,offset=8pt]

\starttext
this is a sample \Sback{1} text
\stoptext

On Mon, May 27, 2024 at 12:38 AM Kip Warner  wrote:

> Hello list,
>
> I would like to typeset a number in a circle. Nothing fancy. No special
> colours, transforms, or complex metapost magic (which I am not familiar
> with).
>
> I have tried \circled{3} and \textcircled{3}, but ConTeXt does not
> appear to recognize these commands. Any help appreciated.
>
> --
> Kip Warner
> OpenPGP signed/encrypted mail preferred
> https://www.thevertigo.com
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: build_parshape and \getshapetext - need for a deeper understanding

2024-05-19 Thread Hans Hagen via ntg-context

On 5/19/2024 2:29 PM, garu...@azules.eu wrote:

I still get some difficulties with build_parshape, \getshapetex and sectionning.

I though I find a solution by removing \blank with
   \setuphead  [subsection]  [before=,  after=, style=, 
command=\MySubSectionCommand, alternative=text ]

But actually it's not enough : when I add text before the first section, new 
issues appear.

I tried to build a MVE by refactoring and tidying as much as I could.
It build 3 comparative pages (i) basic issue, (ii) solution, (iii) remaining 
issue.

Your guidance are most welcome :-)


you have to fight several issues:

- parshapes being reset at the end paragraph (handled here by luametatex 
context)
- parshapes operate on lines, not dimension (i might add an aletnative 
one day)

- you use a bit old mechanism (checkout the luametafun-paragraphs chapter)

Now, is there a solution? It really depends on the circumstances, so 
here is one.


\setupbodyfont[11pt]

\definemeasure [mywidth]  [7cm]
\definemeasure [mywidtha] [5cm]
\definemeasure [myheight] 
[{\the\dimexpr\baselineskip*37+\lineskip\relax}]
\definemeasure [myheighta] 
[{\the\dimexpr\baselineskip*18+\lineskip*1\relax}]
\definemeasure [myheightb] 
[{\the\dimexpr\baselineskip*25-\lineskip*1\relax}]


\startuseMPgraphic{shape:1}
  path p ;
  numeric mywidth   ; mywidth   := \measure{mywidth};
  numeric mywidtha  ; mywidtha  := \measure{mywidtha};
  numeric myheight  ; myheight  := \measure{myheight};
  numeric myheighta ; myheighta := \measure{myheighta};
  numeric myheightb ; myheightb := \measure{myheightb};
  p := (0,0)-- (mywidth,0) --
   (mywidth,myheighta)  -- (mywidtha,myheighta) --
   (mywidtha,myheightb) -- (mywidth,myheightb) --
   (mywidth,myheight)   -- (0cm,myheight) -- cycle;

build_parshape(p,0,0,0,\baselinedistance,\strutheight,\strutdepth,\topskip) 
;

  path SavedShape ; SavedShape := p ;
\stopuseMPgraphic

\startuseMPgraphic{shape:2}
  SavedShape := SavedShape shifted (0,-ypart urcorner OverlayBox) ;
  SavedShape := SavedShape shifted (0,positiony("test")) ;
  fill SavedShape withcolor red;
 setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\showframe

\defineoverlay[myoverlay][\useMPgraphic{shape:2}]

\setupbackgrounds[text][text][background=myoverlay]

\startsection[title={test}]

\startshapedparagraph[mp=shape:1]%
\setupalign[verytolerant,stretch]%
\hpos{test}{!}\samplefile{tufte}
\samplefile{tufte}
\stopshapedparagraph

\stopsection

The "test" position is hard coded but should be namespaced, the ! can be 
a \strut instead.


So, more thinking from the end of the text flow.

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] build_parshape and \getshapetext - need for a deeper understanding

2024-05-19 Thread garulfo
I still get some difficulties with build_parshape, \getshapetex and sectionning.

I though I find a solution by removing \blank with
  \setuphead  [subsection]  [before=,  after=, style=, 
command=\MySubSectionCommand, alternative=text ]

But actually it's not enough : when I add text before the first section, new 
issues appear.

I tried to build a MVE by refactoring and tidying as much as I could.
It build 3 comparative pages (i) basic issue, (ii) solution, (iii) remaining 
issue.

Your guidance are most welcome :-)


\setupbodyfont[11pt]

%--

\usecolors[svg]

\definemeasure [mywidth]  [7cm]
\definemeasure [mywidtha] [5cm]
\definemeasure [myheight] [{\the\dimexpr\baselineskip*37+\lineskip\relax}]
\definemeasure [myheighta][{\the\dimexpr\baselineskip*18+\lineskip*1\relax}]
\definemeasure [myheightb][{\the\dimexpr\baselineskip*25-\lineskip*1\relax}]

\startuseMPgraphic{mymetafunpath}
  path p ;
  numeric mywidth   ; mywidth   := \measure{mywidth};
  numeric mywidtha  ; mywidtha  := \measure{mywidtha};
  numeric myheight  ; myheight  := \measure{myheight};
  numeric myheighta ; myheighta := \measure{myheighta};
  numeric myheightb ; myheightb := \measure{myheightb};
  p := (0,0)-- (mywidth,0) --
   (mywidth,myheighta)  -- (mywidtha,myheighta) --
   (mywidtha,myheightb) -- (mywidth,myheightb) --
   (mywidth,myheight)   -- (0cm,myheight) -- cycle;
  build_parshape(p,0,0,0,\baselinedistance,\strutheight,\strutdepth,\topskip) ;
  fill p withcolor \MPcolor{tan};
\stopuseMPgraphic

\defineoverlay[myoverlay][\useMPgraphic{mymetafunpath}]

%--

\define[2]\MySubSectionCommand{\leftaligned{#2}}

%--

\define[2]\MyPageBuilder{%
\page
\setupbackgrounds[page][background=testA]
\definelayer[testA] [x=0mm, y=0mm,width=\paperwidth, height=\paperheight]
~

\startshapetext[mymetafunpath, mymetafunpath]   % <=== WITHOUT \startsubsection
#2
%\startsubsection[title={Title for section  #1}]
\MySubSectionCommand{1}{Title for section #1}
\input knuth \endgraf \input ward
%\stopsubsection
\stopshapetext

\setlayer
  [testA]
  [hoffset={\the\dimexpr\backspace\relax},
   voffset={\the\dimexpr\topspace+\headerheight+\headerdistance\relax},]
  {\framed[background=myoverlay,frame=off]{\strut\getshapetext}}

\startshapetext[mymetafunpath, mymetafunpath]   % <=  WITH \startsubsection
#2
\startsubsection[title={Title for section  #1}]
%\MySubSectionCommand{1}{Title for section #1}
\input knuth \endgraf \input ward
\stopsubsection
\stopshapetext

\setlayer
  [testA]
  [hoffset={\the\dimexpr\backspace+\measure{mywidth}+5mm\relax},
   voffset={\the\dimexpr\topspace+\headerheight+\headerdistance\relax},]
  {\framed[background=myoverlay,frame=off]{\strut\getshapetext}}
}

%==

%\showboxes

\starttext

\MyPageBuilder{A}{}

\setuphead
  [subsection]
  [
   before=,
   after=,
   style=,
   command=\MySubSectionCommand,
   alternative=text,
   ]

\MyPageBuilder{B}{}

\MyPageBuilder{C}{\strut Hi from here. \endgraf}

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Why is only the first frame protruding into the margin?

2024-05-17 Thread Wolfgang Schuster

madiazm.eo...@gmail.com schrieb am 17.05.2024 um 00:05:

Hi,
I used some code from the meta-fun manual to recreate a labelled frame around 
my sections. But the first framedtext protrudes a couple of mm into the margin. 
Only the first one in the page. I intentionaly added other sections and the 
frames aline to the margin ok.
I tried to put something before the first frame (noindentation, dontleavehmode) 
because I sometimes read it solves problems, but not the case here.
so Why is the first frame protruding and only the first?


[...]



Include only setups in your examples which are necessary to show the 
problem, the custom layout isn't necessary and can be left out.




\startuseMPgraphic{FunnyFrame}
picture p ; numeric w, h, o ;
p := textext.rt(\MPstring{FunnyFrame}) ;
w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
p := p shifted (2o,h-ypart center p) ; draw p ;
drawoptions (withpen pencircle scaled .25pt withcolor blue) ;
draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
%draw boundingbox p ; %%%quitamos el frame pequeño
setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][width=.85\textwidth, height=20mm, frame=off,  
background=FunnyFrame, align=flushright,location=right, 
after={\blank[2*big]}]%foregroundsytel amplía la palabra Apartado

\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut \color[blue]{\tfx Apartado 
#1}\hss}}}

\setMPtext{FunnyFrame}{} % initialize the text variable



\define[2]\firstHeadings{%
\dontleavehmode \switchtobodyfont[miCorm]
\FrameTitle#1%

\dontleavehmode \startFunnyText  {\switchtobodyfont[miCorm,20.7pt] #2} 
\stopFunnyText
}

\setuphead [section] [color=blue, command=\firstHeadings, indentnext=no]



Get rid of \dontleavehmode in your custom section layout, avoid blank 
lines in definitions and move the font changes to \setuphead.



\define[2]\firstHeadings
  {\FrameTitle{#1}%
   \startFunnyText
 #2%
   \stopFunnyText}

\setuphead
  [section]
  [color=blue,
   style={\switchtobodyfont[miCorm]},
   textstyle={\switchtobodyfont[20.7pt]},
   command=\firstHeadings,
   indentnext=no]



\startsection[title=Aspectos generales]
Esta guía contiene toda la documentación necesaria para administrar la prueba 
unificada de certificación que ha diseñado la comisión de alemán. Se ruega al 
profesorado\footnote{Todas las alusiones a la forma del masculino genérico que 
se recogen en este documento deberán entenderse referidas a la condición 
masculina o femenina de cada persona según corresponda.} que se familiarice con 
las secciones del documento a través del índice y acuda a ellas según vaya 
siendo necesario, de manera que se pueda administrar y corregir la prueba de la 
manera más satisfactoria posible.
\stopsection



Use dummy text when it possible to keep the example short and clean.

\startsection[title=Aspectos generales]
\samplefile{lorem}
\stopsection


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Why is only the first frame protruding into the margin?

2024-05-16 Thread madiazm . eoicc
Hi,
I used some code from the meta-fun manual to recreate a labelled frame around 
my sections. But the first framedtext protrudes a couple of mm into the margin. 
Only the first one in the page. I intentionaly added other sections and the 
frames aline to the margin ok.
I tried to put something before the first frame (noindentation, dontleavehmode) 
because I sometimes read it solves problems, but not the case here.
so Why is the first frame protruding and only the first?


\definepapersize[vertical][A4, portrait]
\definepapersize[horizontal][A4, landscape] 
\setuppapersize[vertical]


\setuplayout[location=middle,
 marking=off,
 topspace=1cm,
 topdistance=0cm,
 backspace=2.5cm,   
 height=fit,
 width=fit,
 rightedge=5mm,
 rightedgedistance=0cm,
 rightmargin=20mm,
 rightmargindistance=7mm,
 leftmargin=1.5cm,
 header=1cm,
 headerdistance=.5cm,
 bottomspace=.5cm,
 bottomdistance=0mm,
 footer=.8cm,
 footerdistance=.2cm,
 setup=strict,]



\startuseMPgraphic{FunnyFrame}
picture p ; numeric w, h, o ;
p := textext.rt(\MPstring{FunnyFrame}) ;
w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
p := p shifted (2o,h-ypart center p) ; draw p ;
drawoptions (withpen pencircle scaled .25pt withcolor blue) ;
draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
%draw boundingbox p ; %%%quitamos el frame pequeño
setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][width=.85\textwidth, height=20mm, frame=off,  
background=FunnyFrame, align=flushright,location=right, 
after={\blank[2*big]}]%foregroundsytel amplía la palabra Apartado

\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut \color[blue]{\tfx Apartado 
#1}\hss}}}

\setMPtext{FunnyFrame}{} % initialize the text variable



\define[2]\firstHeadings{%
\dontleavehmode \switchtobodyfont[miCorm] 
\FrameTitle#1%

\dontleavehmode \startFunnyText  {\switchtobodyfont[miCorm,20.7pt] #2} 
\stopFunnyText
}

\setuphead [section] [color=blue, command=\firstHeadings, indentnext=no]


\starttext
\noindentation 
\dontleavehmode 

\startsection[title=Aspectos generales]


Esta guía contiene toda la documentación necesaria para administrar la prueba 
unificada de certificación que ha diseñado la comisión de alemán. Se ruega al 
profesorado\footnote{Todas las alusiones a la forma del masculino genérico que 
se recogen en este documento deberán entenderse referidas a la condición 
masculina o femenina de cada persona según corresponda.} que se familiarice con 
las secciones del documento a través del índice y acuda a ellas según vaya 
siendo necesario, de manera que se pueda administrar y corregir la prueba de la 
manera más satisfactoria posible.
\stopsection


\startsection[title=another section]
Las carpetas con las pruebas aparecen nombradas por idioma, nivel y set de 
pruebas, no apareciendo ninguna referencia a convocatorias anuales ni tampoco 
fechas. Sí aparece la referencia a la convocatoria en cada una de las guías de 
administración para los diferentes niveles.
 \stopsection
\startsection[title=another section]
La carpeta correspondiente a cada nivel contiene las distintas actividades de 
lengua, los audios para CTO y el audio/vídeo base para la mediación escrita. 
Además contiene esta guía con la información necesaria para tener una visión 
global de la prueba: los solucionarios, transcripciones, tablas de corrección, 
tablas de conversión y la rúbrica para la mediación escrita. Igualmente se 
incorporarán o enlazarán subcarpetas con los archivos necesarios para las 
pruebas orales: monólogos, diálogos y mediaciones orales.
 \stopsection

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] compatibility between \startshapetext and \startsection ?

2024-05-14 Thread garulfo
Hi all,

\startshapetext works pretty well, but when I use \startsection \stopsection, 
shapes are not respected  anymore.
I use layers, to be able to place the content anywhere, but the issue remains 
without layers.

Any clues ?
(\placeinitial seems also to break the shaping)


Example : 2 pages without sectioning, and after 2 pages by uncommenting the 
\startsection and \stopsection commands.


\setupbodyfont [pagella, 8pt]
\setupframed
  [frame=on,
   offset=0.000pt,
   rulethickness=0.000pt,
   location=top,
   align=normal,
   strut=yes,
   ]
\setuplayout [grid=yes]
\setupinteraction [state=start]

%--

\definemeasure [myheight] [{\the\dimexpr\baselineskip*33+\lineskip\relax}]
\definemeasure [myheighta][{\the\dimexpr\baselineskip*10+\lineskip*2\relax}]
\definemeasure [myheightb][{\the\dimexpr\baselineskip*20-\lineskip*2\relax}]

\startuseMPgraphic{mp1}
  path p ;
  numeric myheight  ; myheight := \measure{myheight};
  numeric myheighta ; myheighta := \measure{myheighta};
  numeric myheightb ; myheightb := \measure{myheightb};
  p := (0,0) -- (6cm,0) --
   (6cm,myheighta) -- (4cm,myheighta) -- (4cm,myheightb) -- (6cm,myheightb) 
--
   (6cm,myheight) -- (0cm,myheight) -- cycle;
  build_parshape(p,0,0,0,\baselinedistance,\strutheight,\strutdepth,\topskip) ;
  fill p withcolor \MPcolor{lightyellow};
\stopuseMPgraphic

\defineoverlay[ol1][\useMPgraphic{mp1}]


%==
\starttext
%==

{\sc\bfd Version A, without sectionning, pages 1\ampersand 2}

\startshapetext[mp1, mp1, mp1, mp1, mp1, mp1]
\setupalign[hz,hanging,verytolerant,stretch,normal]%
\setupindenting[yes,small]%
\strut%
\reference[myref1]{MyRef1}Here is the first reference.\par
See reference \in[myref2] on \at{page}[myref2]\par
%
\dorecurse{5}{
%\startsection[title={Title for section{\recurselevel}}]
\darkred\input knuth \par
\darkblue\input ward
%\stopsection
}

\reference[myref2]{MyRef2} Here is the second reference.\par
See reference \in[myref1] on \at{page}[myref1]\par

\stopshapetext

\definelayer[testA]

\setlayer[testA][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testA][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testA]

\page

\setlayer[testA][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testA][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testA]

\page
%==

{\sc\bfd Version B, with sectionning, pages 3\ampersand 4}

\startshapetext[mp1, mp1, mp1, mp1, mp1, mp1]
\setupalign[hz,hanging,verytolerant,stretch,normal]%
\setupindenting[yes,small]%
\strut%
\reference[myref3]{MyRef3}Here is the first reference.\par
See reference \in[myref4] on \at{page}[myref4]\par
%
\dorecurse{5}{
\startsection[title={Title for section{\recurselevel}}]
\darkred\input knuth \par
\darkblue\input ward
\stopsection
}

\reference[myref4]{MyRef4} Here is the second reference.\par
See reference \in[myref3] on \at{page}[myref3]\par

\stopshapetext

\definelayer[testB]

\setlayer[testB][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testB][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testB]

\page

\setlayer[testB][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testB][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testB]

%==
\stoptext
%==
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: what are the interaction between \showframe and \realpageno in \startuseMPgraphic ?

2024-04-24 Thread Wolfgang Schuster

garu...@azules.eu schrieb am 20.04.2024 um 23:00:

I can not figure out why this progress bar only works when \showframe is 
activated.
When you comment on \showframe, it's as if \realpageno is at zero.
(current version: 2024.04.01 08:59)

\showframe

\startuseMPgraphic{MonGraphisme_MP}
   numeric n ; n := \number\realpageno ;
   numeric m ; m := \number\lastpageno ;
   numeric h ; h := \overlayheight ;
   numeric w ; w := \overlaywidth ;
   numeric e ; e := 3mm;
   numeric r ; r := (((n-1)/(m-1))*w);
   fill fullsquare xscaled w yscaled e shifted (w/2, h/2) withcolor darkblue ;
   fill fullsquare xscaled r yscaled e shifted (r/2, h/2) withcolor darkred;
\stopuseMPgraphic

\defineoverlay [MonGraphisme_OL] [\useMPgraphic{MonGraphisme_MP}]

\setupbackgrounds [footer] [rightmargin] [background={MonGraphisme_OL}]

\starttext
\dorecurse{10}{\input tufte\page}
\stoptext

Any clue is warmly welcome


You need

    \setupbackgrounds[state=repeat]

which is set when you use \showframe.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] what are the interaction between \showframe and \realpageno in \startuseMPgraphic ?

2024-04-20 Thread garulfo
I can not figure out why this progress bar only works when \showframe is 
activated.
When you comment on \showframe, it's as if \realpageno is at zero.
(current version: 2024.04.01 08:59)

\showframe

\startuseMPgraphic{MonGraphisme_MP}
  numeric n ; n := \number\realpageno ;
  numeric m ; m := \number\lastpageno ;
  numeric h ; h := \overlayheight ;
  numeric w ; w := \overlaywidth ;
  numeric e ; e := 3mm;
  numeric r ; r := (((n-1)/(m-1))*w);
  fill fullsquare xscaled w yscaled e shifted (w/2, h/2) withcolor darkblue ;
  fill fullsquare xscaled r yscaled e shifted (r/2, h/2) withcolor darkred;
\stopuseMPgraphic

\defineoverlay [MonGraphisme_OL] [\useMPgraphic{MonGraphisme_MP}]

\setupbackgrounds [footer] [rightmargin] [background={MonGraphisme_OL}]

\starttext
\dorecurse{10}{\input tufte\page}
\stoptext

Any clue is warmly welcome
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Wiki page : Mixed languages sample (French, Ancient Greek, Arabic, Chinese)

2024-03-01 Thread Jean-Pierre Delange

Dear List,

Several years ago I tried to write documents, mainly lectures, but also 
essays, in which I tried to make several languages (Romance and 
non-Romance) coexist.
Here below is an example of an attempt to compose an acceptable 
document, in the form of an exercise in which Arabic and Chinese are 
introduced into a document written in French. With footnotes and a few 
framed lines.


I submit this example for your perusal and ask you whether it could 
possibly appear on a wiki page devoted to the combination of 
non-European languages in the same text. In English translation, of course.


%We are giving below an example of a text written in a Latin language, 
in which we want to print here and there some text in ancient Greek, 
Arabic and Chinese.


\setuplanguage[fr][patterns={fr,agr}]

\mainlanguage[fr]

\setuplayout [backspace=40mm]

\setuppagenumbering[alternative=doublesided, location={header, inmargin}]

\setupmargindata[inmargin][location=inner, 
style={\ssx\setupinterlinespace[line=2.8ex]}]


\setupmarginframed[inmargin][align=right]

\setupbodyfontenvironment[default][em=italic]

% Use Theano Didot as Ancient Greek font

\definefallbackfamily[mainface][serif][Theano Didot][preset=range:greek, 
it={Old Standard Italic}, force=yes]


% Choose between Ipaexmincho font and NotoSansTC (Traditional Chinese)

%\definefallbackfamily [mainface] [rm] [ipaexmincho] 
[range=cjkunifiedideographs]


\definefallbackfamily [mainface] [rm] [notosanstc] 
[range=cjkunifiedideographs]


% Choose between two Arabic fonts

%\definefallbackfamily[mainface] [serif] [nafeesnastaleeq] [range=arabic]

\definefallbackfamily[mainface] [serif] [hussaininastaleeq] [range=arabic]

\definefontfamily [mainface] [serif] [GaramondNo8][sc=NewG8 Regular SC]

\definefontfamily [mainface] [sans] [FreeSans] [rscale=0.7]

\definefontfamily[mainface] [serif] [GFS Didot]

\setupbodyfont[mainface]

\setupindenting[1.5em]

\setupindenting[yes]

\setupcolors[state=start]


\defineframedtext

[MyFrame]

[before={\blank},

after={\blank},

frame=off,

background=MyFrame,

%width=\textwidth,

width=max,

height=fit,

style=italic]


\definelabel

[Définition]

[headstyle=\bf\smallcaps]


\startuseMPgraphic{MyFrame}

path b;

picture p;

%p := textext.rt("\white\Définition");

p := textext.rt("\white\framedtextparameter{Title}");

%p := textext.rt("\white\getvariable{text}{text1}");

p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);

b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;

fill OverlayBox withcolor lightgray; %\MPcolor{

fill b withcolor darkred;

draw bottomboundary OverlayBox withpen pencircle scaled 1pt withcolor

darkred;

draw topboundary OverlayBox withpen pencircle scaled 1pt withcolor

darkred;

draw p;

setbounds currentpicture to boundingbox currentpicture enlarged 2mm;

\stopuseMPgraphic


\defineoverlay

[MyFrame]

[\useMPgraphic{MyFrame}]



\setupwhitespace[medium]

\setupinterlinespace[line=3.2ex]


\setupitemize[each][margin=yes]


\setuphead[title][header=empty]


\setupheader[style={\sc}]

\setupfooter[style={\itxx}]

\setupheadertexts[Utilisation de plusieurs langues dans un même texte 
avec \ConTeXt][][][{\getmarking[section]}]


\setupfootertexts[][][][© J.-P. Delange, 2016 — La reproduction de ce 
texte est soumise à autorisation.]


\defineparagraphs[TwoColumns][n=2, align={hz, hanging}]

\setupparagraphs[TwoColumns][1][width=210pt, style=rm, align=left]

\starttext

\title{\ConTeXt, ou comment imprimer des langues non-romanes}

\section {\sc Préambule}


Lorsqu'il s'agit de proposer un document dans une langue nationale (le 
français), tout va bien. Lorsqu'il s'agit de rédiger en français un 
document un peu complexe, avec des citations — ou des références — dans 
une autre langue, qui en particulier n'a pas les mêmes exigences que le 
français, ni les mêmes {\em signes diacritiques} on se heurte à quelques 
difficultés. Les suites logicielles comme Microsoft Office ou 
LibreOffice ne manquent pas de puissance, mais à vrai dire, dès que nous 
entrons dans les exigences de l'édition professionnelle, qui consistent 
à présenter un texte lisible et enrichi (en notes, etc.), la situation 
devient vite techniquement assez pénible. La situation la plus courante 
que nous rencontrons dans les Lettres, en Philosophie, en Histoire, et 
plus généralement dans les Humanités, est celle d'un texte dans lequel 
il y a des citations d'auteurs grecs ou latin, avec des références en 
notes de bas de page, qui contiennent du grec. Cela pourrait être 
quelque chose comme ceci :


\blank\startnarrower[1*left,1*right]\tfx\setupinterlinespace

\noindent \quotation{Ἔφη γάρ οἱ Σωκράτη ἐντυχεῖν λελουμένον τε καὶ τὰς 
βλαύτας ὑποδεδεμένον, ἃ ἐκεῖνος ὀλιγάκις ἐποίει· καὶ ἐρέσθαι αὐτὸν ὅποι 
ἴοι οὕτω καλὸς γεγενημένος. καὶ τὸν εἰπεῖν ὅτι· Ἐπὶ δεῖπνον εἰς 
Ἀγάθωνος. χθὲς γὰρ αὐτὸν διέφυγον τοῖς ἐπινικίοις, φοβηθεὶς τὸν ὄχλον· 
ὡμολόγησα δ᾽ εἰς τήμερον παρέσεσθα

[NTG-context] Re: MetaPost lines in tables?

2024-02-22 Thread Henning Hraban Ramm

Am 22.02.24 um 18:35 schrieb Hans Hagen via ntg-context:

On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:

(I’m sure I already used that somewhere… Must document…)
ok, new feature dedicated to Hraban ... who then of course has to 
document it.


This is nice.
Thank you, will do.

(Actually I’m not much interested in dashed borders but to have lines 
affected by my sketchy style - courtesy of Aditya et al., see below)


Taco, will the syntax pages in the wiki update automatically to a newer 
version?



"""
\startuseMPgraphic{mp:sketchy}
input mp-sketch.mp;
sketchypaths;

sketch_amount := 1 + (uniformdeviate 2);
sketch_passes := 3;
sketch_segments := 2 + (uniformdeviate 3);
sketch_length := OverlayWidth / 3;

draw topboundary withpen pensquare withcolor lightgray;
naturalizepaths;
\stopuseMPgraphic

\defineoverlay[sketchylines][\useMPgraphic{mp:sketchy}]

\setupTABLE[r][first][style=bold]
\setupTABLE[r][each][
topoffset=1em,bottomoffset=0.5em,
background=sketchylines,
% would be nice if the background wouldn’t start at each column
]
\setupTABLE[c][each][frame=off]
\bTABLE[]
\bTR
\bTD{Stadt}\eTD
\bTD{Land}\eTD
\bTD{Fluss}\eTD
\eTR
\dorecurse{10}{
\bTR
\bTD\strut \eTD\bTD \eTD\bTD \eTD
\eTR
}
\eTABLE
"""


Hraban%D \module
%D   [   file=mp-sketch.mp
%Dversion=2021.05.13
%D  title=\CONTEXT\ \METAPOST\ graphics,
%D   subtitle=Sketch drawing,
%D author=Aditya Mahajan,
%D   date=\currentdate,
%D  copyright={Aditya Mahajan}]

%D This metapost module is inspired by a TeX.SE question:
%D http://tex.stackexchange.com/q/39296/323
%D
%D I thought that it would be fun to implement a similar feature in MetaPost.
%D
%D To use this package in MetaPost:
%D
%D \starttyping
%Dinput mp-sketch;
%D
%Dbeginfig(1)
%D  sketchypaths; % Make draw and fill sketchy
%D  ...
%D  naturalizepaths; % Restore the value of draw and fill
%D  ...
%Dendfig
%D \stoptyping
%D
%D The code is heavily inspired by Hans Hagen's Metafun macros.
%D
%D The macro \type{sketchypaths} is modeled after \type{visualizepaths} from
%D \filename{mp-tool}.

def sketchypaths =
let draw = sketchdraw ;
let fill = sketchfill ;
enddef ;

%D Check if \filename{mp-tool} is loaded
if not known context_tool :
  let normaldraw = draw;
  let normalfill = fill;

  def naturalizepaths =
  let fill = normalfill ;
  let draw = normaldraw ;
  enddef ;
fi

%D The variable \type{sketch_amount} determines the amount of randomness in the
%D drawing
numeric sketch_amount; sketch_amount := 0.75bp;

%D The variable \type{sketch_passes} determines the number of times the path
%D is drawn
numeric sketch_passes; sketch_passes := 1;

%D Based on \type{randomized}. Assumes p is path:
numeric sketch_segments; sketch_segments := 20;

%D Length (time) of line segments:
numeric sketch_length; sketch_length := 5mm;

primarydef p sketchrandomized s = (
if path p :
for t = 0 step 1/sketch_segments until 1-1/sketch_segments :
((point   (t*arclength(p)) on p) 
randomshifted s) .. controls
((postcontrol (t*arclength(p)) on p) 
randomshifted s) and
((precontrol  ((t+1/sketch_segments)*arclength(p)) on p) 
randomshifted s) ..
endfor
% TODO: beide Ansätze kombinieren. Eckpunkte erhalten!

%for t = 0 step sketch_length until arclength p:
%  (point (arctime t of p) of p) randomshifted s ..
%endfor
if cycle p : % funktioniert nicht
  cycle
else :
  ((point   (arclength(p)) on p) randomshifted 
s)
  %(point (arctime t of p) of p) randomshifted s
fi
else :
p
fi
) enddef ;



%D The macro \type{sketchdraw} draws the randomized path. The
%D \type{expr} ... \type{text} trick is copied from the definition of
%D \type{drawarrow}
def sketchdraw expr p =
   do_sketchdraw(p)
enddef;

def do_sketchdraw(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normaldraw p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normaldraw p t;
  fi
enddef;

%D The macro \type{sketchfill} randomizes the path before filling it.
def sketchfill expr p =
  do_sketchfill(p)
enddef ;

def do_sketchfill(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normalfill p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normalfill p t;
  fi
enddef;

picture NoisePattern;
NoisePattern := image(
  pickup pencircle xyscaled 0.5bp;
  numeric pmax ; pmax := 7 ;
  numeric x ; numeric y ;
for i = 1 upto pmax:
for j = 1 upto pmax:
  

[NTG-context] Re: MetaPost lines in tables?

2024-02-21 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 21.02.2024 um 19:04:

Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it 
will probably work, but it’s a crutch…


The example below draws a custom border for the whole cell but you're 
free to draw only certain sides (leftboundary etc. helps) but don't 
forget to set the boundary box for the graphic (OverlayBox is the size 
of the cell).


 begin example
\startuseMPgraphic{dottedborder}
   draw OverlayBox withpen pencircle scaled 2 dashed withdots 
withcolor "red";

\stopuseMPgraphic

\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]

\starttext

\bTABLE[frame=off,background=dottedborder]


Thank you!

Since I needed only horizontal lines, I forced the height with an 
“invisible“ line:


\startuseMPgraphic{dottedborder}
    draw (0,0)--(0,OverlayHeight) withpen pencircle scaled 0.001 
withcolor white;
    draw (0,0)--(OverlayWidth,0) withpen pencircle scaled 2 dashed 
withdots withcolor "red";

\stopuseMPgraphic

… but it would be visible on a colored background. I’m sure you can show 
me a better way…


\startuseMPgraphic{dottedborder}
  draw bottomboundary OverlayBox withpen pencircle scaled 2 dashed 
withdots withcolor "red";

  setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-21 Thread Henning Hraban Ramm

Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it will 
probably work, but it’s a crutch…


The example below draws a custom border for the whole cell but you're 
free to draw only certain sides (leftboundary etc. helps) but don't 
forget to set the boundary box for the graphic (OverlayBox is the size 
of the cell).


 begin example
\startuseMPgraphic{dottedborder}
   draw OverlayBox withpen pencircle scaled 2 dashed withdots withcolor 
"red";

\stopuseMPgraphic

\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]

\starttext

\bTABLE[frame=off,background=dottedborder]


Thank you!

Since I needed only horizontal lines, I forced the height with an 
“invisible“ line:


\startuseMPgraphic{dottedborder}
   draw (0,0)--(0,OverlayHeight) withpen pencircle scaled 0.001 
withcolor white;
   draw (0,0)--(OverlayWidth,0) withpen pencircle scaled 2 dashed 
withdots withcolor "red";

\stopuseMPgraphic

… but it would be visible on a colored background. I’m sure you can show 
me a better way…


My real life example (p.2 in https://yemaya.fiee.net/s/DEEHs5m49yftiqW) 
involves sketchy lines, and there it’s a bit annoying that the row is 
not its own frame that could get a continuous background… Well, it’s 
good enough, I’ll settle for it.


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-19 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it will 
probably work, but it’s a crutch…


The example below draws a custom border for the whole cell but you're 
free to draw only certain sides (leftboundary etc. helps) but don't 
forget to set the boundary box for the graphic (OverlayBox is the size 
of the cell).


 begin example
\startuseMPgraphic{dottedborder}
  draw OverlayBox withpen pencircle scaled 2 dashed withdots withcolor 
"red";

\stopuseMPgraphic

\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]

\starttext

\bTABLE[frame=off,background=dottedborder]
  \bTR
\bTD Hello Table! \eTD
  \eTR
\eTABLE

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \startcolumns and \startcolumnset

2024-02-08 Thread Otared Kavian
Dear Dalyoung,Have you tried \startsimplecolumns\stopsimplecolumns instead of the columnset mechanism?In your example I put the above commands and I got the attached PDF: is this what you want to obtain?Best regards: Otared

columns-figures.pdf
Description: Adobe PDF document
On 9 Feb 2024, at 02:22, Jeong Dal via ntg-context <ntg-context@ntg.nl> wrote:Dear all,I have a little problem to use “columns” in the following example.If I use “\startcolumnset”, then I have the following problems:	1. The figures is aligned left even though I use \startplacefigure[].	2. In the second column, the first item located at the end of the page.However, \vfill works, so I managed the items evenly spaced vertically.If I use “\startcolumns”, then I have the following problems:	1. \vfill doesn’t works, but \blank[] works. So, it isn’t easy to locate the items evenly spaced vertically.Here are sample code and its outputs of two cases for comparison.Any suggestions are welcomed.Tomorrow is the New Years day in Lunar calendar.Happy new year, again.Best regards,Dalyoung%%%\startuseMPgraphic{mark}path p;p := unitsquare scaled 3cm;draw p;draw (point 0 of p)--(point 2 of p);draw (point 1 of p)--(point 3 of p);\stopuseMPgraphic\startuseMPgraphic{verticalrule3}   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: shifted(-2mm,0) fi ;   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: shifted(2mm,0) fi ; draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;   draw topboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;\stopuseMPgraphic\defineoverlay  [verticalrule]  [\useMPgraphic{verticalrule3}]\setuppagenumbering[state=stop]\setupexternalfigures[location={local,defalut}]\definecolumnset  [quiz]  [n=2,background=verticalrule]\setupbodyfont[bonum, rm, 11pt]\starttext %\startcolumns[n=2,background="">\startcolumnset[quiz]\startitemize[n]  \item Solve the following linear equations.  \startitemize[r]\item equation%\blank[3.5cm]\vfill\item equation%\blank[3.5cm]\vfill\item equation\blank[3.5cm]\item equation\blank[3.5cm]\item equation\blank[3.5cm]  \stopitemize  \hrule\column  \item Draw the graph of the following linear function.\startitemize[r]\item $2x +3y = 6$\startplacefigure[location={here,none},]\useMPgraphic{mark}\stopplacefigure  \item $y = 2x - 1$  \startplacefigure[location={here,none}]\useMPgraphic{mark}\stopplacefigure\stopitemize  \item Find the formula of the line 1:  \vfill  \item Find the formula of the line 2:  \vfill\stopitemize\stopcolumnset\stoptext%%___If your question is of interest to others as well, please add an entry to the Wiki!maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nlwebpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)archive  : https://github.com/contextgarden/contextwiki : https://wiki.contextgarden.net___
Otared Kaviane-mail: ota...@gmail.comPhone: +33 6 88 26 70 95

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] \startcolumns and \startcolumnset

2024-02-08 Thread Jeong Dal via ntg-context
Dear all,I have a little problem to use “columns” in the following example.If I use “\startcolumnset”, then I have the following problems:	1. The figures is aligned left even though I use \startplacefigure[].	2. In the second column, the first item located at the end of the page.However, \vfill works, so I managed the items evenly spaced vertically.If I use “\startcolumns”, then I have the following problems:	1. \vfill doesn’t works, but \blank[] works. So, it isn’t easy to locate the items evenly spaced vertically.Here are sample code and its outputs of two cases for comparison.Any suggestions are welcomed.Tomorrow is the New Years day in Lunar calendar.Happy new year, again.Best regards,Dalyoung%%%\startuseMPgraphic{mark}path p;p := unitsquare scaled 3cm;draw p;draw (point 0 of p)--(point 2 of p);draw (point 1 of p)--(point 3 of p);\stopuseMPgraphic\startuseMPgraphic{verticalrule3}   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: shifted(-2mm,0) fi ;   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: shifted(2mm,0) fi ; draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;   draw topboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;\stopuseMPgraphic\defineoverlay  [verticalrule]  [\useMPgraphic{verticalrule3}]\setuppagenumbering[state=stop]\setupexternalfigures[location={local,defalut}]\definecolumnset  [quiz]  [n=2,background=verticalrule]\setupbodyfont[bonum, rm, 11pt]\starttext %\startcolumns[n=2,background="">\startcolumnset[quiz]\startitemize[n]  \item Solve the following linear equations.  \startitemize[r]\item equation%\blank[3.5cm]\vfill\item equation%\blank[3.5cm]\vfill\item equation\blank[3.5cm]\item equation\blank[3.5cm]\item equation\blank[3.5cm]  \stopitemize  \hrule\column  \item Draw the graph of the following linear function.\startitemize[r]\item $2x +3y = 6$\startplacefigure[location={here,none},]\useMPgraphic{mark}\stopplacefigure  \item $y = 2x - 1$  \startplacefigure[location={here,none}]\useMPgraphic{mark}\stopplacefigure\stopitemize  \item Find the formula of the line 1:  \vfill  \item Find the formula of the line 2:  \vfill\stopitemize\stopcolumnset\stoptext%%

testColumns.pdf
Description: Adobe PDF document


testColumnset.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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: externalfigure crashed

2023-12-04 Thread Hans Hagen via ntg-context

On 12/4/2023 5:38 PM, Pablo Rodriguez via ntg-context wrote:

On 11/24/23 18:16, Hans Hagen via ntg-context wrote:

[…]
will do for now ... i can't upload a new installer .. pending the built;
the advantage is that i can do some experiments that would otherwise
break the current version (making compact font mode very close to
normal, pdf signing […]


Sorry, Hans, if I am missing the point.

Does the above mean that ConTeXt will be able to sign PDF documents with
digital certificates?
Well, that's what singing is, right? The problem is actually less in the 
signing than in the certificates themselves.


Basically one can sign (with some certificate) and then validate.


% sign-001.tex

\setupinteraction[state=start]

\definefield[signature][signed]

\defineoverlay[signature][my signature]

\starttext
\startTEXpage[offset=1ts,frame=on,framecolor=darkblue]
sign: \inframed
  [background=signature,framecolor=darkred]
  {\fieldbody[signature][width=3cm,option=hidden]}
\stopTEXpage
\stoptext

after neing processed:

mtxrun --script pdf --sign --certificate=sign-001.pem --password=test 
sign-001 (--library)


and:

mtxrun --script pdf --validate --certificate=sign-001.pem 
--password=test sign-001 (--library)


etc. works here.

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: How to encircle text?

2023-11-05 Thread Pablo Rodriguez via ntg-context
On 11/5/23 12:59, anton.chig...@mail.com wrote:
> Wow!
> This certainly is not the noobie version!
> All I wanted was to put a circle around a letter
> for emphasis.

Anton,

it works as you intend:

  \starttext
  \startusableMPgraphic{MetaCirc}
   draw fullcircle
   xyscaled
  (OverlayWidth-OverlayLineWidth,OverlayHeight-OverlayLineWidth)
   withpen pencircle scaled OverlayLineWidth
   withcolor OverlayColor ;
  \stopusableMPgraphic

  \defineoverlay[MetaCirc][\useMPgraphic{MetaCirc}]

  a\dontleavehmode\framed
 [background=MetaCirc,
  backgroundcolor=red,
  frame=off,
  location=bottom,
  rulethickness=1pt]
 {b}c
  \stoptext

Just in case it helps,

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: How to encircle text?

2023-11-05 Thread Hans Hagen via ntg-context

On 11/5/2023 7:23 AM, anton.chig...@mail.com wrote:

I want to use \bigcirc to encircle text.
Is there a way to do it.

if you're wiling to compensate for its depth:

\defineoverlay
  [BigCirc]
  [{\scale
  [width=\overlaywidth]
  {\setbox0\hpack{\bigcirc}\raise\dp0\box0}}]

\framed
  [background=BigCirc,
 % frame=off,
   width=3cm,
   height=3cm]
  {test}

but bigcirc isn't meant for that

\startusableMPgraphic{MetaCirc}
draw fullcircle
xyscaled 
(OverlayWidth-OverlayLineWidth,OverlayHeight-OverlayLineWidth)

withpen pencircle scaled OverlayLineWidth
withcolor OverlayColor ;
\stopusableMPgraphic

\defineoverlay[MetaCirc][\useMPgraphic{MetaCirc}]

\framed
  [background=MetaCirc,
   backgroundcolor=red,
   frame=off,
   rulethickness=1pt]
  {test}

\framed
  [background=MetaCirc,
   backgroundcolor=blue,
   rulethickness=.5pt]
  {test}

is more flexibel in the end

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Framed Text with Chapter Numbers as Counter

2023-09-17 Thread Jeroen
That works fine except that the following line does only issue the
sequential number and not the chapter number.

Refer to \in{code fragment}[tit1] bla

MWE:

\startuseMPgraphic{CountFrame}
  picture p; numeric w, h, o;
  p := textext.rt("\wrappedcurrentconstruction");
  w := OverlayWidth;
  h := OverlayHeight;
  o := BodyFontSize;
  p := p shifted (2o,h-ypart center p);
  draw p;
  path b;
  b := boundingbox p enlarged (o/10);
  path a;
  a := (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h);
  drawoptions (withpen pencircle scaled 1pt withcolor black);
  draw a;
  draw b;
  setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
  [CountFrame]
  [\useMPgraphic{CountFrame}]

\defineframedtext
  [CountFramedText]
  [frame=off,
   background=CountFrame,
   offset=\bodyfontsize,
   width=\textwidth,
%  style={\switchtobodyfont[11pt,tt]}]
   bodyfont=11pt,
   style={\tt}]

\defineenumeration
  [Code]
  [title=yes,
   alternative=empty,
   before=\startCountFramedText,
   after=\stopCountFramedText,
   left={\somenamedheadnumber{chapter}{current}.}]

\starttext

\startchapter
  [title=first]

\startCode
  [title={The First Title},
   reference={tit1}]
   Some verbatim text
\stopCode

\startCode
  [title={The Second Title},
   reference={tit2}]
   Some verbatim text
\stopCode

Refer to \in{code fragment}[tit1] bla

\stopchapter

\startchapter
  [title=second]

\startCode
  [title={The Third Title},
   reference={tit3}]
   Some verbatim text
\stopCode

\stopchapter

\stoptext

Op zo 17 sep 2023 om 17:31 schreef Bruce Horrocks :

>
>
> > On 16 Sep 2023, at 21:28, Jeroen  wrote:
> >
> > This MWE has a framed text for some verbatim text (code) with as title
> ref. a counter 1, 2, etc.. Is there a way to change this frame text title
> as following with the chapter number and a sequential number and the title.
>
> Amemd the \defineenumeration as follows:
>
> \defineenumeration
>   [Counter]
>   [title=yes,
>alternative=empty,
>before=\startCountFramedText,
>after=\stopCountFramedText,
>left={\somenamedheadnumber{chapter}{current}:}]
>
> —
> 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 /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Framed Text with Chapter Numbers as Counter

2023-09-16 Thread Jeroen
This MWE has a framed text for some verbatim text (code) with as title ref.
a counter 1, 2, etc.. Is there a way to change this frame text title as
following with the chapter number and a sequential number and the title.

Code Fragment 1.1 (The First Title)
Code Fragment 1.2 (The Second Title)
Code Fragment 2.1 (The Third Title)

MWE:

\startuseMPgraphic{CountFrame}
  picture p; numeric w, h, o;
  p := textext.rt("\wrappedcurrentconstruction");
  w := OverlayWidth; h := OverlayHeight; o := BodyFontSize;
p := p shifted (2o,h-ypart center p);
draw p;
path b;
b := boundingbox p enlarged (o/10);
drawoptions (withpen pencircle scaled 1pt withcolor black);
draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h);
draw b;
setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
  [CountFrame]
  [\useMPgraphic{CountFrame}]

\defineframedtext
  [CountFramedText]
  [frame=off,
   background=CountFrame,
   offset=\bodyfontsize,
   width=\textwidth,
%   style={\switchtobodyfont[11pt,tt]}]
   bodyfont=11pt,
   style={\tt},
   ]

\def\FrameTitle#1%
  {\setMPtext{CountFrame}
  {\hbox spread 1em{\hss\strut#1\hss}}}\setMPtext{CountFrame}
  {}

\defineenumeration
  [Counter]
  [title=yes,
   alternative=empty,
   before=\startCountFramedText,
   after=\stopCountFramedText]

\starttext

\startchapter
  [title=first]

\startCounter
  [title={The First Title},
   reference={tit1}]
   Some verbatim text
\stopCounter

\startCounter
  [title={The Second Title},
   reference={tit2}]
   Some verbatim text
\stopCounter

Refer to \in{code fragment}[tit1] bla

\stopchapter

\startchapter
  [title=second]

\startCounter
  [title={The Third Title},
   reference={tit3}]
   Some verbatim text
\stopCounter

\stopchapter

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

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

[NTG-context] Verbatim Textbox with Reference NUmbering

2023-09-09 Thread Jeroen
This is a longshot, but would be great to have. Below I have at MWE1 the
verbatim codefragment textbox I am using. I found in the forum MWE2 which
is a textbox with an automatic reference number. Is there a way to get the
same for MWE1 with automatic reference numbering like 1.1, 1.2 etc for
chapter 1, codefragment 1, 2 etc. with the possibility that in the text I
can refer to the codefragment like \in{codefragment\space}[code:ccpsample]
similar as to tables and figures? Thanks Jeroen


%%
% MWE1
%%

\startuseMPgraphic{mpos:par:myexample}
path p;
for i = 1 upto nofmultipars :
  p := multipars[1] topenlarged 4pt bottomenlarged 4pt cornered 2mm ;
  fill p withcolor 0.95white ;
  draw p withcolor black
  withpen pencircle scaled \MPvar{linewidth};
  endfor;
\stopuseMPgraphic

\definetextbackground
  [listingbackground]
  [state=start,
   mp=mpos:par:myexample,
   location=paragraph,
   topoffset=0.4em,
   leftoffset=0em,
   rulethickness=0.7pt]

\definetyping[Listing]
  [option=commands]

\setuptyping
  [Listing]
  [bodyfont=10pt,
   margin=1em,
   before=%
 {\blank[3*medium]
  \setupinterlinespace[line=2.4ex]
  \starttextbackground[listingbackground]},
   after=%
 {\stoptextbackground
  \blank[4*medium]},
   align={flushleft,verytolerant}]

\starttext

\startListing
this is a code example
\stopListing

\stoptext


%%
% MWE2
%%

\startuseMPgraphic{FunnyFrame}
  picture p ; numeric w, h, o ;
  p := textext.rt(\MPstring{FunnyFrame}) ;
  w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
  p := p shifted (2o,h-ypart center p) ; draw p ;
  drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
  draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
  draw boundingbox p ;
  setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][frame=off,background=FunnyFrame]
\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
\setMPtext{FunnyFrame}{}

% Add the enumeration
\defineenumeration
  [Counter]
  [text=,
   alternative=empty,
   before={\FrameTitle{Counter \getnumber[Counter]}
   \startFunnyText},
   after={\stopFunnyText}]

\starttext

\startCounter
First example
\stopCounter

\startCounter
Second example
\stopCounter

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

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

[NTG-context] Re: Equivalent of the \cancel command with conTeXt

2023-08-22 Thread Fabrice Couvreur
Hi Alexander,
Thank you for this suggestion which will do the trick.
Fabrice

Le mar. 22 août 2023 à 10:26, Alexandre Christe  a
écrit :

> Hi Fabrice,
>
> I have this from former exchanges
>
> % Cancel command for use in equations.
> \startuniqueMPgraphic{cross out}
>  picture cross;
>  cross := image(draw (0,0)--(1,1); draw (0,1)--(1,0););
>  draw cross xscaled \overlaywidth yscaled \overlayheight withpen pencircle
> scaled .8pt ;
> \stopuniqueMPgraphic
>
> \defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]
>
> \define[1]\cancel{%
>  \ifmmode
>  \mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
>  \else%
>  \framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
>  \fi%
> }
>
> Maybe something else is available nowadays.
>
> A. Christe
> Le 22 août 2023 à 12:22 +0200, Fabrice Couvreur <
> fabrice1.couvr...@gmail.com>, a écrit :
>
> Hi,
> In an algebraic expression, it is sometimes interesting to cross out
> terms. With LaTeX, there is the \cancel command from the package cancel. Is
> there an equivalent with conTeXt ?
> Thanks
> Fabrice
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : https://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: Equivalent of the \cancel command with conTeXt

2023-08-22 Thread Alexandre Christe
Hi Fabrice,

I have this from former exchanges

% Cancel command for use in equations.
\startuniqueMPgraphic{cross out}
 picture cross;
 cross := image(draw (0,0)--(1,1); draw (0,1)--(1,0););
 draw cross xscaled \overlaywidth yscaled \overlayheight withpen pencircle
scaled .8pt ;
\stopuniqueMPgraphic

\defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]

\define[1]\cancel{%
 \ifmmode
 \mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
 \else%
 \framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
 \fi%
}

Maybe something else is available nowadays.

A. Christe
Le 22 août 2023 à 12:22 +0200, Fabrice Couvreur , 
a écrit :
> Hi,
> In an algebraic expression, it is sometimes interesting to cross out terms. 
> With LaTeX, there is the \cancel command from the package cancel. Is there an 
> equivalent with conTeXt ?
> Thanks
> Fabrice
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : https://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: upload

2023-08-10 Thread Thangalin
Did arguments regress in 2023.08.10 02:59?

$ cat u.tex
\starttext
Feisty arguments
\stoptext
$ context u.tex
$  ls -la *.pdf
-rw-r--r-- 1 username username 6279 Aug 10 18:28 u.pdf
$ context --arguments=x=y u.tex | grep error
tex error   > tex error on line 13 in file : Use of \getrawparameters
doesn't match its definition
mtx-context | fatal error: return code: 1

This was working with the previous release.

On Wed, Aug 9, 2023 at 8:43 AM Hans Hagen  wrote:

> Hi,
>
> I uploaded a new lmtx. There are some new features that wil be revealed
> in the future (likely after the meeting) but here is one:
>
> \starttext
>
>  \defineoverlay
>[test]
>[\color
>   [blue]
>   {TEST
>\inframed
>  [foregroundcolor=red]
>  {xxx}
>TEST}]
>
>  \framed
>[background=test,
> foregroundstyle=\switchtobodyfont[small]]
>{test}
>
> \stoptext
>
>  From now on many commands accept (properly) nested [] inside commands
> that use [] as fences (like the setup commands) where it makes sense. It
> is up to the user to decide to use {} (as before) or not but it is less
> error prone.
>
> It is now also possible to nest setups as in
>
> \starttext
>
> \startsetups one
>  \startsetups [three]
>  HERE
>  \stopsetups
> \stopsetups
>
> \startsetups two
>  \startsetups [three]
>  THERE
>  \stopsetups
> \stopsetups
>
> \setups[one] \setups[three]
>
> \setups[two] \setups[three]
>
> \stoptext
>
> As part of the ongoing improvements on math rendering we added some
> classic lm/cm kerns (between upperacse and periods / commas) in the
> goodie files.
>
> Some lowlevel manuals have been extended, explaining experimental 'named
> cross macro nesting parameter referencing' and 'constrained cq. retained
> assignments', but that is only relevant for those interested in
> overcoming some limitations in the traditional engines.
>
> 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 /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] upload

2023-08-09 Thread Hans Hagen

Hi,

I uploaded a new lmtx. There are some new features that wil be revealed 
in the future (likely after the meeting) but here is one:


\starttext

\defineoverlay
  [test]
  [\color
 [blue]
 {TEST
  \inframed
[foregroundcolor=red]
{xxx}
  TEST}]

\framed
  [background=test,
   foregroundstyle=\switchtobodyfont[small]]
  {test}

\stoptext

From now on many commands accept (properly) nested [] inside commands 
that use [] as fences (like the setup commands) where it makes sense. It 
is up to the user to decide to use {} (as before) or not but it is less 
error prone.


It is now also possible to nest setups as in

\starttext

\startsetups one
\startsetups [three]
HERE
\stopsetups
\stopsetups

\startsetups two
\startsetups [three]
THERE
\stopsetups
\stopsetups

\setups[one] \setups[three]

\setups[two] \setups[three]

\stoptext

As part of the ongoing improvements on math rendering we added some 
classic lm/cm kerns (between upperacse and periods / commas) in the 
goodie files.


Some lowlevel manuals have been extended, explaining experimental 'named 
cross macro nesting parameter referencing' and 'constrained cq. retained 
assignments', but that is only relevant for those interested in 
overcoming some limitations in the traditional engines.


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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: enhancing MetaPost presentation progress graphics

2023-07-19 Thread Taco Hoekwater
Hi,

First, find the actual point along the curve of the wave you want, then you can 
ask for the direction of the wave at that time, and its point:

\startuseMPgraphic{Waves}
numeric height,stops,yoffset;
stops := 10;
height := OverlayHeight/10;
path wave[]; % storing waves

draw (0,0)--(OverlayWidth,0)--(OverlayWidth,OverlayHeight) withcolor white 
withpen pencircle scaled 0.01;

for j=1 upto 3:
 definecolor [name="Sea", y=(j/20), c=2*(j/10), m=(j/20)];
 yoffset := height/(j*2);
 wave[j] := (0,0)--(0,yoffset)...
 for i=1 upto stops:
   (OverlayWidth*i/(stops+1), (yoffset) randomized (height/2)) ...
 endfor
 (OverlayWidth,yoffset);
 fill ((0,0)--wave[j]--(OverlayWidth,0)--cycle) withcolor "Sea";
endfor;

xpos := OverlayWidth * RealPageNumber/NOfPages;
path ship;
ship := (0,10)---(70,10)...(60,0)---(10,0)...cycle;

pair itime, iangle, boatpos;

itime = (wave[3] intersectiontimes ((xpos,0)--(xpos,infinity)));
iangle = direction (xpart itime) of wave[3];
boatpos = (point (xpart itime) of wave[3]) shifted (-5,0); % shift to center 
horizontally

fill ship xysized (10,5) shifted boatpos rotatedaround (boatpos, angle iangle) 
withcolor red;
\stopuseMPgraph

> On 19 Jul 2023, at 12:32, Henning Hraban Ramm  wrote:
> 
> Hi,
> I’d like a presentation progress indicator that looks like a boat on waves – 
> and if it works, it can also become a bike on hills or a mars rover on dunes. 
> But my math skills are lacking.
> 
> Below’s a mostly working draft.
> 
> * I find the waves not yet very convincing. Would it make sense to use a 
> randomized sinus? (How?)
> 
> * The boat should sit on the middle wave and be rotated by the current slope. 
> I know I need the “time” of the upper curve and get the 1st derivation, but 
> how?
> 
> """
> \setuppapersize[SW]
> 
> \startuseMPgraphic{Waves}
> numeric height,stops,yoffset;
> stops := 10;
> height := OverlayHeight/10;
> path wave;
> 
> draw (0,0)--(OverlayWidth,0)--(OverlayWidth,OverlayHeight) withcolor white 
> withpen pencircle scaled 0.01;
> 
> for j=1 upto 3:
>  definecolor [name="Sea", y=(j/20), c=2*(j/10), m=(j/20)];
>  yoffset := height/(j*2);
>  wave := (0,0)--(0,yoffset)...
>  for i=1 upto stops:
>(OverlayWidth*i/(stops+1), (yoffset) randomized (height/2)) ...
>  endfor
>  (OverlayWidth,yoffset)--(OverlayWidth,0)--cycle;
>  fill wave withcolor "Sea";
> endfor;
> 
> pair pos;
> pos := (OverlayWidth * RealPageNumber/NOfPages, height/2 randomized 2);
> path ship;
> ship := (0,10)---(70,10)...(60,0)---(10,0)...cycle;
> 
> fill ship xysized (10,5) shifted pos rotatedaround (pos, 15) withcolor red;
> \stopuseMPgraphic
> 
> \defineoverlay[Waves][\useMPgraphic{Waves}]
> 
> \setupbackgrounds[state=repeat]
> \setupbackgrounds[page][background={Waves}]
> 
> \starttext
> 
> \dorecurse{10}{\recurselevel\page}
> 
> \stoptext
> """
> 
> Hraban
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___


— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)


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

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

[NTG-context] enhancing MetaPost presentation progress graphics

2023-07-19 Thread Henning Hraban Ramm

Hi,
I’d like a presentation progress indicator that looks like a boat on 
waves – and if it works, it can also become a bike on hills or a mars 
rover on dunes. But my math skills are lacking.


Below’s a mostly working draft.

* I find the waves not yet very convincing. Would it make sense to use a 
randomized sinus? (How?)


* The boat should sit on the middle wave and be rotated by the current 
slope. I know I need the “time” of the upper curve and get the 1st 
derivation, but how?


"""
\setuppapersize[SW]

\startuseMPgraphic{Waves}
numeric height,stops,yoffset;
stops := 10;
height := OverlayHeight/10;
path wave;

draw (0,0)--(OverlayWidth,0)--(OverlayWidth,OverlayHeight) withcolor 
white withpen pencircle scaled 0.01;


for j=1 upto 3:
  definecolor [name="Sea", y=(j/20), c=2*(j/10), m=(j/20)];
  yoffset := height/(j*2);
  wave := (0,0)--(0,yoffset)...
  for i=1 upto stops:
(OverlayWidth*i/(stops+1), (yoffset) randomized (height/2)) ...
  endfor
  (OverlayWidth,yoffset)--(OverlayWidth,0)--cycle;
  fill wave withcolor "Sea";
endfor;

pair pos;
pos := (OverlayWidth * RealPageNumber/NOfPages, height/2 randomized 2);
path ship;
ship := (0,10)---(70,10)...(60,0)---(10,0)...cycle;

fill ship xysized (10,5) shifted pos rotatedaround (pos, 15) withcolor red;
\stopuseMPgraphic

\defineoverlay[Waves][\useMPgraphic{Waves}]

\setupbackgrounds[state=repeat]
\setupbackgrounds[page][background={Waves}]

\starttext

\dorecurse{10}{\recurselevel\page}

\stoptext
"""

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

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

[NTG-context] Re: MP setup for a progress bar

2023-07-04 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 04.07.2023 um 22:24:

Thanks to Taco, Robbert and Jules for their work!


I used the downtime to setup a presentation style with a progress bar 
in the footer. But I get the same (first page) graphics on all pages, 
and the footer background appears under the text area as well as under 
the margins.


* I thought \useMPgraphics would be enough to re-calculate on every page?
* How can I set a background to the footer area, but page width?
* I tried \overlaywidth as well as OverlayWidth in the MP graphic – 
how do I get the page size?


You need \setupbackgrounds[state=repeat].

\setuppapersize[SW]

\startuseMPgraphic{Blocks}
fill unitsquare xysized (OverlayWidth * PageNumber / LastPageNumber, 
OverlayHeight) withcolor blue;

%setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay[Blocks][\useMPgraphic{Blocks}]

\setupbackgrounds[state=repeat]

\setupbackgrounds[footer][text][background=Blocks]

\starttext

\dorecurse{10}{\recurselevel\page}

\stoptext

Wolfgang

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

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

[NTG-context] MP setup for a progress bar

2023-07-04 Thread Henning Hraban Ramm

Thanks to Taco, Robbert and Jules for their work!


I used the downtime to setup a presentation style with a progress bar in 
the footer. But I get the same (first page) graphics on all pages, and 
the footer background appears under the text area as well as under the 
margins.


* I thought \useMPgraphics would be enough to re-calculate on every page?
* How can I set a background to the footer area, but page width?
* I tried \overlaywidth as well as OverlayWidth in the MP graphic – how 
do I get the page size?


"""
\setuppapersize[SW]

\startuseMPgraphic{Blocks}
fill unitsquare xysized (800 * RealPageNumber/NOfPages, 50) withcolor blue;
\stopuseMPgraphic

\defineoverlay[Blocks][\useMPgraphic{Blocks}]

\setupbackgrounds[footer][background={Blocks}]

\starttext

\dorecurse{10}{\recurselevel\page}

\stoptext
"""

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

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

[NTG-context] viewer layers (optional content groups, OCG)

2023-06-19 Thread Henning Hraban Ramm via ntg-context

Checking viewer layers:

* \setupviewerlayer doesn’t work; e.g. "state=stop" only works if I put 
it in \defineviewerlayer

* visible=no has no effect
* what are the options tag/name supposed to do?
(https://wiki.contextgarden.net/Viewer_Layers)
* known problem: only Acrobat supports JS to control OCGs 
(\overlayrollbutton in the MWE)


Hraban


\setupinteraction[state=start]% needed for JS

\defineviewerlayer[Gebuesch][
  state=stop,
]
\defineviewerlayer[Versteck]
\setupviewerlayer[Versteck][ % doesn’t work
  state=stop,
]

\starttext
Hier fängt der Wald an.

\startviewerlayer[Gebuesch]
Hier versteckt sich ein Wolf...
\stopviewerlayer

Bäume, Bäume, Bäume...

\viewerlayer[Gebuesch]{... und ein Rotkehlchen}

\startviewerlayer[Versteck]Rumpelwicht\stopviewerlayer

\defineoverlay[MitVersteck]
[{\overlayrollbutton[VideLayer{Versteck}][HideLayer{Versteck}]}]

\framed[background=MitVersteck]{Kummst du mul kuckn?}

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

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


Re: [NTG-context] Problem with \setuplayout parameters being ignored

2023-03-05 Thread Keith McKay via ntg-context
Many thanks Wolfgang. Useful tips indeed.
Best Wishes
Keith McKay

On Sun, 5 Mar 2023, 17:24 Wolfgang Schuster, <
wolfgang.schuster.li...@gmail.com> wrote:

> Keith McKay schrieb am 05.03.2023 um 18:10:
> >
> > Thank you so much Wolfgang! I should have realised that. It's what I
> > get for trying to write readable code.
> >
> You can use the = to align keys and values, e.g.
>
> \setuplayout
>[backspace=2.5cm,
>margin=0.5cm,
> width=16cm,
>header=1cm,
>footer=1cm]
>
> Another useful method is to put large settings into a setups-blocks and
> pass the block to a setup-command.
>
> \startsetups [apage]
> \startMPcode
> StartPage;
> ...
> StopPage;
> \stopMPcode
> \stopsetups
>
> \defineoverlay[apage][\directsetup{apage}]
>
> Wolfgang
>
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Problem with \setuplayout parameters being ignored

2023-03-05 Thread Wolfgang Schuster via ntg-context

Keith McKay schrieb am 05.03.2023 um 18:10:


Thank you so much Wolfgang! I should have realised that. It's what I 
get for trying to write readable code.



You can use the = to align keys and values, e.g.

\setuplayout
  [backspace=2.5cm,
  margin=0.5cm,
   width=16cm,
  header=1cm,
  footer=1cm]

Another useful method is to put large settings into a setups-blocks and 
pass the block to a setup-command.


\startsetups [apage]
\startMPcode
StartPage;
...
StopPage;
\stopMPcode
\stopsetups

\defineoverlay[apage][\directsetup{apage}]

Wolfgang

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

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


[NTG-context] Problem with \setuplayout parameters being ignored

2023-03-05 Thread Keith McKay via ntg-context

Hi

I'm having a strange problem with the \setuplayout command with the 
parameters being ignored. In the code below the only parameter which 
does get setup is the backspace parameter, the header, footer, width, 
and margin parameters are setup differently according to the log. I'm 
probably missing something fairly obvious so hints would be helpful. The 
document I'm trying to setup will probably be a maximum of 50 pages and 
I would like to reduce the space at the top and bottom of the page.


Best Wishes

Keith McKay

% Code so far %%%

\setuppapersize[A4]

\setuplayout[

backspace = 2.5cm,

margin = 0.5cm,

width = 16cm,

header = 1cm,

footer = 1cm,

]

\setupbackgrounds[state=repeat]

\defineoverlay[apage][

{\startMPcode

StartPage;

definecolor[ name = "MyColor1", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1) ] ;


definecolor[ name = "MyColor2", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1) ] ;


draw lmt_shade [

path = Page,

direction = "down",

alternative = "linear",

colors = { "MyColor2", "MyColor1" },

] ;

draw lmt_shade [

path = Field[Text][Text],

direction = "down",

alternative = "linear",

colors = { "MyColor1", "MyColor2" },

] ;

StopPage;

\stopMPcode}

]

\showframe

\setupbackgrounds[page][background=apage]

\setupbackgrounds[footer][text] [background=color, backgroundcolor=blue]

\setupbackgrounds[header][text] [background=color, backgroundcolor=red]

\setuppagenumbering[state=start,alternative=doublesided,location=footer]

\showlayout

\starttext

\showsetups

\dorecurse{10}{

Page \recurselevel

\page

}

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

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


Re: [NTG-context] Chapter title in MetaFun manual.

2023-02-10 Thread Jeong Dal via ntg-context
Dear all,
 
I think that I found the cause.
The page layout of my file is different from that of MetaFun manual.
After borrowing the \setuplayout from MetaFun-000.tex, it works correctly.

I am sorry to give you a wrong example.

Thank you for reading.

Best regards,

Dalyoung


> 2023. 2. 10. 오후 9:05, Jeong Dal via ntg-context  작성:
> 
> Dear all,
> 
> I copied the code of defining chapter command  from metafun-000.tex, and run 
> it.
> But the result is different from that in MetaFun Manual.
> There is a big spaces between the number and the title which yields the 
> number cannot be seen.
> I commented out several lines which seems to be not-related with chapter 
> title.
> And, I changed
> 
>   \def\ChapterCommand#1#2% —> \define[2]\ChapterCommand
> 
> Would you please test the following code to find out what is wrong?
> 
> Thank you for reading.
> 
> Best regards,
> 
> Dalyoung
> 
> 
> \startuseMPgraphic{circled}
>   pickup pencircle scaled 1mm ;
>   drawoptions(withcolor (.6+uniformdeviate.35)*white) ;
>   fill fullcircle xscaled 1.5cm yscaled 1cm ;
>   drawoptions(withcolor .625yellow) ;
>   draw fullcircle xscaled 1.5cm yscaled 1cm ;
> \stopuseMPgraphic
> 
> %\startnotmode[proof]
> %  \defineoverlay[circled][\useMPgraphic{circled}]
> %\stopnotmode
> 
> \define[1]\Circled%
>   {\framed
>  [background=circled,frame=off,offset=overlay]
>  {\color[darkred]{#1}}}
> 
> \setuppagenumbering[location=]
> \setupheadertexts[margin][][\hbox to \hsize{\hss\Circled\pagenumber\hss}]
> 
> \startuniqueMPgraphic{titled}
>   path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
>   pickup pencircle scaled 1mm ;
>   drawoptions(withcolor .625yellow) ;
>   draw llcorner p -- lrcorner p ;
>   setbounds currentpicture to p ;
> \stopuniqueMPgraphic
> 
> \defineoverlay[titled][\uniqueMPgraphic{titled}]
> 
> \define[2]\ChapterCommand%
>   {\setbox0=\hbox to \leftmarginwidth{#1\hss}%
>\hskip-\leftmarginwidth
>\hskip-\leftmargindistance
>\framed
>  [background=titled,frame=off,offset=0pt]
>  {\box0
>   \hskip\leftmargindistance
>   #2}}
> 
> \define[2]\TitleCommand%
>   {\framed
>  [background=titled,frame=off,offset=0pt]
>  {#2}}
> 
> \setuphead
>   [chapter]%,section,subsection]
>   [command=\ChapterCommand,
>style=\ss\bf\tfd,
>color=darkred]
> 
> \setuphead
>   [title]%,subject,sububject]
>   [command=\TitleCommand,
>style=\ss\bf\tfd,
>color=darkred]
> 
> 
> \setupbodyfont[bonum,rm,12pt]
> \showframe
> 
> \starttext
> \startchapter[title={Introduction}]
> This is the chapter for introduction.
> \stopchapter
> 
> \startchapter[title={Function}]
> Now, we study the function.
> \stopchapter
> 
> \starttitle[title={References}]
> \startitemize[n]
> \item first
> \item second
> \item third
> \stopitemize
> \stoptitle
> 
> \stoptext
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


[NTG-context] Chapter title in MetaFun manual.

2023-02-10 Thread Jeong Dal via ntg-context
Dear all,

I copied the code of defining chapter command  from metafun-000.tex, and run it.
But the result is different from that in MetaFun Manual.
There is a big spaces between the number and the title which yields the number 
cannot be seen.
I commented out several lines which seems to be not-related with chapter title.
And, I changed

\def\ChapterCommand#1#2% —> \define[2]\ChapterCommand

Would you please test the following code to find out what is wrong?

Thank you for reading.

Best regards,

Dalyoung


\startuseMPgraphic{circled}
  pickup pencircle scaled 1mm ;
  drawoptions(withcolor (.6+uniformdeviate.35)*white) ;
  fill fullcircle xscaled 1.5cm yscaled 1cm ;
  drawoptions(withcolor .625yellow) ;
  draw fullcircle xscaled 1.5cm yscaled 1cm ;
\stopuseMPgraphic

%\startnotmode[proof]
%  \defineoverlay[circled][\useMPgraphic{circled}]
%\stopnotmode

\define[1]\Circled%
  {\framed
 [background=circled,frame=off,offset=overlay]
 {\color[darkred]{#1}}}

\setuppagenumbering[location=]
\setupheadertexts[margin][][\hbox to \hsize{\hss\Circled\pagenumber\hss}]

\startuniqueMPgraphic{titled}
  path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
  pickup pencircle scaled 1mm ;
  drawoptions(withcolor .625yellow) ;
  draw llcorner p -- lrcorner p ;
  setbounds currentpicture to p ;
\stopuniqueMPgraphic

\defineoverlay[titled][\uniqueMPgraphic{titled}]

\define[2]\ChapterCommand%
  {\setbox0=\hbox to \leftmarginwidth{#1\hss}%
   \hskip-\leftmarginwidth
   \hskip-\leftmargindistance
   \framed
 [background=titled,frame=off,offset=0pt]
 {\box0
  \hskip\leftmargindistance
  #2}}

\define[2]\TitleCommand%
  {\framed
 [background=titled,frame=off,offset=0pt]
 {#2}}

\setuphead
  [chapter]%,section,subsection]
  [command=\ChapterCommand,
   style=\ss\bf\tfd,
   color=darkred]

\setuphead
  [title]%,subject,sububject]
  [command=\TitleCommand,
   style=\ss\bf\tfd,
   color=darkred]


\setupbodyfont[bonum,rm,12pt]
\showframe

\starttext
\startchapter[title={Introduction}]
This is the chapter for introduction.
\stopchapter

\startchapter[title={Function}]
Now, we study the function.
\stopchapter

\starttitle[title={References}]
\startitemize[n]
\item first
\item second
\item third
\stopitemize
\stoptitle

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

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


Re: [NTG-context] Is this possible to do the same

2022-12-12 Thread Ursula Hermann via ntg-context
Dear Gavin!
Many thanks for your Mail.

Uschi

Von: ntg-context  im Auftrag von Gavin via 
ntg-context 
Gesendet: Montag, 12. Dezember 2022 16:48:52
An: mailing list for ConTeXt users
Cc: Gavin
Betreff: Re: [NTG-context] Is this possible to do the same

Hi Uschi,

I use the MetaFun features of ConTeXt to cross out stuff.

% Cancel command for use in equations.
\startuniqueMPgraphic{cross out}
  picture cross;
  cross := image(draw (0,0)--(1,1); draw (0,1)--(1,0););
  draw cross xscaled \overlaywidth yscaled \overlayheight withpen pencircle 
scaled .8pt ;
\stopuniqueMPgraphic

\defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]

\define[1]\cancel{%
  \ifmmode
\mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
  \else%
\framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
  \fi%
}

\starttext

\dots E.g.~$\cancel{x+ {-x}}$. Works in \cancel{text}, too.

\stoptext

I do not have all of the features of the “cancel” package, but it works for a 
simple cross out. Change the MetaPost code to a single slash, if that is what 
you want, by removing either one of the draw commands.

Hope that helps. If you need more features, I’d might be able to help you 
implement them.

Gavin


> On Dec 12, 2022, at 8:21 AM, Ursula Hermann via ntg-context 
>  wrote:
>
> Dear List!
>  Sorry, but my pdf was too big.
> So I send a little picture. I would like to know, if there is a 
> modus in ConTeXt like the same in LaTeX. I found this on page 108,  Chapter 3 
> Math symbos LaTeX Compherensive list.
> Many thanks
> Uschi  
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___


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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Is this possible to do the same

2022-12-12 Thread Gavin via ntg-context
Hi Uschi,

I use the MetaFun features of ConTeXt to cross out stuff.

% Cancel command for use in equations.
\startuniqueMPgraphic{cross out}
  picture cross;
  cross := image(draw (0,0)--(1,1); draw (0,1)--(1,0););
  draw cross xscaled \overlaywidth yscaled \overlayheight withpen pencircle 
scaled .8pt ;
\stopuniqueMPgraphic

\defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]

\define[1]\cancel{%
  \ifmmode
\mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
  \else%
\framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
  \fi%
}

\starttext

\dots E.g.~$\cancel{x+ {-x}}$. Works in \cancel{text}, too.

\stoptext

I do not have all of the features of the “cancel” package, but it works for a 
simple cross out. Change the MetaPost code to a single slash, if that is what 
you want, by removing either one of the draw commands.

Hope that helps. If you need more features, I’d might be able to help you 
implement them.

Gavin


> On Dec 12, 2022, at 8:21 AM, Ursula Hermann via ntg-context 
>  wrote:
> 
> Dear List!
>  Sorry, but my pdf was too big.
> So I send a little picture. I would like to know, if there is a 
> modus in ConTeXt like the same in LaTeX. I found this on page 108,  Chapter 3 
> Math symbos LaTeX Compherensive list.
> Many thanks
> Uschi  
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___


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

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


Re: [NTG-context] Backgrounds has changed in latest lmtx

2022-10-23 Thread Thomas A. Schmitz via ntg-context

Here comes another one that works with the switch --luatex but not in lmtx:

\setuppapersize[A6,landscape][A6,landscape]

\startuseMPgraphic{ornament}
StartPage ;

save diff ;numeric diff;
diff = .3cm ;

save w; numeric w;
w = xpart (lrcorner Field[Text][Text] - llcorner Field[Text][Text]) - diff ;

save factor; numeric factor;
if NOfPages <= 1 :
  factor = w ;
else :
  factor = w/(NOfPages - 1) ;
fi ;

save p; path p ;
p = unitsquare xyscaled (diff,diff)
   shifted (xpart llcorner Field[Text][Text],0.85cm) ;

for i = 1 upto NOfPages:
  if RealPageNumber = i:
fill p xyscaled (0,2) shifted ( (i-1)*factor,-diff-0.85cm)
 withcolor blue ;
  else :
fill p shifted ( (i-1)*factor, 0)
 withcolor red ;
  fi ;
endfor ;
StopPage ;
\stopuseMPgraphic

\defineoverlay
  [Ornament]
  [\useMPgraphic{ornament}]

\setupbackgrounds[page]
 [state=repeat,
  background={Ornament}]

\starttext

\dorecurse {10} {Test \page}

\stoptext

All best

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

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


Re: [NTG-context] Backgrounds has changed in latest lmtx

2022-10-21 Thread Otared Kavian via ntg-context
Hi Thomas,

Your example does indeed show the issue I had reported on with Simpleslides: 
the backgrounds of the slides are not as expected.
So it seems that beginning with version 2022-10-15 something has changed with 
Metapost or the background mechanism.

Best regards: Otared

> On 21 Oct 2022, at 11:32, Thomas A. Schmitz via ntg-context 
>  wrote:
> 
> Hi everybody,
> 
> With the latest lmtx, my page backgrounds don’t work any more. I think Otared 
> mentioned that the simpleslides module is having problems. I’m trying to 
> figure out what is happening, but I don’t see any warnings or errors, just 
> unexpected results (which is not a good thing). I’m starting with the 
> fundamentals. Here is a fairly minimal example: compile with context --luatex 
> to see the expected result and with lmtx to see what is wrong.
> 
> All best
> 
> Thomas
> 
> \setuppapersize[A6,landscape][A6,landscape]
> 
> \setuplayout[backspace=1cm,
> topspace=0.4cm,
> marking=off,
> width=13cm,
> height=9.7cm,
> header=0.6cm,
> footer=0cm,
> ]
> 
> \startreusableMPgraphic{card}
> StartPage ;
> save p ; path p[] ;
> p[0] = ulcorner Page -- urcorner Page ;
> p[0] := p[0] shifted (0, -0.97cm) ;
> for i = 1 upto 18 :
>   p[i] = p[i-1] shifted (0, -14.42pt) ;
>   draw p[i] withcolor (0.5,0.5,0.5) ;
> endfor ;
> pickup pencircle scaled 2pt ;
> draw p[0] withcolor red ;
> StopPage ;
> \stopreusableMPgraphic
> 
> \defineoverlay[Card][\reuseMPgraphic{card}]
> 
> \setupbackgrounds[page]
>[state=repeat,
> background={Card}]
> 
> \starttext
> 
> Test
> 
> \stoptext
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

Otared Kavian
e-mail: ota...@gmail.com
Phone: +33 6 88 26 70 95



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

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


[NTG-context] Backgrounds has changed in latest lmtx

2022-10-21 Thread Thomas A. Schmitz via ntg-context
Hi everybody,

With the latest lmtx, my page backgrounds don’t work any more. I think Otared 
mentioned that the simpleslides module is having problems. I’m trying to figure 
out what is happening, but I don’t see any warnings or errors, just unexpected 
results (which is not a good thing). I’m starting with the fundamentals. Here 
is a fairly minimal example: compile with context --luatex to see the expected 
result and with lmtx to see what is wrong.

All best

Thomas

\setuppapersize[A6,landscape][A6,landscape]

\setuplayout[backspace=1cm,
 topspace=0.4cm,
 marking=off,
 width=13cm,
 height=9.7cm,
 header=0.6cm,
 footer=0cm,
]

\startreusableMPgraphic{card}
StartPage ;
save p ; path p[] ;
p[0] = ulcorner Page -- urcorner Page ;
p[0] := p[0] shifted (0, -0.97cm) ;
for i = 1 upto 18 :
p[i] = p[i-1] shifted (0, -14.42pt) ;
draw p[i] withcolor (0.5,0.5,0.5) ;
endfor ;
pickup pencircle scaled 2pt ;
draw p[0] withcolor red ;
StopPage ;
\stopreusableMPgraphic

\defineoverlay[Card][\reuseMPgraphic{card}]

\setupbackgrounds[page]
 [state=repeat,
  background={Card}]

\starttext

Test

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

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


[NTG-context] Perceptrons

2022-10-16 Thread Thangalin via ntg-context
et_c, offset_r)
  withcolor colour_base
  withpen pencircle
  scaled vertex_sm;
  );
endfor;
  endfor;
endfor;
  );

  % Create the perceptron matrix.
  lua( "ud.graph = tree( " &
decimal( GRID_C ) &
", " &
decimal( GRID_R ) &
", " &
decimal( PATHWAYS ) &
")"
  );

  edges := lua( "ud.count( ud.graph )" );

  for i := 1 upto edges:
lua( "va = ud.vertex_a( ud.graph, " & decimal( i ) & ")" );
lua( "vb = ud.vertex_b( ud.graph, " & decimal( i ) & ")" );

vac := lua( "va[1]" );
var := lua( "va[2]" );
vbc := lua( "vb[1]" );
vbr := lua( "vb[2]" );

offset_ac := vac * 3 / WIDTH;
offset_ar := var * HEIGHT - (vac mod 2 * HHEIGHT);
offset_bc := vbc * 3 / WIDTH;
offset_br := vbr * HEIGHT - (vbc mod 2 * HHEIGHT);

% Draw a large nodes at the starting/ending coordinates.
addto perceptrons also image(
  draw (offset_ac, offset_ar)
withcolor colour_node
withpen pencircle
scaled vertex_lg;

  draw (offset_bc, offset_br)
withcolor colour_node
withpen pencircle
scaled vertex_lg;
);

addto perceptrons also image(
  numeric vangle;
  numeric vc;
  numeric vr;
  numeric sc;
  numeric sr;

  vi := round( degrees( atantwo( vac, var, vbc, vbr ) ) / 60 );

  % Compute direction towards the first segment (to vertex of an edge).
  vangle := vi * 60 * pi / 180;

  % Calculate the position of the first vertex, offset from the center.
  vc := offset_ac + cos( vangle );
  vr := offset_ar + sin( vangle );

  % Draw a line from the starting point to the subsequent vertex.
  addto connections also image(
draw (offset_ac, offset_ar) -- (vc, vr)
  withcolor colour_edge;
  );

  iterations := 1;

  forever:
% Draw a circle at the subsequent vertex.
draw (vc, vr)
  withcolor colour_node
  withpen pencircle
  scaled
if round( uniformdeviate( 3 ) ) = 0: vertex_lg else: vertex_sm; fi;

%  2  _   1
%  3 / \  0
% -2 \_/ -1
%
% Determine the next vertex based on smallest angle of the
% three possible vertices with respect to the line.
start := if (vi mod 2) == 1: -1 else: -2 fi;

% Ensure that at least one vertex will be selected.
nearest := infinity;

for k = start step 2 until 3:
  kangle := k * 60 * pi / 180;

  nc := vc + cos( kangle );
  nr := vr + sin( kangle );
  d := distance( offset_bc, offset_br, nc, nr );

  if d < nearest:
nearest := d;
sc := nc;
sr := nr;
vi := k + 1;
  fi;
endfor;

d := distance( offset_bc, offset_br, sc, sr );
iterations := iterations + 1;

if (d <= 1) and (iterations > 2) and (iterations mod 2 = 0):
  draw (sc, sr)
withcolor colour_node
withpen pencircle
scaled vertex_sm;
fi;

exitif (d <= 1);

addto connections also image(
  draw (vc, vr) -- (sc, sr)
withcolor colour_edge
withpen pencircle
scaled 0.05bp;
);

vc := sc;
vr := sr;
  endfor;

  if (d < 1) and (iterations > 2):
draw (sc, sr)
  withcolor colour_node
  withpen pencircle
  scaled vertex_sm;
  fi;

  addto connections also image(
draw (offset_bc, offset_br) -- (vc, vr)
  withcolor colour_edge
  withpen pencircle
  scaled 0.05bp;
  );
);
  endfor;

  draw hexgrid scaled SCALE;
  draw vertices scaled SCALE;
  draw connections scaled SCALE;
  draw perceptrons scaled SCALE;
\stopuseMPgraphic

\startuseMPgraphic{HexGridBgGraphic}
  % Define the grid background colour
  color gridback;
  gridback := (0.15, 0.18, 0.24);

  fill unitsquare
xyscaled (OverlayWidth, OverlayHeight)
withcolor gridback;
\stopuseMPgraphic

\defineoverlay[HexGridBaseGraphic][\uniqueMPgraphic{HexGridBaseGraphic}]
\defineoverlay[HexGridBgGraphic][\uniqueMPgraphic{HexGridBgGraphic}]

\setupbackgrounds[page][background={HexGridBaseGraphic}]

\starttext
  \startalignment[middle]
\color[white]{GRID}
  \stopalignment
\stoptext

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

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


Re: [NTG-context] startTEXpage on A4

2022-10-10 Thread Willi Egger via ntg-context
I would suggest the approach of Wolfgang because the standard setting of 
\framed(texts)’ width is fit and the height setting can be changed to this too. 
Further I would suggest to use an overlay and a Metafun graphic for the 
cut-indicators.


\defineoverlay[Cutpointstight][\useMPgraphic{Cutpointstight}]

\startuniqueMPgraphic{Cutpointstight}
path p;
p := unitsquare xscaled OverlayWidth yscaled OverlayHeight;
draw ulcorner p;
draw urcorner p;
draw llcorner p;
draw lrcorner p;
\stopuniqueMPgraphic

\framedtext
[height=fit,
 align={lohi,center},
 background=Cutpointstight,
 foregroundcolor=black,
 frame=off,
 offset=3pt]
{{\tfa HALITGARII EPISCOPI
 \blank[small]
 De vitiis et virtutibus
 \blank[small]
 Ordinum Poenitentium}
\blank[small]
Libri V.}

I hope this solves your issue

Willi
> On 9 Oct 2022, at 20:49, Leah Neukirchen via ntg-context  
> wrote:
> 
> Hans Hagen via ntg-context  writes:
> 
>> On 10/9/2022 3:52 PM, Leah Neukirchen via ntg-context wrote:
>>> Wolfgang Schuster via ntg-context  writes:
>>> 
>>>> Leah Neukirchen via ntg-context schrieb am 09.10.2022 um 15:19:
>>>>> Hi,
>>>>> 
>>>>> is there a way to have something like
>>>>> 
>>>>> \setuppapersize[A5][A4]
>>>>> 
>>>>> but have the "inner paper size" be a computed fit like in
>>>>> \startTEXpage?
>>>>> 
>>>>> Or, alternatively, is there is a way to print crop marks around
>>>>> an environment like \startTEXpage?
>>>> 
>>>> Can you be more concrete what your goal is, there are a few ways to solve
>>>> your problem but with a few more information we can give you a good
>>>> solution.
>>> Say I want to print some stickers or paper strips of non-fixed size,
>>> and get crop marks around them to know where to cut.
>>> With \setuppapersize and \setuparranging I can do this nicely if I
>>> know the size in advance, but in some cases I don't.
>> 
>> \definepapersize
>>  [label]
>>  [width=6cm,
>>   height=25mm]
> 
> But that requires knowing the size in advance.  Think of the labels in
> a museum that depend how long the description is. ;)
> 
> -- 
> Leah Neukirchenhttps://leahneukirchen.org/
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

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

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


[NTG-context] \startcolumnset ... \stopcolumnset is working.

2022-09-14 Thread Jeong Dal via ntg-context
Dear all,

I didn’t test “\startcolumnset … \stopcolumnset” for some time, because I got 
error whenever I tested it under Mac OS Big Sur. 

However, two days ago, I tested it, and found that it was working.
I install updated version today and run a test file again.
Finally, I get an output without error!

I don't know what is happened, but it is a good news.

Here is a sample file which I simplified one that is given by one of the 
experts.
Someone may modify it better.

Thanks to ConTeXt team.

Best regards,

Dalyoung


\startuseMPgraphic{squareBox}
   draw topboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
   draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
   draw rightboundary OverlayBox shifted (1mm,0); 
   draw leftboundary OverlayBox shifted (-1mm,0); 
\stopuseMPgraphic
\defineoverlay
  [headerBox]
  [\useMPgraphic{squareBox}]

\startuseMPgraphic{verticalrule3}
   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: 
shifted(-2mm,0) fi ;
   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: 
shifted(2mm,0) fi ;  
   draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
 \stopuseMPgraphic

\defineoverlay
  [verticalrule]
  [\useMPgraphic{verticalrule3}]

\definecolumnset
  [exam]
  [n=2,
   background=verticalrule]


\setuplayout[width=19cm, height=26cm, header=1cm, footer=.5cm,backspace=1cm]
\setupheader[before=\vfil, after=\vfil]
\setupbackgrounds[header][text][frame=off, background=headerBox, 
align=lohi]%topframe=
\setupbackgrounds[footer][text][frame=off, background=screen]

\define[3]\headTitle{\setupheadertexts[][\bf #1  \hfill #2  \hfill #3  \hfill 
ID:  \hskip 2cm Name: \hskip 2cm]}

\setupmathematics[autopunctuation=no, integral=nolimits]
\setupbodyfont[rm,10pt]
\setuppagenumbering[location=footer]
\setupcolors[state=start]
%\setupexternalfigure[directory={/Users/graph/Documents/figures,}]

\headTitle{2021. 12. 12.}{Set Theory}{Final Exam}

\starttext

\startcolumnset[exam]

\startitemize[n]
  \item The first problem.
  \column

  \item The second problem.
  \column

  \item The third problem.
  \column
  \item The third problem.


\stopitemize
\stopcolumnset

\stoptext

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

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


Re: [NTG-context] image with rounded corners

2022-08-12 Thread Wolfgang Schuster via ntg-context

Henning Hraban Ramm via ntg-context schrieb am 12.08.2022 um 10:57:

Hi, can ConTeXt make rounded image corners?
Both of my approaches don’t work:


\externalfigure[mill][
  width=3cm,
  frame=on,
  corner=round,radius=1cm,
  backgroundcorner=round,backgroundradius=1cm,
]

\defineoverlay[Mill][{%
  \externalfigure[mill][width=\overlaywidth]
}]
\framed[background=Mill,width=3cm,height=4cm,
corner=round,radius=1cm,
backgroundcorner=round,backgroundradius=1cm,
offset=overlay]{}


\setupexternalfigures[location=default]

\starttext

\startMPclip{rounded corner}
clip currentpicture to (roundedsquare(OverlayWidth,OverlayHeight,EmWidth));
\stopMPclip

\clip[nx=1,ny=1,mp=rounded corner]{\externalfigure[mill]}

\stoptext

Wolfgang

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

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


[NTG-context] image with rounded corners

2022-08-12 Thread Henning Hraban Ramm via ntg-context

Hi, can ConTeXt make rounded image corners?
Both of my approaches don’t work:


\externalfigure[mill][
  width=3cm,
  frame=on,
  corner=round,radius=1cm,
  backgroundcorner=round,backgroundradius=1cm,
]

\defineoverlay[Mill][{%
  \externalfigure[mill][width=\overlaywidth]
}]
\framed[background=Mill,width=3cm,height=4cm,
corner=round,radius=1cm,
backgroundcorner=round,backgroundradius=1cm,
offset=overlay]{}

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

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


Re: [NTG-context] MP scratch counter

2022-07-13 Thread Hans Hagen via ntg-context

On 7/13/2022 8:14 PM, Henning Hraban Ramm via ntg-context wrote:

Hi y’all,
this is a scratch counter from the simpleslides module. It doesn’t work 
any more (always shows max-1), and I guess it used to.

What’s wrong?

Hraban


"""
\startuseMPgraphic{MP:ornament}
StartPage ;

save a,b ;
numeric a,b ;
a = 7mm ;
b = PaperWidth/2 - NOfPages * 2.5pt ;

save p,q; path p,q ;
p =((0,5mm)    -- (1mm,11mm)) shifted (b,0) ;
q =((-8mm,5mm) -- (0,11mm)  ) shifted (b,0) ;

pickup pencircle scaled 3pt ;
for i := NOfPages-1 downto 1:
   draw (if i mod 5 = 0 : q else : p fi)
    shifted (i*5pt, 0pt)
    withcolor if i < PageNumber : red
  else :  black
  fi ;
endfor ;
StopPage ;
\stopuseMPgraphic

\defineoverlay[background:ornament][\useMPgraphic{MP:ornament}]
\setupbackgrounds[page][background={background:ornament}]

\setupbodyfont[ss,18pt]

\starttext

\dorecurse{10}{
   \strut\par
   \page
}

\stoptext

in mlib-int.lmt change this:

registerdirect("PageNumber",   function() return 
getcount("userpageno")end)


(beware it's there twice - i'll fix that)

btw, normally you would use RealPageNumber for such a counter

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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] MP scratch counter

2022-07-13 Thread Henning Hraban Ramm via ntg-context

Hi y’all,
this is a scratch counter from the simpleslides module. It doesn’t work 
any more (always shows max-1), and I guess it used to.

What’s wrong?

Hraban


"""
\startuseMPgraphic{MP:ornament}
StartPage ;

save a,b ;
numeric a,b ;
a = 7mm ;
b = PaperWidth/2 - NOfPages * 2.5pt ;

save p,q; path p,q ;
p =((0,5mm)-- (1mm,11mm)) shifted (b,0) ;
q =((-8mm,5mm) -- (0,11mm)  ) shifted (b,0) ;

pickup pencircle scaled 3pt ;
for i := NOfPages-1 downto 1:
  draw (if i mod 5 = 0 : q else : p fi)
   shifted (i*5pt, 0pt)
   withcolor if i < PageNumber : red
 else :  black
 fi ;
endfor ;
StopPage ;
\stopuseMPgraphic

\defineoverlay[background:ornament][\useMPgraphic{MP:ornament}]
\setupbackgrounds[page][background={background:ornament}]

\setupbodyfont[ss,18pt]

\starttext

\dorecurse{10}{
  \strut\par
  \page
}

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

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


Re: [NTG-context] Two minor questions

2022-06-06 Thread Stefan Nedeljkovic via ntg-context
Wolfgang, Aditya, thank you both very much!

I have 2 more questions:

Observe the files here:
https://drive.google.com/drive/folders/18ve5_F-BKOa-TxCWmD02mhPqNXQvNyWK?usp=sharing

1. I'd like to shift the text area down so that the red lines align with
the blue lines (I think this amount is called depth). How would I do that?
2. The font is such that exactly 2 characters fit into the grid cell, but I
see that towards the end of the line it gets out of sync with the grid. How
would I ensure that all text rendered is strictly monospaced without any
stretching/shrinking trickery?

Sincerely,
Stefan

On Mon, Jun 6, 2022 at 5:50 PM Aditya Mahajan  wrote:

> On Mon, 6 Jun 2022, Stefan Nedeljkovic via ntg-context wrote:
>
> > Dear list,
> >
> > I have 2 small questions:
> >
> > 1. In \setuplayout if I try to set topspace=5\measured{base} +
> > \dimexpr2bp I get an error. How should I add these 2bp?
>
> (Untested)
>
> \dimexpr\measure{base}+2bp\relax
>
> or
>
> \dimexpr\measured{base}+2bp\relax
>
> should work.
>
> > 2. I have an mp graphic defined in the file "graphic.mp" which has the
> > exact same dimensions as my page. I'd like to set that graphic as a
> > background. How do I do this?
>
> (Again, untested)
>
> \startuseMPgraphic{background-image}
>   input graphic.mp;
> \stopuseMPgraphic
>
> \defineoverlay[background-image][\useMPgraphic{background-image}]
>
> \setupbackgrounds[page][background={background-image}]
>
> 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] Two minor questions

2022-06-06 Thread Aditya Mahajan via ntg-context
On Mon, 6 Jun 2022, Stefan Nedeljkovic via ntg-context wrote:

> Dear list,
> 
> I have 2 small questions:
> 
> 1. In \setuplayout if I try to set topspace=5\measured{base} +
> \dimexpr2bp I get an error. How should I add these 2bp?

(Untested)

\dimexpr\measure{base}+2bp\relax

or 

\dimexpr\measured{base}+2bp\relax

should work.

> 2. I have an mp graphic defined in the file "graphic.mp" which has the
> exact same dimensions as my page. I'd like to set that graphic as a
> background. How do I do this?

(Again, untested)

\startuseMPgraphic{background-image}
  input graphic.mp;
\stopuseMPgraphic

\defineoverlay[background-image][\useMPgraphic{background-image}]

\setupbackgrounds[page][background={background-image}]

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] Two minor questions

2022-06-06 Thread Wolfgang Schuster via ntg-context

Stefan Nedeljkovic via ntg-context schrieb am 06.06.2022 um 07:55:

Dear list,

I have 2 small questions:

1. In \setuplayout if I try to set topspace=5\measured{base} + 
\dimexpr2bp I get an error. How should I add these 2bp?


\setuplayout
  [topspace=\dimexpr 5\measured{base} + 2bp\relax]

2. I have an mp graphic defined in the file "graphic.mp 
<http://graphic.mp>" which has the exact same dimensions as my page. 
I'd like to set that graphic as a background. How do I do this?


\startreusableMPgraphic{backgroundgraphic}
    input graphic.mp;
\stopreusableMPgraphic

\defineoverlay [backgroundimage] [\reuseMPgraphic{backgroundgraphic}]

\setupbackgrounds [page] [background=backgroundimage]

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] Pull quote between two column - trial

2022-05-28 Thread Garulfo via ntg-context

some progress... if it can help.

No more issue with nonsymetrical behavior, and \framed are properly 
aligned with the grid.


Garulfo


getshapetext_for_pullquote.pdf
Description: Adobe PDF document
\setuplayout [grid=yes]

\showgrid

\definecolor [transparentred]  [r=1,t=.5,a=1]

\def\numA{18}
\def\numB{4}
\def\numC{8}
\def\numD{14}
\def\mygap{0.001pt}

%===

\startMPinclusions
path pleft ; path pright ;

numeric LA ; LA := (\numA-1)*LineHeight + StrutHeight + StrutDepth + \mygap ;
numeric LB ; LB :=  \numB   *LineHeight - StrutHeight - StrutDepth + \mygap ;
numeric LC ; LC :=  \numC   *LineHeight - StrutHeight - StrutDepth - \mygap ;
numeric LD ; LD :=  \numD   *LineHeight ;
numeric LE ; LE := 2cm ;

pleft := (0cm , 0cm) --
 (LD  , 0cm) --
 (LD  , LA - LC) --
 (LD - LE , LA - LC) --
 (LD - LE , LA - LB) --
 (LD  , LA - LB) --
 (LD  , LA ) --
 (0cm , LA ) --
 cycle  ;

pright := pleft reflectedabout ((LD/2,0cm) , (LD/2,1cm));

\stopMPinclusions

\startuseMPgraphic{mytest1}  % column on the left of the pull quote
lmt_parshape [path = pleft ] ;
fill pleft withcolor \MPcolor{transparentred} ;
\stopuseMPgraphic

\startuseMPgraphic{mytest2}  % column on the right of the pull quote
lmt_parshape [path = pright] ;
fill pright withcolor \MPcolor{transparentred} ;
\stopuseMPgraphic

\defineoverlay[myOL1][\useMPgraphic{mytest1}]
\defineoverlay[myOL2][\useMPgraphic{mytest2}]

%===

\defineframed
  [MyBigFrame]
  [offset=-0.26pt,
   frameoffset=0pt,
   frame=off,
   strut=yes,
   before=,
   location=top,
   height=\dimexpr(\numA\lineheight),
   width=\textwidth,
   align=normal,]

\defineframed
  [MyFrame]
  [MyBigFrame]
  [location=high,
   width=\dimexpr(\numD\lineheight),
   after=\dontleavehmode,]

%===

\starttext

{\bf Before}   %

\startshapetext[mytest1,mytest2]
\strut\samplefile{douglas}
\stopshapetext

\MyBigFrame{%
\MyFrame[background=myOL1]{\getshapetext}%
\hfill%
\MyFrame[background=myOL2]{\getshapetext}}

{\bf Between}  %

\startshapetext[mytest1,mytest2]
\strut\samplefile{knuth}\par\samplefile{knuth}
\stopshapetext

\MyBigFrame{%
\MyFrame[background=myOL1]{\getshapetext}%
\hfill%
\MyFrame[background=myOL2]{\getshapetext}}

{\bf After}%

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


[NTG-context] Pull quote between two column - trial

2022-05-21 Thread Garulfo via ntg-context

Hi all,

hope you are all doing well.

I am still trying to display pull quote between two columns.

lmt_parshape is really helpfull.


I need to add a 1pt gap to make the left column behave correctly,
but the right column remains shifted one line below the intended one.

Question1: any clue ?

Question2: is there a way to use the columnset system to produce a 
similar output ?


Thanks again for your feedbacks,
Garulfo
\setuplayout
  [grid=yes,
   headerdistance=5mm,
   margindistance=5mm,
   backspace=17.5mm,
   margin=10mm,
   topspace=40mm,
   height=23cm,
   header=10mm,
   footer=10mm,
   width=17.5cm]

%\showframe
%\showgrid
\usemodule [visual]

\setupbodyfont [palatino,11pt]

\definecolor [transparentred]  [r=1,t=.5,a=1]
\definecolor [transparentgreen][g=1,t=.5,a=1]

%

\def\posA{10}
\def\posB{20}
\def\mygap{1pt}
\def\mypen{1pt}
\def\PQhalfwith{20mm}

%

\startuseMPgraphic{mytest0}   % for basic straight column
begingroup ;
save p ; path p ;
p := (0,0)  --
 (0.3*TextWidth,0cm) --
 (0.3*TextWidth,TextHeight) --
 (0cm,TextHeight) --cycle  ;
lmt_parshape [path = p] ;
draw p withpen pencircle scaled \mypen ;
endgroup ;
\stopuseMPgraphic

\startuseMPgraphic{mytest1}  % column on the left of the pull quote
begingroup ;
save p ; path p ;
p := (0,0)  --
 (0.3*TextWidth,0cm) --
 (0.3*TextWidth,TextHeight+\mygap-\posB*LineHeight) --
 (0.3*TextWidth-\PQhalfwith,TextHeight+\mygap-\posB*LineHeight) --
 (0.3*TextWidth-\PQhalfwith,TextHeight-\mygap-\posA*LineHeight) --
 (0.3*TextWidth,TextHeight-\mygap-\posA*LineHeight) --
 (0.3*TextWidth,TextHeight) --
 (0cm,TextHeight) --cycle  ;
lmt_parshape [path = p] ;
draw p withpen pencircle scaled \mypen ;
endgroup ;
\stopuseMPgraphic

\startuseMPgraphic{mytest2}   % column on the right of the pull quote
begingroup ;
save p ; path p ;
p := (0,0)  --
 (0.3*TextWidth,0cm) --
 (0.3*TextWidth,TextHeight) --
 (0cm,TextHeight) --
 (0.0*TextWidth,TextHeight-\mygap-\posA*LineHeight) --
 (0.0*TextWidth+\PQhalfwith,TextHeight-\mygap-\posA*LineHeight) --
 (0.0*TextWidth+\PQhalfwith,TextHeight+\mygap-\posB*LineHeight) --
 (0.0*TextWidth,TextHeight+\mygap-\posB*LineHeight) --
 cycle  ;
lmt_parshape [path = p] ;
draw p withpen pencircle scaled \mypen ;
endgroup ;
\stopuseMPgraphic

\defineoverlay[myOL1][\useMPgraphic{mytest1}]
\defineoverlay[myOL2][\useMPgraphic{mytest2}]

%

\defineframed
  [FramePage]
  [align=width,
   frame=off,
   location=high,
   strut=yes,
   offset=0pt,
   width=\textwidth,
   height=\textheight,
   before=]

\defineframed
  [FrameColumn]
  [FramePage]
  [background=color,
   backgroundcolor=transparentred,
   width=0.3\textwidth,
   after=\dontleavehmode]

%

\definelayer % used to display the pull quote on the page
  [test]
  [x=0mm,
   y=0mm,
   width=\paperwidth,
   height=\paperheight]

%===

\starttext

\startshapetext[mytest1,mytest2,mytest0,mytest0]%
\strut%
\dorecurse{3}{\samplefile{douglas}
\blank[1*line]}%
\stopshapetext

%
% First page

\FramePage{%
\FrameColumn[background={color,myOL1}]{\getshapetext}\hfill
\FrameColumn[background={color,myOL2}]{\getshapetext}\hfill
\FrameColumn{empty}}


% and the pull quote

\setlayer
  [test]
  [hoffset=\backspace+0.3\textwidth-\PQhalfwith+0.2pt,
   voffset=\dimexpr(\topspace+\headerheight+\headerdistance+\posA\baselineskip-0.4pt)]
 {\framed[
background=color,
backgroundcolor=transparentgreen,
frame=off,
strut=yes,
offset=0pt,
width=\dimexpr(0.05\textwidth)+\PQhalfwith+\PQhalfwith,
height=\dimexpr(\posB\baselineskip-\posA\baselineskip)]{\bfd PULL QUOTE\\TRIAL}}

\setupbackgrounds[page][background={foreground,test}]

%
% Second page just to demonstrate that \getshapetext continue to work

\page

\FramePage{%
\FrameColumn{\getshapetext}\hfill
\FrameColumn{\getshapetext}\hfill
\FrameColumn{empty}}


\stoptext



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


[NTG-context] MetaFun manual's "texvar" is not working for me

2022-05-21 Thread Gavin via ntg-context
Hello list,

I’m trying to reproduce the positional graphics examples in the MetaFun manual 
on pp. 151-153. There are two examples of code for the mpos:box. The first 
example uses \MPvar to retrieve variables set using \setupMPvariables. This 
works fine. The second example uses texvar to retrieve variables, but it does 
not work in the current LMTX. However, the second example does work with my 
TeXLive install.

I’ve put my working example below, with both versions of the mpos:box code. Log 
output from a failed run is below that. Any ideas where I might be going wrong?

Thanks!
Gavin


\setupbackgrounds
  [page]
  [background={backgraphics,foreground,foregraphics}]
\defineoverlay [backgraphics] [\positionoverlay{backgraphics}]
\defineoverlay [foregraphics] [\positionoverlay{foregraphics}]

\setupMPvariables
  [mpos:box]
  [linecolor=blue,
   linewidth=\linewidth,
   fillcolor=lightgray,
   filloffset=2pt]

  This mpos:box works using \MPvar. %%%
\startMPpositiongraphic{mpos:box}{fillcolor,linecolor,linewidth}
  string tag; tag := "\MPvar{self}" ;
  path box ; box := positionbox(tag) ;
  box := box enlarged  \MPvar{filloffset} ;
  fill box
withcolor \MPvar{fillcolor} ;
  draw box
withcolor \MPvar{linecolor}
withpen pencircle scaled \MPvar{linewidth} ;
  positioninregion ;
\stopMPpositiongraphic

%%%  This mpos:box does not work using texvar. (log below) %%%
%\startMPpositiongraphic{mpos:box}{fillcolor,linecolor,linewidth}
%  path box ; box := positionbox(texstr("self")) ;
%  box := box enlarged  texvar("filloffset") ;
%  fill box
%withcolor texvar("fillcolor") ;
%  draw box
%withcolor texvar("linecolor")
%withpen pencircle scaled texvar("linewidth") ;
%  positioninregion ;
%\stopMPpositiongraphic


\starttext

to get \hpos {A-0} {positions} sorted

\startpositionoverlay{backgraphics}
   \setMPpositiongraphic{A-0}{mpos:box}{self=A-0}
\stoppositionoverlay

\stoptext


system  > 
system  > ConTeXt  ver: 2022.05.11 11:36 LMTX  fmt: 2022.5.20  int: 
english/english
system  > 
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'/Users/Gavin/context-osx-arm64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'/Users/Gavin/context-osx-arm64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname './ContractionExperiments', input 
'./ContractionExperiments.tex', result './ContractionExperiments'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
system  > synctex functionality is enabled, expect 5-10 pct runtime 
overhead!
open source > level 1, order 2, name './ContractionExperiments.tex'
fonts   > preloading latin modern fonts (second stage)
fonts   > 'fallback modern-designsize rm 12pt' is loaded
metapost> initializing instance 'metafun:1' using format 'metafun' and 
method 'double'
metapost> loading 'metafun' as 'metafun.mpxl' using method 'double'
metapost> initializing number mode 'double'
metapost> trace > This is MPLIB for LuaMetaTeX, version 3.12, running 
in double mode.
metapost> trace > 
metapost> trace > loading metafun for lmtx, including the plain 1.004 
base definitions
metapost> trace > 
metafun > log >
metafun > log > error: Missing ')' has been inserted
metafun > log >
metapost> trace >  ,
metapost> trace >  paired ->  -> 
begingroup.if.pair(EXPR2):(EXPR2)else:((EXPR2),(EXPR2))fi.endgroup
metapost> trace >  ,
metapost> trace >  llmoved -> -> 
((llcorner(EXPR0))shifted(-xpart.paired((EXPR1)),-ypart.paired((EXPR1
metapost> trace >  {
metapost> trace >  -- -> -> {curl1}..{curl1}
metapost> trace >  enlarged -> -> 
((EXPR0)llmoved(EXPR1)--(EXPR0)lrmoved(EXPR1)--(EXPR0)urmoved(EXPR1)--(EXPR0)ulmoved(EXPR1)--cycle)
metapost> trace >  ;
metafun > log >
metafun > log > I found no right delimiter to match a left one. So I've 
put one in, behind the
scenes; this may fix the problem.
metafun > log >
metapost> trace >  path box ; box := 
positionbox(texstr("self")) ; box := box enlarged texvar("filloffset") ; fill 
box withcolor texvar("fillcolor") ; draw box withcolor texvar("linecolor") 
withpen pencircle scaled texvar("linewidth") ; positioninregion ; ;
metapost> trace > 
backend > xmp > using file 
'/Users/Gavin/context-osx-arm64/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
pa

Re: [NTG-context] Crediting copyright on photographs

2022-05-04 Thread Adam Reviczky via ntg-context
Hi Bruce,

The Layers page has some examples (
https://wiki.contextgarden.net/Layers#Place_labels_on_pictures) and the
Collectors page as well (https://wiki.contextgarden.net/Collectors).

Some MWE:

\starttext
\definelayer  [figure][width=\overlaywidth,height=\overlayheight]
\defineoverlay[figure][{\directsetup{figure}\tightlayer[figure]}]
\startsetups figure
\setlayerframed[figure][frame=off,preset=rightbottom]{\copyright\ 2022}
\stopsetups
\externalfigure[cow][background={foreground,figure}]
\stoptext

\starttext
\definecollector[example]
\setcollector [example] {\externalfigure[cow][width=4cm,frame=off]}
\setcollector [example]
[corner={right,bottom},location={left,top}]{\copyright\ 2022}
\composedcollector{example}
\stoptext

Adam

On Wed, May 4, 2022 at 11:01 PM Bruce Horrocks via ntg-context <
ntg-context@ntg.nl> wrote:

> I need to include the copyright acknowledgement / photographer credit on
> an image but I'm not sure what's the best way to do it.
>
> Option 1: I can add the acknowledgement to the end of the \placefigure
> caption text:
>
> e.g.   \placefigure{A picture of a cow. Image of a cow that may or may not
> be under copyright anymore.}{\externalfigure[cow][height=6cm]}
>
> then the copyright bit will appear in the Table of Figures which I don't
> really want to happen. Is there a way to truncate this?
>
>
> Option 2: some magazines print the copyright credit running up the side of
> the image, independently of the caption. I'd quite like to do this and
> wondered if anyone had already written something they could share?
>
> —
> 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
>
> ___
>
___
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] Switching fonts changes framedtext justification

2022-04-07 Thread Thangalin via ntg-context
Works flawlessly, thank you!

Here's a demo with left and right speech bubbles:

\definefont [TextFontEmoji] [OpenSansEmoji]

\startuseMPgraphic{TextBubble}{side}
  z1 = (0, 0) ;
  z2 = (OverlayWidth, 0) ;
  z3 = (OverlayWidth, OverlayHeight) ;
  z4 = (0, OverlayHeight) ;

  offset := 1 ;
  tail := 1 ;

  % Flip the tail's location and direction.
  if \MPvar{side} = 1:
offset := 5 ;
tail := -1 ;
  fi

  (offset/6)[x1,x2] = x8 + .25cm * tail = x7 + .25cm = x9 - .25cm ;
  y7 =  0cm ;
  y8 = -.5cm ;
  y9 =  0cm ;

  path p ;
  p = (z1--z7--z8--z9--z2--z3--z4--cycle) cornered .25cm ;
  draw p withpen pencircle scaled 0.75 ;

  setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineframedtext[TextBubbleFrame][
  style=TextFontEmoji,
  frame=off,
  width=.618\textwidth,
  autowidth=force,
  offset=.75em,
  after={\blank[2*big]},
]

% Receive text (left-facing).
\defineoverlay[TextBubbleRxOverlay][\useMPgraphic{TextBubble}{side=0}]
\defineframedtext[TextBubbleRxFrame][TextBubbleFrame][
  background=TextBubbleRxOverlay,
  location=left,
]

% Send text (right-facing).
\defineoverlay[TextBubbleTxOverlay][\useMPgraphic{TextBubble}{side=1}]
\defineframedtext[TextBubbleTxFrame][TextBubbleFrame][
  background=TextBubbleTxOverlay,
  location=right,
]

% Map XHTML class names to start/stop environments.
\definestartstop[bubblerx][
  before={\startnarrower\startTextBubbleRxFrame},
  after={\stopTextBubbleRxFrame\stopnarrower},
]

\definestartstop[bubbletx][
  before={\startnarrower\startTextBubbleTxFrame},
  after={\stopTextBubbleTxFrame\stopnarrower},
]

\starttext
  \startbubblerx
Welcome to the future, human !  \input zapf
  \stopbubblerx

  \startbubbletx
Welcome to the future, human !  \input zapf
  \stopbubbletx
\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] Metafun, difficulty with graphical element in the margin

2022-03-20 Thread Wolfgang Schuster via ntg-context

Willi Egger via ntg-context schrieb am 20.03.2022 um 17:05:

Hoi Wolfgang,

I tested both variants (bodymatter and bodypart. The compilation runs through, 
however without the thumb-picture in the margin and the metafun error is in the 
log.


1. Do you use \startfrontmatter and \startbodymatter in your document to 
create blocks?


2. Is you installation up-to-date?

Attached is a slightly modified version of your example, the only thing 
which has to be local to the bodypart is the background setting to 
enable the thumb pictures.


Wolfgang

\definecolor [chap_frame] [black]
\definecolor [textcolor]  [white]

\startuseMPgraphic{chapter-thumb}
path chap_frame ;
pair pos,a,b ;
picture Chap ;

if \somenamedheadnumber{chapter}{current} > 0 :
curr_chap := \somenamedheadnumber{chapter}{current} ;
else :
curr_chap := 1 ;
fi;
if \somenamedheadnumber{chapter}{last} > 0 :
last_chap := \somenamedheadnumber{chapter}{last} ;
else :
last_chap := 1 ;
fi;
if \somenamedheadnumber{section}{current} > 0 :
curr_sect := \somenamedheadnumber{section}{current} ;
else:
curr_sect := 1 ;
fi;
if \somenamedheadnumber{section}{last} > 0 :
last_sect := \somenamedheadnumber{section}{last} ;
else:
last_sect := 1;
fi;
if curr_chap < 11 :
skip := TextHeight * (curr_chap-1)/11 ;
elseif curr_chap < 21 :
skip := TextHeight * (curr_chap-11)/11 ;
else:
skip := TextHeight * (curr_chap-21)/11 ;
fi;

Chap := textext("\bfa\textcolor\getmarking[chapter]") ;

StartPage ;
chap_frame := lcircle xscaled (2*RightMarginWidth) yscaled 
(1.5*RightMarginWidth) ;

a := ulcorner chap_frame ;
b := urcorner chap_frame ;

pos := urcorner Field[Text][RightMarginSeparator] - ulcorner chap_frame 
- (-1mm,skip) ;

fill chap_frame shifted pos withcolor "chap_frame" ;
draw Chap rotated 90 shifted (xpart pos-4mm,ypart pos) ;
StopPage ;
\stopuseMPgraphic

\defineoverlay[chapter-thumb][\useMPgraphic{chapter-thumb}]

\startsectionblockenvironment[bodypart]
\setupbackgrounds[rightpage][background=chapter-thumb]
\stopsectionblockenvironment

\showframe

\starttext

\startfrontmatter

\startchapter[title=Test A]
\samplefile{ward}
\stopchapter

\stopfrontmatter

\startbodymatter

\startchapter[title=Test C]
\samplefile{ward}
\stopchapter

\stopbodymatter

\stoptext























% Global settings for all chapters
\setuphead[chapter][style=\ssc]

% Local settings for chapter in the bodymatter block
\startsectionblockenvironment[bodypart]
\setuphead[chapter][color=blue]
\stopsectionblockenvironment

\starttext

\startfrontmatter

\title{Table of content}

\placecontent

\stopfrontmatter

\startbodymatter

\chapter{Knuth}

\input knuth

\chapter{Zapf}

\input zapf

\stopbodymatter

\stoptext





\starttext

a\texttilde b\lettertilde c\textasciitilde d

\stoptext




\definepageinjectionalternative
  [chapter:image]
  [renderingsetup=pageinjection:chapter:image]

\startsetups [pageinjection:chapter:image]
  \centerbox{\externalfigure[\dummyparameter{name}]}
\stopsetups

\definepageinjection
  [chapter:start]
  [empty]
  [page=left]

\definepageinjection
  [chapter:insert]
  [previouspage]
  [alternative=chapter:image,
   offset=1cm,
   pagestate=stop]

\setuphead
  [chapter]
  [beforesection={\pageinjection[chapter:start]},
   
insidesection={\pageinjection[chapter:insert][name={chapter-\namedheadnumber{chapter}}]}]

\setuppagenumbering
  [alternative=doublesided]

\setupexternalfigures
  [location=default]

\useexternalfigure [chapter-1] [mill]   [factor=max]
\useexternalfigure [chapter-2] [hacker] [orientation=90,scale=2000]
\useexternalfigure [chapter-3] [cow][orientation=90,height=\framedwidth]

\starttext

\startchapter [title={Mill}]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\startchapter [title={Hacker}]
\dorecurse{11}{\samplefile{lorem}}
\stopchapter

\startchapter [title={cow}]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\stoptext




\setupbodyfont[termes]

\starttext

plays \m{\frac{2}{3} A}, \m{\frac{1}{3} D}.

\stoptext






\definefallbackfamily[story][serif][notoserif][range={greekandcoptic,greekextended},force=yes]
\definefontfamily[story][serif][TeX Gyre Schola]

\definefontfamily [story] [sans] [Latin Modern Sans]
\definefontfamily [story] [mono] [Latin Modern Mono] [features=none]

\definetypeface [story] [ss] [sans] [modern] [default]
\definetypeface [story] [ss] [mono] [modern] [default]

\definetypeface [story] [ss] [sans] [modern-designsize] [default]
\definetypeface [story] [ss] [mono] [modern-designsize] [default]

\definefontfamily[story][mm][TeX Gyre Pagella Math]

\definetypeface [story] [mm] [math] [pagella] [default]

\setupbodyfont[story,11pt]

\usebodyfont[termes]

\showframe

\startsetups [blockquote:style]
\switchtobodyfont[termes]

[NTG-context] Errors compiling the MetaFun manual

2022-03-12 Thread Marco Patzer via ntg-context
Hi!

I tried to compile the MetaFun manual from

  /doc/context/sources/general/manuals/metafun

and ran into a few issues. I don't know if that's expected or if
it's supposed to work on a current LMTX.

Attached are the first two issues. It takes a while to boil it down
to MWEs. Let me know if I should report the other errors, too.

I'm not using the failing bits myself, so I don't need fix for that.
Motivation is to help find issues with the current release.

Marco
%% metafun > log > error: A primary expression can't begin with ';'
\starttext

\startMPcode
  uniquelist(a) ;
  draw topath(a,--) ysized 2cm
  withpen pencircle scaled 1mm
  withcolor .625yellow ;
  drawpoints topath(a,--) ysized 2cm
  withpen pencircle scaled 1mm
  withcolor .625red ;
  drawpointlabels topath(a,--) ysized 2cm ;
\stopMPcode

\stoptext
%% metapost> trace >  unknown string ta
%% metafun > log >
%% metafun > log > error: Equation cannot be performed (unknown string=vacuous)
\setupbackgrounds
  [page]
  [background={foreground,foregraphics}]

\defineoverlay [foregraphics] [\positionoverlay{foregraphics}]

\starttext

\startMPpositiongraphic{mypos:line}
  path pa, pb, pab ; numeric na, nb ; string ta, tb ;
  ta := texstr("from") ;
  tb := texstr("to") ;
  na := positionpage(ta) ;
  nb := positionpage(tb) ;
  pa := positionbox(ta) ;
  pb := positionbox(tb) ;
  pa := fullcircle xsized (bbwidth(pa)+4pt) shifted center pa ;
  pb := fullcircle xsized (bbwidth(pb)+4pt) shifted center pb ;
  if na = nb :
pab := center pa -- center pb ;
pab := pab cutbefore (pab intersectionpoint pa) ;
pab := pab cutafter  (pab intersectionpoint pb) ;
pickup pencircle scaled 1pt ;
draw pab withcolor .625yellow ;
positioninregion ;
  fi ;
\stopMPpositiongraphic
\startpositionoverlay{foregraphics}
  \setMPpositiongraphic{G-1}{mypos:line}{to=G-2}
\stoppositionoverlay

First we have defined an \hpos {G-1} {\strut overlay}.

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


[NTG-context] Double-sided documents with MetaFun's Field[Text][Text]

2022-02-06 Thread śrīrāma via ntg-context
Dear list,

I have a double-sided document in which I want to draw certain page 
backgrounds on the right (odd) and left (even) pages. Here is an example

%%% SOF
\setuppagenumbering[alternative=doublesided]
\setuplayout
[backspace=4cm,
leftmargin=4cm,
cutspace=2cm,
rightmargin=2cm,
leftmargindistance=0cm,
rightmargindistance=0cm,
header=2cm,
footer=2cm,
topspace=1cm,
bottomspace=1cm,
top=1cm,
bottom=1cm,
width=middle,
height=fit]

\startuseMPgraphic{page}
StartPage;
draw Area[Text][Text] 
shifted (InnerMarginWidth,BottomHeight+FooterHeight);
draw Field[Text][Text] withcolor blue;
StopPage;
\stopuseMPgraphic
\defineoverlay[page][\useMPgraphic{page}]
\setupbackgrounds[page][background=page]

\starttext
\dorecurse{10}{\input knuth \page}
\stoptext
%%% EOF

In the resulting PDF the Field[Text][Text] path is not positioned (/computed?) 
correctly, while the manually positioned Area[Text][Text] path is as expected. 
So, it seems that the margin widths and other distance are updated for each 
odd, even page but Field[Text][Text] is still wrong? The Field[Text][Text] 
path appears on every page as though it is on an odd (right) page.

Have I missed something?

Thanks,
śrīrāma (Sreeram)


___
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] measure layer/ ruler

2022-01-01 Thread Youssef Cherem via ntg-context
Hans,

Thanks a lot. I'm still trying to apply this to the top/bottom; I suppose
it should be simple after I have a firmer grasp of language.

lør. 1. jan. 2022 kl. 10:15 skrev Hans Hagen :

> On 1/1/2022 11:46 AM, Youssef Cherem via ntg-context wrote:
> > Dear list users,
> >
> > How can one go about implementing a ruler around the page/text area
> > (such as a background) like the one provided by the latex package
> > fgruler? https://www.ctan.org/tex-archive/macros/latex/contrib/fgruler
> > <https://www.ctan.org/tex-archive/macros/latex/contrib/fgruler> or koma
> > script's \layercontentsmeasure?
> a good opportunity to learn some metapost
>
> \startuniqueMPpagegraphic{ruler}
>  numeric n, f, sign ;
>  pair first, last;
>  if OnOddPage :
>  first := urcorner Page;
>  last  := lrcorner Page;
>  sign  := -1;
>  else :
>  first := ulcorner Page;
>  last  := llcorner Page;
>  sign  := 1;
>  fi ;
>  f := xpart first;
>  n := 0;
>  draw first -- last withpen pencircle scaled 2pt;
>  for i = ypart first step -1mm until ypart last :
>  if (n mod 10) == 0 :
>  draw (f,i) -- (f+sign*10mm,i) ;
>  if OnOddPage :
>  draw thetextext.lft(n/10,(f+sign*12mm,i)) ;
>  else :
>  draw thetextext.rt (n/10,(f+sign*12mm,i)) ;
>  fi
>  elseif (n mod 5) == 0 :
>  draw (f,i) -- (f+sign*5mm,i) ;
>  else :
>  draw (f,i) -- (f+sign*3mm,i) ;
>  fi ;
>  n := n + 1 ;
>  endfor ;
>  setbounds currentpicture to Page ;
> \stopuniqueMPpagegraphic
>
> \defineoverlay[ruler][\uniqueMPpagegraphic{ruler}]
>
> \setupbackgrounds[page][background=ruler]
>
> \setuppagenumbering[alternative=doublesided]
>
> \starttext
>  \dorecurse{10}{test \page}
> \stoptext
>
>
> -
>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] measure layer/ ruler

2022-01-01 Thread Hans Hagen via ntg-context

On 1/1/2022 11:46 AM, Youssef Cherem via ntg-context wrote:

Dear list users,

How can one go about implementing a ruler around the page/text area 
(such as a background) like the one provided by the latex package 
fgruler? https://www.ctan.org/tex-archive/macros/latex/contrib/fgruler 
<https://www.ctan.org/tex-archive/macros/latex/contrib/fgruler> or koma 
script's \layercontentsmeasure?

a good opportunity to learn some metapost

\startuniqueMPpagegraphic{ruler}
numeric n, f, sign ;
pair first, last;
if OnOddPage :
first := urcorner Page;
last  := lrcorner Page;
sign  := -1;
else :
first := ulcorner Page;
last  := llcorner Page;
sign  := 1;
fi ;
f := xpart first;
n := 0;
draw first -- last withpen pencircle scaled 2pt;
for i = ypart first step -1mm until ypart last :
if (n mod 10) == 0 :
draw (f,i) -- (f+sign*10mm,i) ;
if OnOddPage :
draw thetextext.lft(n/10,(f+sign*12mm,i)) ;
else :
draw thetextext.rt (n/10,(f+sign*12mm,i)) ;
fi
elseif (n mod 5) == 0 :
draw (f,i) -- (f+sign*5mm,i) ;
else :
draw (f,i) -- (f+sign*3mm,i) ;
fi ;
n := n + 1 ;
endfor ;
setbounds currentpicture to Page ;
\stopuniqueMPpagegraphic

\defineoverlay[ruler][\uniqueMPpagegraphic{ruler}]

\setupbackgrounds[page][background=ruler]

\setuppagenumbering[alternative=doublesided]

\starttext
\dorecurse{10}{test \page}
\stoptext


-
  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] Extra shift with ornament

2021-12-17 Thread Mikael Sundqvist via ntg-context
On Fri, Dec 17, 2021 at 10:05 AM Hans Hagen  wrote:
>
> On 12/17/2021 6:40 AM, Mikael Sundqvist via ntg-context wrote:
> > Hi,
> >
> > When using an ornament on a \startframedtext \stoptextframed the frame
> > is shifted just a little bit. Can one get rid of that shift? MWE
> > below.
> >
> > /Mikael
> >
> > \defineornament[MyOrn][
> >corner={right,bottom},
> >location={right,top},
> >alternative=b,
> >][
> >frame=off,
> >]
> >
> > \showframe
> >
> > \starttext
> > \startframedtext[width=\textwidth,height=2cm]foo\stopframedtext
> >
> > \MyOrn{bar}{\startframedtext[width=\textwidth,height=2cm]foo\stopframedtext}
> > \stoptext
> framedtext is more for text flow so you get some interferences
>
> \MyOrn
>{bar}
>{\framed
>  [offset=overlay,
>   align=normal,
>   width=\textwidth,
>   height=2cm]{foo}}
>
> works but maybe you want this instead:
>
> \defineoverlay
>[MyOrn]
>[\MyOrn
>  {\framedtextparameter{MyTitle}}
>  {\novrule width \overlaywidth height \overlayheight}]
>
> \defineframedtext
>[MyText]
>[background=MyOrn,width=\textwidth,height=2cm]
>
> \startMyText[MyTitle={oeps}]
> foo
> \stopMyText
>
> 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
> -

Thanks, Hans!

You indeed knew what I wanted.

/Mikael
___
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] Extra shift with ornament

2021-12-17 Thread Hans Hagen via ntg-context

On 12/17/2021 6:40 AM, Mikael Sundqvist via ntg-context wrote:

Hi,

When using an ornament on a \startframedtext \stoptextframed the frame
is shifted just a little bit. Can one get rid of that shift? MWE
below.

/Mikael

\defineornament[MyOrn][
   corner={right,bottom},
   location={right,top},
   alternative=b,
   ][
   frame=off,
   ]

\showframe

\starttext
\startframedtext[width=\textwidth,height=2cm]foo\stopframedtext

\MyOrn{bar}{\startframedtext[width=\textwidth,height=2cm]foo\stopframedtext}
\stoptext

framedtext is more for text flow so you get some interferences

\MyOrn
  {bar}
  {\framed
[offset=overlay,
 align=normal,
 width=\textwidth,
 height=2cm]{foo}}

works but maybe you want this instead:

\defineoverlay
  [MyOrn]
  [\MyOrn
{\framedtextparameter{MyTitle}}
{\novrule width \overlaywidth height \overlayheight}]

\defineframedtext
  [MyText]
  [background=MyOrn,width=\textwidth,height=2cm]

\startMyText[MyTitle={oeps}]
   foo
\stopMyText

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
___


[NTG-context] \startcolumnset ... \stopcolumnset fatal error: return code 11

2021-12-16 Thread Jeong Dal via ntg-context
Hi,

I have used newcolumnset module to make a test sheet. It was made by the help 
of experts in the list.
It worked fine a month ago and also worked via TeXlive 2021.
But I got error using the recent version.
Thanks Nicola and John for testing.

I have listed it before and tried to find out the cause.
I have test the following file in the editors,  vscode, vim, atom and even in 
the terminal.
It might be an apple binary problem as Hans suspected.
I’d like to know that it is the only problem for Mac users.

Here is the code and the part of error message:
It was tested in vscode, vim and terminal too.

I am using Mac OSX, 
ConTeXt  ver: 2021.12.03 15:20 LMTX  fmt: 2021.12.9  int: english/english

Thank you for reading.
Best regards,

Dalyoung

%%%
\startuseMPgraphic{verticalrule0}
  if CurrentColumn < NOfColumns :
draw rightboundary OverlayBox shifted (4mm,0);
setbounds currentpicture to OverlayBox enlarged 2.5mm;
  fi;
\stopuseMPgraphic

\startuseMPgraphic{squareBox}
   draw topboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: 
shifted(-2mm,0) fi ;
   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: 
shifted(2mm,0) fi ;  
   draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
 \stopuseMPgraphic
\defineoverlay
  [headerBox]
  [\useMPgraphic{squareBox}]

\startuseMPgraphic{verticalrule3}
   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: 
shifted(-2mm,0) fi ;
   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: 
shifted(2mm,0) fi ;  
   draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
 \stopuseMPgraphic

\defineoverlay
  [verticalrule]
  [\useMPgraphic{verticalrule3}]

\definecolumnset
  [exam]
  [n=2,
   background=verticalrule]


\setuplayout[width=19cm, height=26cm, header=1cm, footer=.5cm,backspace=1cm]
\setupheader[before=\vfil, after=\vfil]
\setupbackgrounds[header][text][frame=off, background=headerBox, 
align=lohi]%topframe=
\setupbackgrounds[footer][text][frame=off, background=screen]

\define[3]\headTitle{\setupheadertexts[][\bf #1  \hfill #2  \hfill #3  \hfill 
ID:  \hskip 2cm Name: \hskip 2cm]}

\setupmathematics[autopunctuation=no, integral=nolimits]

\setupbodyfont[rm,10pt]
\setuppagenumbering[location=footer]
\setupcolors[state=start]
%\setupexternalfigure[directory={/Users/graph/Documents/figures,}]

\headTitle{2021. 12. 9.}{Set Theory}{Final Exam}

\usemodule[newcolumnsets]

\starttext

%\startcolumns[rule=on,n=2,leftframe=on]
\startcolumnset[exam]

\startitemize[n]
  \item The first problem.
  \vfill
  \column

  \item The second problem.
  \vfill
  \column

  \item The third problem.
  \vfill
  \column

\stopitemize

\stopcolumnset
%\stopcolumns
\stoptext


%%
…
open source > level 2, order 3, name 
‘/Users/graph/ConTeXtLM/tex/texmf-context/tex/context/base/mkiv/m-newcolumnsets.mkiv'
close source> level 2, order 3, name 
'/Users/graph/ConTeXtLM/tex/texmf-context/tex/context/base/mkiv/m-newcolumnsets.mkiv'
mtx-context | fatal error: return code: 11
The terminal process "zsh '-c', 'mtxrun --autogenerate --script context 
--autopdf --purge '/Users/graph/Library/Mobile 
Documents/com~apple~CloudDocs/texMain/ColumnsetTest.tex''" terminated with exit 
code: 1.

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

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


[NTG-context] using the newcolumnsets module

2021-12-09 Thread Jeong Dal via ntg-context

Dear all,

I made an exam form by the help of the experts in this list.
However, it was not working after recent update.
Here is a code which I made for the test.
If I use “\startcolumns \stopcolumns”, then it has no problem.
But using “\startcolumnset[exam] … \stopcolumnset” produces error message 
“return code 11”.
It loads “m-newcolumnset.tex” without problem.

What is the cause of this error?

Thank you for reading.

Best regards,

Dalyoung

\startuseMPgraphic{verticalrule0}
  if CurrentColumn < NOfColumns :
draw rightboundary OverlayBox shifted (4mm,0);
setbounds currentpicture to OverlayBox enlarged 2.5mm;
  fi;
\stopuseMPgraphic

\startuseMPgraphic{squareBox}
   draw topboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: 
shifted(-2mm,0) fi ;
   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: 
shifted(2mm,0) fi ;  
   draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
 \stopuseMPgraphic
\defineoverlay
  [headerBox]
  [\useMPgraphic{squareBox}]

\startuseMPgraphic{verticalrule3}
   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: 
shifted(-2mm,0) fi ;
   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: 
shifted(2mm,0) fi ;  
   draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;
 \stopuseMPgraphic

\defineoverlay
  [verticalrule]
  [\useMPgraphic{verticalrule3}]

\definecolumnset
  [exam]
  [n=2,
   background=verticalrule]


\setuplayout[width=19cm, height=26cm, header=1cm, footer=.5cm,backspace=1cm]
\setupheader[before=\vfil, after=\vfil]
\setupbackgrounds[header][text][frame=off, background=headerBox, 
align=lohi]%topframe=
\setupbackgrounds[footer][text][frame=off, background=screen]

\define[3]\headTitle{\setupheadertexts[][\bf #1  \hfill #2  \hfill #3  \hfill 
ID:  \hskip 2cm Name: \hskip 2cm]}

\setupmathematics[autopunctuation=no, integral=nolimits]

\setupbodyfont[rm,10pt]
\setuppagenumbering[location=footer]
\setupcolors[state=start]
%\setupexternalfigure[directory={/Users/graph/Documents/figures,}]

\headTitle{2021. 12. 9.}{Set Theory}{Final Exam}

\usemodule[newcolumnsets]

\starttext

\startcolumns[rule=on,n=2,leftframe=on]
%\startcolumnset[exam]

\startitemize[n]
  \item The first problem.
  \vfill
  \column

  \item The second problem.
  \vfill
  \column

  \item The third problem.
  \vfill
  \column

\stopitemize

%\stopcolumnset
\stopcolumns
\stoptext


error messages:
system  > ConTeXt  ver: 2021.11.30 19:49 LMTX  fmt: 2021.12.1  int: 
english/english
system  > 
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'/Users/graph/ConTeXtL/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'/Users/graph/ConTeXtL/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname '/Users/graph/Library/Mobile 
Documents/com~apple~CloudDocs/texMain/ColumnsetTest', input 
'/Users/graph/Library/Mobile 
Documents/com~apple~CloudDocs/texMain/ColumnsetTest.tex', result 
'/Users/graph/Library/Mobile 
Documents/com~apple~CloudDocs/texMain/ColumnsetTest'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
open source > level 1, order 2, name '/Users/graph/Library/Mobile 
Documents/com~apple~CloudDocs/texMain/ColumnsetTest.tex'
fonts   > preloading latin modern fonts (third stage)
fonts   > 'fallback modern-designsize rm 10pt' is loaded
colors  > 'rgb' color space is supported
colors  > 'cmyk' color space is supported
modules > 'newcolumnsets' is loaded
open source > level 2, order 3, name 
'/Users/graph/ConTeXtL/tex/texmf-context/tex/context/base/mkiv/m-newcolumnsets.mkiv'
close source> level 2, order 3, name 
'/Users/graph/ConTeXtL/tex/texmf-context/tex/context/base/mkiv/m-newcolumnsets.mkiv'
mtx-context | fatal error: return code: 11
The terminal process "zsh '-c', 'export 
PATH=~/ConTeXtL/tex/texmf-osx-64/bin:$PATH;mtxrun --autogenerate --script 
context --autopdf --purge '/Users/graph/Library/Mobile 
Documents/com~apple~CloudDocs/texMain/ColumnsetTest.tex''" terminated with exit 
code: 1.

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

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


Re: [NTG-context] Sum and mathalignment

2021-11-30 Thread Bruce Horrocks via ntg-context


> On 30 Nov 2021, at 19:34, Alexandre Christe via ntg-context 
>  wrote:
> 
> Dear list,
> 
> 
> 
> What I've done is to play with mathalignment and \framed. Here is a MWE:
> 
> \starttext
> \defineoverlay[midrule][{\blackrule[height=.02cm,width=5.5cm]}]
> 
> \framed[frame=off,background=midrule,boffset=.65cm]{\startformula
>   
> \startmathalignment[n=12,align={middle,middle,middle,middle,middle,middle,middle,middle,middle,middle,middle,middle}]
> \NC \NC S_6 \NC= \NC 1 \NC+ \NC 2 \NC+ \NC\dots \NC+ \NC 5 \NC+ \NC 6 \NR
> \NC + \NC S_6 \NC= \NC 6 \NC+ \NC 5 \NC+ \NC\dots \NC+ \NC 2\NC+ \NC 1 \NR
> \NC\NC 2S_6 \NC= \NC 7 \NC+ \NC 7 \NC+ \NC\dots \NC+ \NC 7 \NC+ \NC 7 \NR
>   \stopmathalignment
> \stopformula}
> \stoptext
> 
> Is there a simpler way to typeset something like this?

How about:

\usecolors[svg]
\starttext
\ssa\bold
\starttabulate[|r|CT{red}c|c|CT{yellow}c|c|CT{green}c|c|CT{cyan}c|c|CT{blue}c|c|CT{darkmagenta}c|]
\NC   S = \NC 1 \NC + \NC 2 \NC + \NC 3 \NC + \NC 4 \NC + \NC 5 \NC + \NC 6 
\NC\NR
\NC + S = \NC 6 \NC + \NC 5 \NC + \NC 4 \NC + \NC 3 \NC + \NC 2 \NC + \NC 1 
\NC\NR
\HL[cornflowerblue]
\NC  2S = \NC 7 \NC + \NC 7 \NC + \NC 7 \NC + \NC 7 \NC + \NC 7 \NC + \NC 7 
\NC\NR
\stoptabulate
\stoptext

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


[NTG-context] Sum and mathalignment

2021-11-30 Thread Alexandre Christe via ntg-context
Dear list,

[image: image.png]

What I've done is to play with mathalignment and \framed. Here is a MWE:

\starttext
\defineoverlay[midrule][{\blackrule[height=.02cm,width=5.5cm]}]

\framed[frame=off,background=midrule,boffset=.65cm]{\startformula

\startmathalignment[n=12,align={middle,middle,middle,middle,middle,middle,middle,middle,middle,middle,middle,middle}]
\NC \NC S_6 \NC= \NC 1 \NC+ \NC 2 \NC+ \NC\dots \NC+ \NC 5 \NC+ \NC 6
\NR
\NC + \NC S_6 \NC= \NC 6 \NC+ \NC 5 \NC+ \NC\dots \NC+ \NC 2\NC+ \NC 1
\NR
\NC\NC 2S_6 \NC= \NC 7 \NC+ \NC 7 \NC+ \NC\dots \NC+ \NC 7 \NC+ \NC 7
\NR
  \stopmathalignment
\stopformula}
\stoptext

Is there a simpler way to typeset something like this?

Thanks in advance!
___
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] positioning of metapost figure

2021-09-12 Thread Sylvain Hubert via ntg-context
Thanks Hans!

On Sun, 12 Sept 2021 at 19:02, Hans Hagen  wrote:

> On 9/12/2021 6:54 PM, Sylvain Hubert via ntg-context wrote:
> > Dear List,
> >
> > The following code draws a circle at the center of the page, ignoring
> > the "shifted" part.
> >
> > \startuniqueMPgraphic{concept}
> > draw fullcircle scaled 1cm shifted (10cm,10cm);
> > \stopuniqueMPgraphic
> > \defineoverlay[concept][\uniqueMPgraphic{concept}]
> > \setupbackgrounds[page][background=concept]
> > \starttext
> > .
> > \stoptext
> >
> > How should the metapost background figure be positioned correctly?
>
> \startuniqueMPgraphic{concept}
>  StartPage;
>  draw fullcircle scaled 1cm shifted (10cm,10cm);
>  draw Page withpen pencircle scaled 5mm;
>  StopPage;
> \stopuniqueMPgraphic
>
> -
>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] positioning of metapost figure

2021-09-12 Thread Hans Hagen via ntg-context

On 9/12/2021 6:54 PM, Sylvain Hubert via ntg-context wrote:

Dear List,

The following code draws a circle at the center of the page, ignoring 
the "shifted" part.


\startuniqueMPgraphic{concept}
draw fullcircle scaled 1cm shifted (10cm,10cm);
\stopuniqueMPgraphic
\defineoverlay[concept][\uniqueMPgraphic{concept}]
\setupbackgrounds[page][background=concept]
\starttext
.
\stoptext

How should the metapost background figure be positioned correctly?


\startuniqueMPgraphic{concept}
StartPage;
draw fullcircle scaled 1cm shifted (10cm,10cm);
draw Page withpen pencircle scaled 5mm;
StopPage;
\stopuniqueMPgraphic

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] positioning of metapost figure

2021-09-12 Thread Sylvain Hubert via ntg-context
Dear List,

The following code draws a circle at the center of the page, ignoring the
"shifted" part.

\startuniqueMPgraphic{concept}
draw fullcircle scaled 1cm shifted (10cm,10cm);
\stopuniqueMPgraphic
\defineoverlay[concept][\uniqueMPgraphic{concept}]
\setupbackgrounds[page][background=concept]
\starttext
.
\stoptext

How should the metapost background figure be positioned correctly?

Thanks!

Best,
Sylvain
___
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] MetaFun : textext.dflt / textext.dlft and MkIV / LMTX

2021-09-05 Thread Garulfo via ntg-context

Hi,

After https://mailman.ntg.nl/pipermail/ntg-context/2021/102052.html

It seems that there is no backward compatibility between MkIV and LMTX 
for textext.dflt (MVE below)


 | MkIV  | LMTX |
-|---|--|
textext.dflt |  OK   |  KO  |   as DefauLT  (unlike ulft and llft)
textext.dlft |  KO   |  OK  |   as Default + LeFT (like ulft and llft)


For backward compatibility, would it be possible to add textext.dflt to 
LMTX as a synonym of textext.dlft ?




%


\startuseMPgraphic{MonGraphique}

StartPage ;

picture Pict ;

% Pict := textext.dlft("Brouillon DLFT") xsized (.5PaperWidth);
% OK with LMTX 2021.09.03 18:49
% KO with MkIV 2020.03.10 14:44

Pict := textext.dflt("Brouillon DFLT") xsized (.5PaperWidth);
% KO with LMTX 2021.09.03 18:49
% OK with MkIV 2020.03.10 14:44

Pict := Pict shifted (bbwidth Pict /2 , (bbheight Pict / -2) ) ;
Pict := Pict rotated 45;
Pict := Pict shifted (.5PaperWidth, .5PaperHeight) ;

draw Pict withcolor darkyellow ;

StopPage ;

\stopuseMPgraphic

%-

\defineoverlay[MonOverlay][\useMPgraphic{MonGraphique}]

\setupbackgrounds[page][background=MonOverlay]

\starttext
\input knuth
\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] paper dimensions for TEXpage

2021-08-18 Thread Hans Hagen via ntg-context

On 8/17/2021 4:01 PM, Pablo Rodriguez via ntg-context wrote:

On 8/17/21 9:30 AM, Hans Hagen via ntg-context wrote:

On 8/17/2021 5:56 AM, Pablo Rodriguez via ntg-context wrote:

[...]
I don’t get the layer in the TEXpage.

How could I get it with the TEXpage dimensions?

only by first boxing (using framed or so) and then taking those dimensions


Many thanks for your reply, Hans.

I’m afraid I don’t know how to make the commands work:

   \setupexternalfigures[location=default]
   \definelayer[hi]
[x=.5\dimexpr\framedwidth\relax, y=.5\dimexpr\framedheight\relax]
   \setupbackgrounds[page][background={foreground, hi}]
   \starttext
   \startTEXpage
   \framed[frame=off, offset=none]
   {\setlayer[hi]{\color[red]{hi}}
   \externalfigure[cow-brown]\framedheight}
   \stopTEXpage
   \stoptext

In this case, \getfiguredimensions would work, but I don’t know how to
deal with a pure text box.

BTW, is there a way to have TEXpages numbered? "pagestate=start" seems
not to work here.

for the wiki ...

\starttext

  \definelayer[hi]

  \startTEXpage[background=hi]
\setbox\scratchbox\hbox\framed
  [frame=off,offset=none,align=middle]
  {\input{tufte}}%
\setuplayer
  [hi]
  [width=\wd\scratchbox,height=\htdp\scratchbox]
\setlayer
  [hi][preset=middle]
  {\color[green]{there}}
\box\scratchbox
  \stopTEXpage

  \defineoverlay[hi]

  \startTEXpage[background=hi]
\defineoverlay
  [hi]
  [{\framed

[frame=off,offset=overlay,width=\overlaywidth,height=\overlayheight]
  {\color[red]{there}}}]
\framed
  [frame=off,offset=none,align=middle,background=hi]
  {\input{tufte}}%
  \stopTEXpage

\stoptext


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] using a red frame as an overlay

2021-08-02 Thread Jeong Dal via ntg-context
Hi,

I used red frame which is in the metafun manual for long time.
But it is not working now. 
Here is a MWE and a part of the log file.
What should I change in the definitions?

I am using "ConTeXt  ver: 2021.07.10 21:51 LMTX  fmt: 2021.7.12  int: 
english/english”.

 framed Text with title %%%
\startuseMPgraphic{redFrame}
picture p ; numeric o ; path a, b ; pair c ;
p := textext.rt(\MPstring{FrameText}) ;
o := BodyFontSize ;
a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
p := p shifted (2o,OverlayHeight-ypart center p) ;
drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
b := a superellipsed .95 ;
%fill b withcolor .85white ;
draw b ;
b := (boundingbox p) superellipsed .95 ;
fill b withcolor .85white ;  %.425green;%.
draw b ;
draw p withcolor black ;
setbounds currentpicture to a ;
\stopuseMPgraphic

\defineoverlay[rFrame][\useMPgraphic{redFrame}]

\defineframedtext[rfText]
[frame=off,
background=rFrame,
offset=\bodyfontsize,
width=\textwidth,
before=\blank,
after=\blank]

\def\StartFrame{\blank\startrfText}
\def\StopFrame {\stoprfText\blank}

\starttext

\StartFrame
This is a test for the frame. 
This is a test for the frame. 
This is a test for the frame. 
This is a test for the frame. 
This is a test for the frame. 
This is a test for the frame. 
\StopFrame
\stoptext

\starttext


log file:

fonts   > 'fallback modern-designsize rm 12pt' is loaded
tex error   > tex error on line 41 in file /Users/graph/Library/Mobile 
Documents/com~apple~CloudDocs/texMain/test.tex: Use of \meta_usempgraphic_nop 
doesn't match its definition

 
}
 \executedefinedoverlay #1#2->\bgroup \setlayoutcomponentattribute 
{\v!overlay :#1}\setbox \scratchbox \hbox \layoutcomponentboxattribute {\the 
\everyoverlay #2}
\boxxoffset \scratchbox -.5\dimexpr \wd \scratchbox -\d_framed_target_wd 
\relax \boxyoffset \scratchbox -.5\dimex
 \pack_framed_process_background_indeed_internal #1->\bgroup \setbox 
\b_framed_extra \hpack \bgroup \ifzeropt \framedbackgroundoffset \else \kern 
-\framedbackgroundoffset \fi \hbox \bgroup #1
\egroup \egroup \wd \b_framed_extra \zeropoint \ht \b_framed_extra 
\framedbackgroundheight \dp \b_framed_ext

 \m_framed_background ...background \endcsname \expandafter 
\pack_framed_process_background_indeed_internal \lastnamedcs \orelse \ifcsname 
\??overlay \m_framed_background \endcsname \expandafter 
\pack_framed_process_background_indeed_external \lastnamedcs 
\fi 

 \pack_framed_process_backgrounds #1,#2->\edef \m_framed_background 
{#1}\ifx \m_framed_background \s!unknown \else \pack_framed_process_background 
\expandafter \pack_framed_process_backgrounds \fi #2

 \p_framed_component ...s\let \foregroundbox 
\pack_framed_background_box_content \hpack \layoutcomponentboxattribute to 
\framedbackgroundwidth \bgroup \the \everybackgroundbox \expandafter 
\pack_framed_process_backgrounds \p_framed_background ,\s!unknown 
,\relax \box ...
...


 \StopFrame

31 
32 \starttext
33 
34 \StartFrame
35 This is a test for the frame. 
36 This is a test for the frame. 
37 This is a test for the frame. 
38 This is a test for the frame. 
39 This is a test for the frame. 
40 This is a test for the frame. 
41 >>  \StopFrame
42 
43 \stoptext
44 
If you say, e.g., '\def\a1{...}', then you must always put '1' after '\a',
since control sequence names are made up of letters only. The macro here has not
been followed by the required stuff, so I'm ignoring it.
mtx-context | fatal error: return code: 256___
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] Texte source 30 / 5000 Résultats de traduction Adjust the length of a frame

2021-07-26 Thread Wolfgang Schuster via ntg-context

Fabrice Couvreur via ntg-context schrieb am 26.07.2021 um 13:13:

Hello,
Following on from my previous questions for writing my book (thanks 
again Wolfgang), I have to create a solution environment like the 
attached image.

My problem is adjusting the length of the frame.
Thank you.
Fabrice

\setupbodyfont[newcomputermodern-book,11pt]

\defineframed
    [ACFRAME]
    [frame=off,
     width=fit,
     align=flushleft,
     location=low,
     background=color,
     backgroundcolor=lightgray,
     foregroundcolor=,
     foregroundstyle=]


\startuseMPgraphic{acframe}
fill OverlayBox
leftenlarged (BackSpace + 5mm)
rightenlarged ExHeight
withcolor "lightgray";
setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
  [acframe]
  [\useMPgraphic{acframe}]

\defineframed
   [ACFRAME]
   [...,
background=acframe,
...]

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] Every odd row with a background color with extreme tables?

2021-07-23 Thread T. Kurt Bond
Thanks, this has been very helpful.

On Fri, Jul 23, 2021 at 1:02 PM Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> T. Kurt Bond schrieb am 23.07.2021 um 17:55:
> > With natural tables I can define a color, tell the table to have to
> > use color backgrounds and turn the frame off and get every odd row in
> > all my tables will have that color for the background.
> >
> > == Example
> 
> > \definecolor[grayback][r=.8,g=.8,b=.8]
> > \setupTABLE[background=color,frame=off]
> > \setupTABLE[row][odd][backgroundcolor=grayback]
> > == End of Example
> =
> >
> > Can I get this same effect with extreme tables?
> >
> > My first try with extreme tables looked like this:
> >
> > == Example
> 
> > \definecolor[tablebackground][r=.8,g=.8,b=.8]
> > \setupxtable[background=color,frame=off]
> > \setupxtable[row][odd][backgroundcolor=tablebackground]
> > == End of Example
> =
> >
> > That didn't seem to have any effect.
> >
> > Is there a way to have every odd row of every table in my document
> > have color background?
>
> \startuseMPgraphic{xtablerow}
>  fill OverlayBox withcolor "gray";
> \stopuseMPgraphic
>
> \defineoverlay
>[xtablerow]
>[\ifodd\currentxtablerow
>   \useMPgraphic{xtablerow}%
> \fi]
>
> \starttext
>
> \startxtable[frame=off,background=xtablerow]
> \dorecurse{20}
>{\startxrow
>   \startxcell Column 1 \stopxcell
>   \startxcell Column 2 \stopxcell
> \stopxrow}
> \stopxtable
>
> \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
>
> ___
>


-- 
T. Kurt Bond, tkurtb...@gmail.com, https://tkurtbond.github.io
___
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] Every odd row with a background color with extreme tables?

2021-07-23 Thread Wolfgang Schuster

T. Kurt Bond schrieb am 23.07.2021 um 17:55:

With natural tables I can define a color, tell the table to have to
use color backgrounds and turn the frame off and get every odd row in
all my tables will have that color for the background.

== Example 
\definecolor[grayback][r=.8,g=.8,b=.8]
\setupTABLE[background=color,frame=off]
\setupTABLE[row][odd][backgroundcolor=grayback]
== End of Example =

Can I get this same effect with extreme tables?

My first try with extreme tables looked like this:

== Example 
\definecolor[tablebackground][r=.8,g=.8,b=.8]
\setupxtable[background=color,frame=off]
\setupxtable[row][odd][backgroundcolor=tablebackground]
== End of Example =

That didn't seem to have any effect.

Is there a way to have every odd row of every table in my document
have color background?


\startuseMPgraphic{xtablerow}
fill OverlayBox withcolor "gray";
\stopuseMPgraphic

\defineoverlay
  [xtablerow]
  [\ifodd\currentxtablerow
 \useMPgraphic{xtablerow}%
   \fi]

\starttext

\startxtable[frame=off,background=xtablerow]
\dorecurse{20}
  {\startxrow
 \startxcell Column 1 \stopxcell
 \startxcell Column 2 \stopxcell
   \stopxrow}
\stopxtable

\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] Header for a book

2021-07-13 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 12.07.2021 um 16:32:

Hi,
For my book, the header for each chapter should be like the attached 
image. I don't know if I am using the best method, but the result looks 
like what I want. Nevertheless, I am having some problems :

1. the header appears on each page ;
2. the title of the chapter should not appear in the body of the text.
Thanks for your help.
Fabrice

[...]



You can use the following example as a start.


\definefont
  [ChapterNumberStyle]
  [Sans*default,uppercasing sa 1.5]

\definefont
  [ChapterTextStyle]
  [SansBold*default sa 2.2]

\startuseMPgraphic{chapterframe}
fill OverlayBox
leftenlarged (BackSpace + 5mm)
rightenlarged (CutSpace + 5mm)
topenlarged (TopSpace + 5mm)
withcolor "lightgray";
setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
  [chapterframe]
  [\useMPgraphic{chapterframe}]

\defineframedtext
  [ChapterFrame]
  [frame=off,
   background=chapterframe,
   width=max,
   height=6cm,
   after={\blank[2*line]},
   offset=0pt]

\setuphead
  [chapter]
  [align=flushright,
   textcommand=\groupedcommand{\blank[medium]}{},
   numbercolor=darkgray,
   textstyle=ChapterTextStyle,
   numberstyle=ChapterNumberStyle,
   before=\startChapterFrame,
   after=\stopChapterFrame,
   header=high]

\setuplabeltext
  [fr]
  [chapter=Chapitre ]

\mainlanguage
  [fr]

\starttext

\chapter {La récurrence}

\samplefile{lorem}

\chapter {Combinatoire-Dénombrement}

\samplefile{lorem}

\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

2021-06-01 Thread Hans Hagen

On 5/31/2021 9:04 PM, Aditya Mahajan wrote:

On Mon, 31 May 2021, Hans Hagen wrote:


On 5/31/2021 6:50 PM, Aditya Mahajan wrote:

On Mon, 31 May 2021, Hans Hagen wrote:


Hi,

I uploaded a new lmtx version. This time a new mechanism.


This is very interesting...I haven't played around with it, but is it the
case that \markanchor does not do alignment and so can completely replace
the old \hpos{...} class of macros?

This also gives many interesting possibilities for math  drawing "boxes"
in matrices (e.g.,
https://tex.stackexchange.com/questions/333011/draw-a-box-around-matrix-elements)
or even the nath style `\wall` macro (see pg 11 of
https://texdoc.org/serve/nathguide.pdf/0) ... Of course, I mean this in
terms of the visual effect and not the interface.

Like this ... I'll think about taking some size into account (a bit like hpos
does).


Yes! If we can take size of cell into account, it will be perfect.

We can also think of a wrapper so that an explicit \framed is not needed.

new upload with nesxt step

\starttext

\startuseMPgraphic{whatever-5}
fill OverlayBox withcolor "lightgray" ;
draw matrixbox (1, 1) (2, 1) withpen pencircle scaled 1pt withcolor 
"blue" ;
draw matrixbox (2, 2) (4, 4) withpen pencircle scaled 1pt withcolor 
"red" ;
% drawdot anchorxy("matrix", 3, 4) withpen pencircle scaled 4pt 
withcolor "green";

setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[whatever-5][\useMPgraphic{whatever-5}]

\framed
  [synchronize=background,
   align=normal,
   frame=off,
   background=whatever-5]
  {\setmathmatrixanchoring[both]% left|right|both|yes
%   {\setmathmatrixanchoring[right]% left|right|both|yes
   \startmathmatrix
  \NC a1 \NC a   \NC b   \NC c\NR
  \NC a2 \NC a   \NC b   \NC c\NR
  \NC a3 \NC a^2 \NC b   \NC c\NR
  \NC a4 \NC a   \NC b_2 \NC c\NR
  \NC a5 \NC a   \NC b   \NC c\NR
  \NC a6 \NC a   \NC b   \NC c\NR
  \stopmathmatrix}

\blank

\startuseMPgraphic{whatever-5}
fill OverlayBox withcolor "darkgray" ;
draw matrixbox (1, 1) (2, 1) enlarged OverlayOffset shifted 
paired(OverlayOffset) withpen pencircle scaled 1pt withcolor "blue" ;
draw matrixbox (2, 2) (4, 4) enlarged OverlayOffset shifted 
paired(OverlayOffset) withpen pencircle scaled 1pt withcolor "red" ;

setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\framed
  [synchronize=background,
   align=normal,
   frame=off,
   background=whatever-5,
   backgroundoffset=.5ex,
   foregroundcolor=white]
  {\setmathmatrixanchoring[yes]% left|right|both|yes
   \startmathmatrix
  \NC a1 \NC a   \NC b   \NC c\NR
  \NC a2 \NC a   \NC b   \NC c\NR
  \NC a3 \NC a^2 \NC b   \NC c\NR
  \NC a4 \NC a   \NC b_2 \NC c\NR
  \NC a5 \NC a   \NC b   \NC c\NR
  \NC a6 \NC a   \NC b   \NC c\NR
  \stopmathmatrix}

\stoptext

as a side track / distraction I added italic correction prevention, as 
shown in:


\starttext

\startTEXpage[offset=10pt] \showglyphs
\startcombination[nx=3,ny=1]
\startcontent \framed[strut=no,align=normal,offset=1ex]\bgroup 
\showmakeup[math,kern]%

$a = b + c$\par
$b = c + d$\par
$c = e + f$\par
\egroup \stopcontent
\startcaption
italic correction
\stopcaption
\startcontent \framed[strut=no,align=normal,offset=1ex]\bgroup 
\showmakeup[math,kern]%

\noitaliccorrection
$a = b + c$\par
$b = c + d$\par
$c = e + f$\par
\egroup \stopcontent
\startcaption
no italic correction
\stopcaption
\startcontent \framed[strut=no,align=normal,offset=1ex]\bgroup 
\showmakeup[math,kern]%

$a = b + c$\par
$\noitaliccorrection b = c + d$\par
$c = e + f$\par
\egroup \stopcontent
\startcaption
selected correction
\stopcaption
\stopcombination
\stopTEXpage

\stoptext

but of course different width are still a reason why this doesn't align

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

2021-05-31 Thread Hans Hagen

On 5/31/2021 6:50 PM, Aditya Mahajan wrote:

On Mon, 31 May 2021, Hans Hagen wrote:


Hi,

I uploaded a new lmtx version. This time a new mechanism.


This is very interesting...I haven't played around with it, but is it the case 
that \markanchor does not do alignment and so can completely replace the old 
\hpos{...} class of macros?

This also gives many interesting possibilities for math  drawing "boxes" in 
matrices (e.g., 
https://tex.stackexchange.com/questions/333011/draw-a-box-around-matrix-elements) or even 
the nath style `\wall` macro (see pg 11 of https://texdoc.org/serve/nathguide.pdf/0) ... 
Of course, I mean this in terms of the visual effect and not the interface.
Like this ... I'll think about taking some size into account (a bit like 
hpos does).


\starttext

\startuseMPgraphic{whatever-1}
fill OverlayBox withcolor "lightgray" ;
drawdot anchorxy("one", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("one", 0, 2)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("two", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("two", 0, 2)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("three", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{whatever-2}
pair a ; a := anchorxy("one", 0, 1) ;
pair b ; b := anchorxy("one", 0, 2) ;
drawarrow
anchorxy("one", 0, 1) { right } ..
anchorxy("one", 0, 2)
withcolor "blue" withtransparency (1,.75) ;
drawarrow
anchorxy("two", 0, 1) { down } ..
anchorxy("two", 0, 2)
withcolor "blue" withtransparency (1,.75) ;
drawarrow
    anchorxy("two", 0, 1) { dir 30 } ..
    anchorxy("three", 0, 1)
withcolor "blue" withtransparency (1,.75) ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[whatever-1][\useMPgraphic{whatever-1}]
\defineoverlay[whatever-2][\useMPgraphic{whatever-2}]

\framed
  [synchronize=yes,
   align=normal,
   offset=10pt,
   frame=off,
   background={whatever-1,foreground,whatever-2}]
  {\startmathmatrix
  \NC \markanchor{two}{0}{1}a \NC b \NC c\NR
  \NC a \NC b \NC c\NR
  \NC a \NC \markanchor{one}{0}{1}b \NC c\NR
  \NC \markanchor{one}{0}{2}a \NC b \NC \markanchor{two}{0}{2}c\NR
  \NC a \NC \markanchor{three}{0}{1}b \NC c\NR
  \stopmathmatrix}

\startuseMPgraphic{whatever-3}
pair a ; a := anchorxy("a", 0, 1) ;
pair b ; b := anchorxy("a", 0, 2) ;
draw boundingbox (a--b)
leftenlarged .25EmWidth
rightenlarged EmWidth
topenlarged StrutHeight
bottomenlarged .5StrutDepth
withcolor "blue" withtransparency (1,.75) ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[whatever-3][\useMPgraphic{whatever-3}]

\framed
  [synchronize=yes,
   align=normal,
   offset=10pt,
   frame=off,
   background=whatever-3]
  {\startmathmatrix
  \NC a \NC a \NC   b \NC c\NR
  \NC a \NC a \NC   b \NC c\NR
  \NC a \NC \markanchor{a}{0}{1}a \NC   b \NC c\NR
  \NC a \NC a \NC \markanchor{a}{0}{2}b \NC c\NR
  \NC a \NC a \NC   b \NC c\NR
  \NC a \NC a \NC   b \NC c\NR
  \stopmathmatrix}

\stoptext

The \markanchor{a}{0}{1 can be wrapped in a simpler one, or we can have 
something \markedanchor{a}{2}{b} but that need a little thinking because 
we don't want to mess too much with math spacing. Actually we can 
consider (in this case) \MC[a,2] or so although these are probabbly not 
features used that often.


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
___


[NTG-context] new upload

2021-05-31 Thread Hans Hagen

Hi,

I uploaded a new lmtx version. This time a new mechanism.

-
From an upcoming details chapter:
-

The mechanism described here is still experimental. Although it could be 
implemented in \MKIV\ it is only available in \LMTX. Already early in 
\MKII\ we had a positioning mechanism available. At that time we had 
\DVI\ output and specials were used to track positions. A script 
calculated the positions that were then fed back into the second run. 
Later Taco wrote \DVIPOS\ which sped up the analysis between runs. When 
\PDFTEX\ showed, an equivalent positioning mechanism was added there. In 
\MKIV\ positioning support was optimized a bit as part of the upgrading 
process but the principles remained the same. The interface to 
positioning comes with a lot of commands and many of them relate to what 
we want to do with \METAFUN. The alternative interface discussed here is 
a bit simpler and has (at least now) less commands and, combined with 
local name spaces, can be easier to use in more local situations. It's 
also integrated in the frequently used \type {\framed} commands and has 
basic support at the \METAFUN\ end. The performance is comparable to the 
regular positioning mechanisms but especially at the \METAPOST\ end has 
less overhead.


-
Here are some examples:
-

\framed [synchronize=yes,align=normal] {%
  test test test 1  \sync{one}{1}test test 2  \crlf
  test test 1   \sync{one}{1}test test test 2 \crlf
  test 1\sync{one}{1}test 2   \crlf
  test test test test 1 \sync{one}{1}test test 2
}

\framed [synchronize=yes,align=normal] {%
one one \sync{a}{1}two \sync{a}{2}three \crlf
one one \sync{a}{1}two two \sync{a}{2}three \crlf
one \sync{a}{1}two \sync{a}{2}three \crlf
one one one \sync{a}{1}two \sync{a}{2}three
}

\framed [synchronize=yes,align=normal] {%
\syncanchor{one}{1}{1}A
\syncanchor{one}{2}{1}BBB
\syncanchor{one}{3}{1}C \crlf
\syncanchor{one}{1}{2}AA
\syncanchor{one}{3}{2}C \crlf
\syncanchor{one}{1}{3}AAA
\syncanchor{one}{2}{3}BB
\syncanchor{one}{3}{3}C
}

\framed [synchronize=yes,align=normal] {%
\alignanchor{one}{1}{1}{l}A
\alignanchor{one}{1}{2}{m}AA
\alignanchor{one}{1}{3}{r}AAA
\syncanchor {one}{1}{4}\crlf
\alignanchor{one}{2}{1}{right}B
\alignanchor{one}{2}{2}{middle}BB
\alignanchor{one}{2}{3}{left}BBB
\syncanchor {one}{2}{4}
}

\startuseMPgraphic{whatever-1}
fill OverlayBox withcolor "lightgray" ;
drawdot anchorxy("one", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("one", 0, 2)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("two", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("two", 0, 2)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("three", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{whatever-2}
pair a ; a := anchorxy("one", 0, 1) ;
pair b ; b := anchorxy("one", 0, 2) ;
drawarrow
anchorxy("one", 0, 1) { right } ..
anchorxy("one", 0, 2)
withcolor "blue" withtransparency (1,.75) ;
drawarrow
anchorxy("two", 0, 1) { down } ..
anchorxy("two", 0, 2)
withcolor "blue" withtransparency (1,.75) ;
drawarrow
    anchorxy("two", 0, 1) { dir 30 } ..
    anchorxy("three", 0, 1)
withcolor "blue" withtransparency (1,.75) ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[whatever-1][\useMPgraphic{whatever-1}]
\defineoverlay[whatever-2][\useMPgraphic{whatever-2}]

\framed
  [synchronize=yes,
   align=normal,
   offset=10pt,
   frame=off,
   background={whatever-1,foreground,whatever-2}]
  {%
\markanchor{two}{0}{1}{\red\bf foo}%
\markanchor{one}{0}{1} bar rab oof\crlf
foo bar rab oof\crlf
oof rab bar foo\crlf
oof rab \markanchor{two}{0}{2}{\red\bf bar}%
\markanchor{one}{0}{2} foo%
\markanchor{three}{0}{1}%
  }

\framed
  [synchronize=yes,
   align=normal,
   offset=10pt,
   frame=off,
   background={whatever-1,foreground,whatever-2}]
  {%
one one one \syncanchor{a}{1}{1}two two two
\syncanchor{a}{2}{1}three three\par
one \syncanchor{a}{1}{2}two
\syncanchor{a}{2}{2}three\par
one \syncanchor{a}{1}{3}two
\syncanchor{a}{2}{3}three\par
\blank
\markanchor{two}{0}{1}{\red\bf foo}%
\markanchor{one}{0}{1} bar rab 

Re: [NTG-context] Fuzzy lines

2021-05-13 Thread Thomas A. Schmitz

On 5/13/21 8:02 PM, Henning Hraban Ramm wrote:

Unfortunately, the deviation of edge points is too big – try my attached test 
file.

Strangely, if I include the MP code in a ConTeXt document,


I find the discussion interesting. Could you send complete documents, 
like Aditya did? When I try to compile your files, I get all sorts of 
errors, so I suspect they are not complete. Would be appreciated if you 
could send a ConTeXt document. I'm still not quite sure what you're 
looking for...


Thomas

\setupbodyfont[20pt]

\showframe

\startuseMPgraphic{fuzzy}

path p ; p := (0,0) -- (0,OverlayHeight) -- (OverlayWidth,OverlayHeight) --
(OverlayWidth,0) -- cycle ;

pickup pencircle scaled .5pt ;

for i=1 upto 20 :
 draw p enlarged -5pt randomized 15pt withcolor blue ;
endfor ;

\stopuseMPgraphic

\defineoverlay [Fuzzy] [\useMPgraphic{fuzzy}]

\startTEXpage


\framed [height=20cm,width=12cm,frame=on,background=Fuzzy,align={middle,lohi}]
{Test}

\stopTEXpage

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
___


[NTG-context] working on page refs with MP

2021-03-18 Thread Werner Hennrich

Hello everyone,

I'm having page references and want to calc / draw 'Page x of y' for
some subsections in MP.
How can I pass 'em down so I end up with numbers to do calculations with?

   \setuplayout[header=15mm]
   \def\myHeader[#1]#2{
   \ignorespaces
   \getdummyparameters[ref=,next=,#1]
   \pagebreak[yes]
   \pagereference[\dummyparameter{ref}]
   \doassign[header][first=\dummyparameter{ref}]
   \doassign[header][next=\dummyparameter{next}]
   {\tfc\bf{#2}}\par
   \vskip3mm
   }
   \def\fillWithText[#1]{
   \dorecurse{#1}{
   \input tufte
   \input knuth
   }
   }
   \setupheadertexts[\setups{page:header}]%
   \startsetups page:header
   \setupMPvariables[hdrPgs]
   [curr=\pagenumber,
   first={\ref[page][\headerfirst]},
   next={\ref[page][\headernext]}]
   \framed[
   frame=off,
   background={hdrPgs}
   ]{}% all to be done in MP
   \stopsetups
   \defineoverlay[hdrPgs][\useMPgraphic{hdrPgs}]
   \startuseMPgraphic{hdrPgs}
   StartPage; % calc and draw 'Page x of y'
   numeric numCurr; numCurr := \MPvar{curr};
   string strFirst; strFirst := "\MPvar{first}";
   string strNext; strNext := "\MPvar{next}";
   message("===");
   message("MP_hdrPageNrs: curr="& tostring numCurr & ", sFirst="&
   strFirst & ", sNext="& strNext);
   % fails:
   numeric numFirst; numFirst := \MPvar{first};
   StopPage;
   \stopuseMPgraphic
   \starttext
   \myHeader[ref=a,next=b]{  AaAaAaAa}
   \fillWithText[10]
   \myHeader[ref=b,next=c]{  BbBbBbBbBb}
   \fillWithText[3]
   \myHeader[ref=c,next=d]{ c CcCcCcCc}
   \fillWithText[8]
   \myHeader[ref=c,next=last]{ d DdDdDdDdDd}
   \fillWithText[8]
   \pagebreak[yes]
   \pagereference[last]
   This is the last page, goodby
   \stoptext

metapost    > message : MP_hdrPageNrs: curr=1, sFirst=\ref
[page][a], sNext=\ref [page][b]
metafun > log >
metafun > log > error: Improper subscript has been replaced by zero
metapost    > log > <*> ... numeric numFirst; numFirst := \ref [page]
metafun > log >
metafun > log > A bracketed subscript must have a known numeric
value;

So MP gets the macro and tries array access... I tried \expanded,
\numeric, and resolving the page numbers via \ref[page][id] at the
various code levels - unsuccessfully so far - and out of wit now.

TIA, Werner


___
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] Center a text (Metafun)

2021-03-06 Thread Fabrice Couvreur
Hi Hans,
Some time ago, you offered this code to respond to a specific request from
me. I used this code again and wanted to know if it was possible for the
title "Algorithm" to be automatically centered based on the content.
Thank you
Fabrice


\definecolor[MyBlue][c=0.2 , m=0.03, y=0.00, k=0.00]

\definecolor[maincolor] [b=.5]

\defineframedtext
   [MyFrame]
   [frame=off,
background=MyFrame,
width=fit,
height=fit,
style=small]

\startuseMPgraphic{MyFrame}
 path b;
 picture p;
 p := textext.rt("\tfx\bf\white\framedtextparameter{Title}");
 p := p shifted (2BodyFontSize,OverlayHeight-ypart center
p+.25ExHeight);
 b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth
topenlarged .5EmWidth bottomenlarged .5EmWidth ;
 fill OverlayBox withcolor "MyBlue" ;
 fill b withcolor \MPcolor{maincolor} ;
 draw p ;
 setbounds currentpicture to boundingbox currentpicture enlarged 2mm ;
\stopuseMPgraphic

\defineoverlay
   [MyFrame]
   [\useMPgraphic{MyFrame}]
\starttext
\MyFrame[Title=Algorithme]{%
 \m{a\gets 2x-1}

  \m{b\gets a²-1}

  \m{c\gets b\div 4}

  \m{d\gets c-a+x}
  }
\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] Lua code and table

2021-02-17 Thread Tomas Hala
Hi Fabrice,

see below, I attached two ideas how to do it.

The best,

Tomáš

Wed, Feb 17, 2021 ve 06:40:54PM +0100 Fabrice Couvreur napsal(a):
#Hi,  The code works, but is it possible to make it shorter ?
#Thank you
#Fabrice
#\startuseMPgraphic{DiagonalRule}
#   rulethickness := \frameddimension{rulethickness};
# 
#   drawoptions(
#     withpen pencircle scaled rulethickness
#     withcolor \MPcolor{\framedparameter{framecolor}});
# 
#   pair leftcorner, rightcorner, Leftcorner, Rightcorner;
#   leftcorner  := (rulethickness, \overlayheight-rulethickness);
#   rightcorner := (\overlaywidth-rulethickness, rulethickness);
#   Leftcorner  := ( rulethickness, rulethickness);
#   Rightcorner :=
#(\overlaywidth-rulethickness,\overlayheight-rulethickness);
# 
#   draw leftcorner -- rightcorner;
#   draw Leftcorner -- Rightcorner;
# \stopuseMPgraphic
# 
#\defineoverlay
#  [DiagonalRule]
#  [\useMPgraphic{DiagonalRule}]
# 
#\define[2]\DiagonalLabel{%
#  \setuptabulate [after={\blank[\frameddimension{offset}]}]
#  \starttabulate [|p|r|]
#    \NC    \NC \bf #2 \NC\NR
#    \NC \bf #1 \NC    \NC\NR
#  \stoptabulate
#}
#\starttext
#\startluacode
#  local background_one = {
#   align = "middle",
#   style = "type",
#   background = "DiagonalRule",
#  }
# 
#  local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H" }
#  context.startxtable({"align={middle,lohi},
#width=0.8cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"})
#  context.startxrow()
#  context.startxcell({"frame=off"})
#  context()
#  context.stopxcell()
#  for _, letter in ipairs(letters_1) do
#    context.startxcell()
#    context(letter) context.stopxcell()
#  end
#  context.stopxrow()
#   for _, letter in ipairs(letters_1) do
#  context.startxrow()
#    context.startxcell()
#    context(letter)
#    context.stopxcell()
#  for j = 0, 7 do
#  context.startxcell(  j == 0 and letter == "B" and background_one
#  or j == 0 and letter == "C" and background_one
#  or j == 0 and letter == "D" and background_one
#  or j == 0 and letter == "G" and background_one
#  or j == 0 and letter == "H" and background_one
#  or j == 1 and letter == "A" and background_one
#  or j == 1 and letter == "E" and background_one
#  or j == 1 and letter == "F" and background_one
#  or j == 1 and letter == "G" and background_one
#  or j == 2 and letter == "A" and background_one
#  or j == 2 and letter == "D" and background_one
#  or j == 2 and letter == "F" and background_one
#  or j == 2 and letter == "G" and background_one
#  or j == 2 and letter == "H" and background_one
#  or j == 3 and letter == "A" and background_one
#  or j == 3 and letter == "C" and background_one
#  or j == 3 and letter == "E" and background_one
#  or j == 3 and letter == "H" and background_one
#  or j == 4 and letter == "B" and background_one
#  or j == 4 and letter == "D" and background_one
#  or j == 4 and letter == "F" and background_one
#  or j == 4 and letter == "G" and background_one
#  or j == 5 and letter == "B" and background_one
#  or j == 5 and letter == "C" and background_one
#  or j == 5 and letter == "E" and background_one
#  or j == 6 and letter == "A" and background_one
#  or j == 6 and letter == "B" and background_one
#  or j == 6 and letter == "C" and background_one
#  or j == 6 and letter == "E" and background_one
#  or j == 7 and letter == "A" and background_one
#  or j == 7 and letter == "C" and background_one
#  or j == 7 and letter == "D" and background_one
#  )
#  context()
#  context.stopxcell()
#  end
#  context.stopxrow()
#  end
#  context.stopxtable()
#\stopluacode
#\stoptext

%%%=
\starttext
\startluacode

function test()
  for x=0,7 do 
for y=65,72 do 
  local yy=string.char(y)
  context(x)  
  context(" "..yy)
  context(f1(x,yy)..f2(x,yy)..f3(x,yy))
  context.par()
  end end
end

local background_one = true

function f1 (j,letter)
  local res=
   j == 0  and  letter == "B"  and  background_one  
or j == 0  and  letter == "C"  and  background_one 
or j == 0  and  letter == "D"  and  background_one 
or j == 0  and  letter == "G"  and  background_o

[NTG-context] Lua code and table

2021-02-17 Thread Fabrice Couvreur
Hi, The code works, but is it possible to make it shorter ?
Thank you
Fabrice


\startuseMPgraphic{DiagonalRule}
   rulethickness := \frameddimension{rulethickness};

   drawoptions(
 withpen pencircle scaled rulethickness
 withcolor \MPcolor{\framedparameter{framecolor}});

   pair leftcorner, rightcorner, Leftcorner, Rightcorner;
   leftcorner  := (rulethickness, \overlayheight-rulethickness);
   rightcorner := (\overlaywidth-rulethickness, rulethickness);
   Leftcorner  := ( rulethickness, rulethickness);
   Rightcorner :=
(\overlaywidth-rulethickness,\overlayheight-rulethickness);

   draw leftcorner -- rightcorner;
   draw Leftcorner -- Rightcorner;
 \stopuseMPgraphic

\defineoverlay
  [DiagonalRule]
  [\useMPgraphic{DiagonalRule}]

\define[2]\DiagonalLabel{%
  \setuptabulate [after={\blank[\frameddimension{offset}]}]
  \starttabulate [|p|r|]
\NC\NC \bf #2 \NC\NR
\NC \bf #1 \NC\NC\NR
  \stoptabulate
}
\starttext
\startluacode
  local background_one = {
   align = "middle",
   style = "type",
   background = "DiagonalRule",
  }

  local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H" }
  context.startxtable({"align={middle,lohi},
width=0.8cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"})
  context.startxrow()
  context.startxcell({"frame=off"})
  context()
  context.stopxcell()
  for _, letter in ipairs(letters_1) do
context.startxcell()
context(letter) context.stopxcell()
  end
  context.stopxrow()
   for _, letter in ipairs(letters_1) do
  context.startxrow()
context.startxcell()
context(letter)
context.stopxcell()
  for j = 0, 7 do
  context.startxcell(  j == 0 and letter == "B" and background_one
  or j == 0 and letter == "C" and background_one
  or j == 0 and letter == "D" and background_one
  or j == 0 and letter == "G" and background_one
  or j == 0 and letter == "H" and background_one
  or j == 1 and letter == "A" and background_one
  or j == 1 and letter == "E" and background_one
  or j == 1 and letter == "F" and background_one
  or j == 1 and letter == "G" and background_one
  or j == 2 and letter == "A" and background_one
  or j == 2 and letter == "D" and background_one
  or j == 2 and letter == "F" and background_one
  or j == 2 and letter == "G" and background_one
  or j == 2 and letter == "H" and background_one
  or j == 3 and letter == "A" and background_one
  or j == 3 and letter == "C" and background_one
  or j == 3 and letter == "E" and background_one
  or j == 3 and letter == "H" and background_one
  or j == 4 and letter == "B" and background_one
  or j == 4 and letter == "D" and background_one
  or j == 4 and letter == "F" and background_one
  or j == 4 and letter == "G" and background_one
  or j == 5 and letter == "B" and background_one
  or j == 5 and letter == "C" and background_one
  or j == 5 and letter == "E" and background_one
  or j == 6 and letter == "A" and background_one
  or j == 6 and letter == "B" and background_one
  or j == 6 and letter == "C" and background_one
  or j == 6 and letter == "E" and background_one
  or j == 7 and letter == "A" and background_one
  or j == 7 and letter == "C" and background_one
  or j == 7 and letter == "D" and background_one
  )
  context()
  context.stopxcell()
  end
  context.stopxrow()
  end
  context.stopxtable()
\stopluacode
\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] Are positional graphics still working?

2021-02-17 Thread Jairo A. del Rio
It works fine now. Thank you a lot for the fix.

Cordially,

Jairo :)

El mié, 17 de feb. de 2021 a la(s) 06:09, Hans Hagen (j.ha...@xs4all.nl)
escribió:

> On 2/17/2021 12:18 AM, Jairo A. del Rio wrote:
> > I've copied the following example from the ConTeXt archive:
> >
> > \defineoverlay[frames][\positionoverlay{frames}]
> >
> > \setupbackgrounds[text][background=frames]
> >
> >
> > \startMPpositiongraphic{frame}
> >
> > if unknown context_apos : input mp-apos.mpiv ; fi ;
> >
> > \MPgetposboxes{\MPvar{self}}{\MPanchorid}
> >
> > if nofposboxes = 1 :
> >
> > draw posboxes[1] ;
> >
> > fi ;
> >
> > \stopMPpositiongraphic
> >
> >
> > \startpositionoverlay{frames}
> >
> > \setMPpositiongraphic{one}{frame}
> >
> > \setMPpositiongraphic{two}{frame}
> >
> > \stoppositionoverlay
> >
> >
> > \starttext
> >
> > This \hpos{one}{word} should be \hpos{two}{framed}.
> >
> > \stoptext
> >
> > Frames are misplaced, so I don't know if that's a bug or something else
> > has been updated/changed/deprecated. Thank you in advance.
> As a step-up to further integrated (more lmtx-ish) support for this the
> next upload will have this:
>
> \defineoverlay[frames][\positionoverlay{frames}]
>
> \setupbackgrounds[text][background=frames]
>
> \startMPpositiongraphic{frame}
>  getposboxes("self","anchor") ;
>  if nofposboxes = 1 :
>  draw posboxes[1] ;
>  fi ;
> \stopMPpositiongraphic
>
> \startpositionoverlay{frames}
>  \setMPpositiongraphic{one}{frame}
>  \setMPpositiongraphic{two}{frame}
> \stoppositionoverlay
>
> \starttext
>  This \hpos{one}{\strut word} should \hpos{two}{\strut also be framed}.
> \stoptext
>
> 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] Are positional graphics still working?

2021-02-17 Thread Hans Hagen

On 2/17/2021 12:18 AM, Jairo A. del Rio wrote:

I've copied the following example from the ConTeXt archive:

\defineoverlay[frames][\positionoverlay{frames}]

\setupbackgrounds[text][background=frames]


\startMPpositiongraphic{frame}

if unknown context_apos : input mp-apos.mpiv ; fi ;

\MPgetposboxes{\MPvar{self}}{\MPanchorid}

if nofposboxes = 1 :

draw posboxes[1] ;

fi ;

\stopMPpositiongraphic


\startpositionoverlay{frames}

\setMPpositiongraphic{one}{frame}

\setMPpositiongraphic{two}{frame}

\stoppositionoverlay


\starttext

This \hpos{one}{word} should be \hpos{two}{framed}.

\stoptext

Frames are misplaced, so I don't know if that's a bug or something else 
has been updated/changed/deprecated. Thank you in advance.
As a step-up to further integrated (more lmtx-ish) support for this the 
next upload will have this:


\defineoverlay[frames][\positionoverlay{frames}]

\setupbackgrounds[text][background=frames]

\startMPpositiongraphic{frame}
getposboxes("self","anchor") ;
if nofposboxes = 1 :
draw posboxes[1] ;
fi ;
\stopMPpositiongraphic

\startpositionoverlay{frames}
\setMPpositiongraphic{one}{frame}
\setMPpositiongraphic{two}{frame}
\stoppositionoverlay

\starttext
This \hpos{one}{\strut word} should \hpos{two}{\strut also be framed}.
\stoptext

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
___


[NTG-context] Are positional graphics still working?

2021-02-16 Thread Jairo A. del Rio
I've copied the following example from the ConTeXt archive:

\defineoverlay[frames][\positionoverlay{frames}]

\setupbackgrounds[text][background=frames]


\startMPpositiongraphic{frame}

if unknown context_apos : input mp-apos.mpiv ; fi ;

\MPgetposboxes{\MPvar{self}}{\MPanchorid}

if nofposboxes = 1 :

draw posboxes[1] ;

fi ;

\stopMPpositiongraphic


\startpositionoverlay{frames}

\setMPpositiongraphic{one}{frame}

\setMPpositiongraphic{two}{frame}

\stoppositionoverlay


\starttext

This \hpos{one}{word} should be \hpos{two}{framed}.

\stoptext

Frames are misplaced, so I don't know if that's a bug or something else has
been updated/changed/deprecated. Thank you in advance.

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

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


Re: [NTG-context] MetaFun - "remove the paths of text" from a rectangle to let the background visible

2020-12-23 Thread Hans Hagen

On 12/24/2020 12:14 AM, Garulfo wrote:

Thanks Taco,

I made some progress :
https://wiki.contextgarden.net/Talk:Cover_Pages

I now have two additional questions ... ;-)

- How can I deal with "space" characters (because current solution
   requires to explicitly add the ~ character)

- What would be the work to do in order to make this mechanism directly
   usable in metapost / metafun, within \startMPpage \stopMPpage,
   - to avoid switching between \start\stopMPdrawing and TeX
   - to have something like "draw followtext" in mp-blob.mpiv ?



Maybe pickup some tricks from this:

\starttext

\startMPpage
StartPage;

fill Page
   withshademethod "linear"
   withshadedirection(0,1)
   withshadecolors (red, blue) ;

picture p ; p := lmt_outline [
text  = "\strut foo f o o",
drawcolor = "white",
rulethickness = .2
] ysized 5cm ;

draw (p shifted - center p) shifted center Page;

StopPage;
\stopMPpage

\startuseMPgraphic{MyShade}
fill OverlayBox
   withshademethod "linear"
   withshadedirection(0,1)
   withshadecolors (red, blue) ;
\stopuseMPgraphic

\defineoverlay[MyShade][\useMPgraphic{MyShade}]

\setupbackgrounds[page][background=MyShade]

\startmakeup

\definedfont[SerifBold*default @ 50pt] \setupinterlinespace

\defineeffect[MyOutline][alternative=outer,rulethickness=1pt]

\startcolor[white]
\starteffect[MyOutline]
\input jojomayer
\stopeffect
\stopcolor

\stopmakeup

\stoptext

%-- 



\setuppapersize  [A4]

%-- 



\def\MyFont{\definedfont[name:%
texgyrepagellabold%
%exo2black%
%agaramondprobold%
*default at 55pt]}

%-- 



\startluacode

function document.outlinepaths(character)
     local chardata  = fonts.hashes.characters[true] -- by unicode
     local shapedata = fonts.hashes.shapes[true] -- by index
     local c = chardata[character]
     if c and c.index and shapedata then
     local shapeglyphs = shapedata.glyphs or { }
     local glyph   = shapeglyphs[c.index]
     if glyph and (glyph.segments or glyph.sequence) then
     local units  = shapedata.units or 1000
     local factor = 100/units
     return fonts.metapost.paths(glyph,factor)
     end
     end
     return { }
end

function document.defineoutline(char,target)
     local outlines = document.outlinepaths(char)
     local nofpaths = #outlines
     context("\\startMPdrawing") -- ADDED by 
garulfo

     context("path %s[] ;",target)
     context("numeric %sn ; %sn := %s ;",target,target,nofpaths)
     for i=1,nofpaths do
     context("%s[%i] := %s ; ",target,i,outlines[i])
     end
     context("\\stopMPdrawing")  -- ADDED by 
garulfo

end

\stopluacode

%-- 



\def\mpdefineoutlines#1#2{\ctxlua{document.defineoutline(\number`#1,"#2")}}

%-- 



\def\EmptyLetters#1%
{%
\resetMPdrawing
\MPtoks={}
%
\startMPdrawing
   picture pic[], pictA ;
   numeric wid[], len[], pos[], n ;
   wid[0] := len[0] := pos[0] := n := 0 ;
   numeric scaling;
   path pictB , frame ;
   pair shiftB ;
   picture monImageA; monImageA := nullpicture;
   picture monImageB; monImageB := nullpicture;
   color colorframe;  colorframe := 0.6white;
%
\stopMPdrawing
%
\MyFont\handletokens#1\with\whatever
%
\startMPdrawing
   frame :=  unitsquare
   xscaled ( (xpart urcorner monImageB - xpart llcorner 
monImageB) + 5mm )
   yscaled ( (ypart urcorner monImageB - ypart llcorner 
monImageB) + 5mm );

   frame := frame shifted (center monImageB - center frame);
   addto monImageB contour
     frame
     withpostscript "evenodd"
     withcolor transparent (1,1.,colorframe);
   draw monImageB ;
   draw monImageA ;
\stopMPdrawing
%
\MPdrawingdonetrue
\getMPdrawing}

%-- 



\def\whatever#1%
   {\appendtoks#1\to\MPtoks
    \setbox\MPbox=\hbox{\MyFont\the\MPtoks}%
    %
    \startMPdrawing
  n := n + 1 ; len[n] := \the\wd\MPbox ;
    \stopMPdrawing
    %
    \mpdefineoutlines{M}{MaLettre}
    %
    \startMPdrawing
    pictA := textext.drt("\MyFont M") ;
    pictB := MaLettre[1];
    scaling := bbheight pictA / bbheight pictB;
    \stopMPdrawing
    %
    \doifinstringelse{~}{#1}{}{%    HOW TO PROPERLY COPE 
WITH SPACES ?

    \mpdefineoutlines{#1}{MyGlyph}
    %
    \s

[NTG-context] MP background for text typeset by \typefile

2020-11-05 Thread context

Hello,

is there a way to draw custom background (via MP) to a text typed by 
\typefile, which is so long so it spreads over more pages?


- I'm asking because I know how to typeset some text via \typefile with:

1. this:

\definetyping[Test]
  [before={\startbackground[background=color,backgroundcolor=blue]
  },
   after={\stopbackground
 },
  ]

- which creates a rectangular backround to the text, and the text may 
spread over pages;


2. or this:

\defineoverlay[AnOverlayDefinition][]

\definetyping[Test]
  [before={\startframedtext[background=AnOverlayDefinition,
   ]%
  },
   after={\stopframedtext
 },
  ]

- which allows to define a custom background via overlay/MP, but which 
encloses the text to be typeset into a framed, and thus doesn't spread 
over pages.


My intention is to "decore" the text typed by \typefile with a "fuzzy" 
background, which uses overlay/MP.
But I am in the sitaution where I am able to figure out MP code just 
when the text is to be enclosed into \framed.


Is it possible to combine both cases? How?

Best regards,

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


  1   2   3   4   5   6   7   8   >