[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: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
Thanks Mikael. This helped indeed.
I updated my example on the Metapost page in the wiki accordingly.

The`pagestate=start` functionality is not documented in the wiki. It's not 
clear for which context commands it can or should be used. Who is willing to 
help out here?
Best regards
Emanuel
On Feb. 19 2024, at 2:39 pm, Mikael Sundqvist  wrote:
> Hi,
>
> Try
> \startTEXpage[pagestate=start]
> /Mikael
> On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
>  wrote:
> >
> >  I just made a strange observation in the output pdf of the attached 
> > layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> > macos preview and showing miniatures, all pages except the last one show 
> > page number 1 (the last showing page number 2).
> >
> > Which was not the case with the output pdf of the attached 
> > multipage_metapost_mwe-very_simple.tex.
> >
> > How can I change my code to have proper consecutive page numbering in a pdf 
> > viewer?
> >
> > On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
> >  wrote:
> >
> > I think I could solve all the problems. Attached the finalized working 
> > example. I created the 
> > https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages 
> > entry with it. Feel free to modify.
> >
> > Cheers
> > Emanuel
> >
> > On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> >
> > Hi,
> >
> > not sure I get what you are missing. But you can try
> >
> > setbounds currentpicture to (fullsquare scaled 200) ;
> >
> > in base. And then do
> >
> > \dorecurse{5}{
> > \startTEXpage[offset=1DK]
> > \useMPgraphic{layerset#1}
> > \stopTEXpage
> > }
> >
> > if that is the looping you are after.
> >
> > /Mikael
> >
> > On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Resp. the solution should be such that each generated PDF page has the 
> > > same dimension, the same background colour and a page number and the 
> > > metapost content on each page has the same scaling factor.
> > >
> > > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > >
> > > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > > because I need page numbering inside the MPpage, as done with draw 
> > > textext(decimal(currentime)).
> > >
> > > So, how can I use the \useMPgraphic{layerset1} etc. inside the 
> > > \dorecurse, assuming I name my layersets "layerset1", "layerset2", 
> > > "layerset3" etc.?
> > >
> > > Emanuel
> > >
> > > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > > thanks a lot!
> > > this seems to be the solution! And it looks beatiful enough to me 
> > > I'll try to port all my layers to this new method and see if I run into 
> > > new problems again 
> > >
> > > Emanuel
> > >
> > >
> > > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > >
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3"

[NTG-context] Re: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Mikael Sundqvist
Hi,

Try

\startTEXpage[pagestate=start]

/Mikael

On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
 wrote:
>
>  I just made a strange observation in the output pdf of the attached 
> layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> macos preview and showing miniatures, all pages except the last one show page 
> number 1 (the last showing page number 2).
>
> Which was not the case with the output pdf of the attached 
> multipage_metapost_mwe-very_simple.tex.
>
> How can I change my code to have proper consecutive page numbering in a pdf 
> viewer?
>
> On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
>  wrote:
>
> I think I could solve all the problems. Attached the finalized working 
> example. I created the 
> https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
> with it. Feel free to modify.
>
> Cheers
> Emanuel
>
> On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
>
> Hi,
>
> not sure I get what you are missing. But you can try
>
> setbounds currentpicture to (fullsquare scaled 200) ;
>
> in base. And then do
>
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
>
> /Mikael
>
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn i

[NTG-context] Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
 I just made a strange observation in the output pdf of the attached layer_set.tex, which is that when opening it with a pdf viewer like skim or macos preview and showing miniatures, all pages except the last one show page number 1 (the last showing page number 2). Which was not the case with the output pdf of the attached multipage_metapost_mwe-very_simple.tex. How can I change my code to have proper consecutive page numbering in a pdf viewer?On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context  wrote:I think I could solve all the problems. Attached the finalized working example. I created the https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry with it. Feel free to modify.CheersEmanuelOn Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:Hi,not sure I get what you are missing. But you can trysetbounds currentpicture to (fullsquare scaled 200) ;in base. And then do\dorecurse{5}{\startTEXpage[offset=1DK]\useMPgraphic{layerset#1}\stopTEXpage}if that is the looping you are after./MikaelOn Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context wrote:>> Resp. the solution should be such that each generated PDF page has the same dimension, the same background colour and a page number and the metapost content on each page has the same scaling factor.>> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,>> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), because I need the "setbounds currentpicture to TheFrame" and also because I need page numbering inside the MPpage, as done with draw textext(decimal(currentime)).>> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?>> Emanuel>> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,> thanks a lot!> this seems to be the solution! And it looks beatiful enough to me > I'll try to port all my layers to this new method and see if I run into new problems again >> Emanuel>>> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:>> Hi>> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context>  wrote:> >> > Dear list,> >> > the attached .tex file is the minimal working example we discussed today in the online meeting.> >> > I realized that the approach of looping through k of p[k] is not fitting my needs, because it's not flexible enough.> >> > I need another approach, one which works with layer sets.> >> > I would stop using p as an array, because with the layer sets approach we don't have a fixed order of the layers.> >> > So the definition of the layers would be something like> >> > picture layerA;> > layerA:=image(> > label("Word 1", z1);> > );> >> > picture layerW;> > layerW:=image(> > label("Mot 2", z2);> > );> >> > picture layerM;> > layerM:=image(> > label("Parola 3", z3);> > );> >> > picture layerC;> > layerC:=image(> > label("Wort 4", z3+z1);> > );> >> > picture layerY;> > layerY:=image(> > label("Nummer 5", z2+z3);> > );> >> > picture layerU;> > layerU:=image(> > label("number 6", z2+z1);> > );> >> > After that, I would define layer sets and layer subsets. This will be done manually for each layer set and each layer subset.> > I don't know the proper syntax to do that. Let's assume we could use a variable type called "myset".> >> > myset layersubsetGamma;> > layersubsetGamma:={layerU,layerM};> >> > In my logic, the layers will be drawn in the order of their appearance within the {}. In the example, drawn content of layerM might cover drawn content of layerU.> >> > Contrary to a layer subset, each layer set will result in a PDF page, and thus the layer sets are related to each other by an inner order. That's why I would use an array variable here with [].> >> > I don't know how to append a set. In the following example, I assumed there would be a function myappend(, )> >> > myset layerset[];> > layerset1 := {layerW,layerA};> > layerset2 := myappend{layerset1, layerY};> > layerset3 := myappend{layerset2, layersubsetGamma};> > layerset4 := myappend{layerset2, layerU};> > layerset5 := myappend{layerset4, layersubsetGamma};> >> > Finally, I would need each layerset[k] typeset on its own pdf page. And of course on each page k, only the layers which appear in the definition of the layerset[k] should be drawn on top of each other in the order as they appear in that definition.> >>

[NTG-context] Re: Working with layer sets with Metapost

2024-02-17 Thread Emanuel Han via ntg-context
I think I could solve all the problems. Attached the finalized working example. 
I created the 
https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
with it. Feel free to modify.

Cheers
Emanuel

On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> Hi,
>
> not sure I get what you are missing. But you can try
> setbounds currentpicture to (fullsquare scaled 200) ;
> in base. And then do
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
> /Mikael
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY};
> > > layerset3 := myapp

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Mikael Sundqvist
Hi,

not sure I get what you are missing. But you can try

setbounds currentpicture to (fullsquare scaled 200) ;

in base. And then do

\dorecurse{5}{
\startTEXpage[offset=1DK]
\useMPgraphic{layerset#1}
\stopTEXpage
}

if that is the looping you are after.

/Mikael

On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
 wrote:
>
> Resp. the solution should be such that each generated PDF page has the same 
> dimension, the same background colour and a page number and the metapost 
> content on each page has the same scaling factor.
>
> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
>  wrote:
>
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
>
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
>
> Emanuel
>
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
>
> Dear Mikael,
> thanks a lot!
> this seems to be the solution! And it looks beatiful enough to me 
> I'll try to port all my layers to this new method and see if I run into new 
> problems again 
>
> Emanuel
>
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
>
> Hi
>
> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Dear list,
> >
> > the attached .tex file is the minimal working example we discussed today in 
> > the online meeting.
> >
> > I realized that the approach of looping through k of p[k] is not fitting my 
> > needs, because it's not flexible enough.
> >
> > I need another approach, one which works with layer sets.
> >
> > I would stop using p as an array, because with the layer sets approach we 
> > don't have a fixed order of the layers.
> >
> > So the definition of the layers would be something like
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > );
> >
> > picture layerC;
> > layerC:=image(
> > label("Wort 4", z3+z1);
> > );
> >
> > picture layerY;
> > layerY:=image(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=image(
> > label("number 6", z2+z1);
> > );
> >
> > After that, I would define layer sets and layer subsets. This will be done 
> > manually for each layer set and each layer subset.
> > I don't know the proper syntax to do that. Let's assume we could use a 
> > variable type called "myset".
> >
> > myset layersubsetGamma;
> > layersubsetGamma:={layerU,layerM};
> >
> > In my logic, the layers will be drawn in the order of their appearance 
> > within the {}. In the example, drawn content of layerM might cover drawn 
> > content of layerU.
> >
> > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > thus the layer sets are related to each other by an inner order. That's why 
> > I would use an array variable here with [].
> >
> > I don't know how to append a set. In the following example, I assumed there 
> > would be a function myappend(,  > set should be appended with>)
> >
> > myset layerset[];
> > layerset1 := {layerW,layerA};
> > layerset2 := myappend{layerset1, layerY};
> > layerset3 := myappend{layerset2, layersubsetGamma};
> > layerset4 := myappend{layerset2, layerU};
> > layerset5 := myappend{layerset4, layersubsetGamma};
> >
> > Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> > course on each page k, only the layers which appear in the definition of 
> > the layerset[k] should be drawn on top of each other in the order as they 
> > appear in that definition.
> >
> > I'm very curious to hear your suggestions.
> >
>
> Not beautiful, perhaps, but maybe something like this could work? I
> think there is no way out of doing some manual work to tell what you
> want included on each page.
>
> \startuseMPgraphic{base}
> z1 = origin ;
> z2 = (10,50) ;
> z3 = (40,30) ;
>
> picture layerA;
> layerA:=image(
> label("Word 1", z1);

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Resp. the solution should be such that each generated PDF page has the same 
dimension, the same background colour and a page number and the metapost 
content on each page has the same scaling factor.

On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> Emanuel
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3", z3);
> > > > );
> > > >
> > > > picture layerC;
> > > > layerC:=image(
> > > > label("Wort 4", z3+z1);
> > > > );
> > > >
> > > > picture layerY;
> > > > layerY:=image(
> > > > label("Nummer 5", z2+z3);
> > > > );
> > > >
> > > > picture layerU;
> > > > layerU:=image(
> > > > label("number 6", z2+z1);
> > > > );
> > > >
> > > > After that, I would define layer sets and layer subsets. This will be 
> > > > done manually for each layer set and each layer subset.
> > > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > > variable type called "myset".
> > > >
> > > > myset layersubsetGamma;
> > > > layersubsetGamma:={layerU,layerM};
> > > >
> > > > In my logic, the layers will be drawn in the order of their appearance 
> > > > within the {}. In the example, drawn content of layerM might cover 
> > > > drawn content of layerU.
> > > >
> > > > Contrary to a layer subset, each layer set will result in a PDF page, 
> > > > and thus the layer sets are related to each other by an inner order. 
> > > > That's why I would use an array variable here with [].
> > > >
> > > > I don't know how to append a set. In the following example, I assumed 
> > > > there would be a function myappend(,  > > > initial set should be appended with>)
> > > >
> > > > myset layerset[];
> > > > layerset1 := {layerW,layerA};
> > > > layerset2 := myappend{layerset1, layerY};
> > > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > > layerset4 := myappend{layerset2, layerU};
> > > > layerset5 := myappend{layerset4, layersubsetGamma};
> > > >
> > > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > > of course on each page k, only the layers which appear in the 
> > > > definition of the layerset[k] should be drawn on top of each other in 
> > > > the order as they appear in 

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Dear Mikael,

I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), 
because I need the "setbounds currentpicture to TheFrame" and also because I 
need page numbering inside the MPpage, as done with draw 
textext(decimal(currentime)).
So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
Emanuel
On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
> thanks a lot!
> this seems to be the solution! And it looks beatiful enough to me 
> I'll try to port all my layers to this new method and see if I run into new 
> problems again 
>
> Emanuel
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY};
> > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > layerset4 := myappend{layerset2, layerU};
> > > layerset5 := myappend{layerset4, layersubsetGamma};
> > >
> > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > of course on each page k, only the layers which appear in the definition 
> > > of the layerset[k] should be drawn on top of each other in the order as 
> > > they appear in that definition.
> > >
> > > I'm very curious to hear your suggestions.
> > >
> >
> > Not beautiful, perhaps, but maybe something like this could work? I
> > think there is no way out of doing some manual work to tell what you
> > want included on each page.
> >
> > \startuseMPgraphic{base}
> > z1 = origin ;
> > z2 = (10,50) ;
> > z3 = (40,30) ;
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > 

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Dear Mikael,
thanks a lot!
this seems to be the solution! And it looks beatiful enough to me 
I'll try to port all my layers to this new method and see if I run into new 
problems again 

Emanuel

On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> Hi
>
> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Dear list,
> >
> > the attached .tex file is the minimal working example we discussed today in 
> > the online meeting.
> >
> > I realized that the approach of looping through k of p[k] is not fitting my 
> > needs, because it's not flexible enough.
> >
> > I need another approach, one which works with layer sets.
> >
> > I would stop using p as an array, because with the layer sets approach we 
> > don't have a fixed order of the layers.
> >
> > So the definition of the layers would be something like
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > );
> >
> > picture layerC;
> > layerC:=image(
> > label("Wort 4", z3+z1);
> > );
> >
> > picture layerY;
> > layerY:=image(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=image(
> > label("number 6", z2+z1);
> > );
> >
> > After that, I would define layer sets and layer subsets. This will be done 
> > manually for each layer set and each layer subset.
> > I don't know the proper syntax to do that. Let's assume we could use a 
> > variable type called "myset".
> >
> > myset layersubsetGamma;
> > layersubsetGamma:={layerU,layerM};
> >
> > In my logic, the layers will be drawn in the order of their appearance 
> > within the {}. In the example, drawn content of layerM might cover drawn 
> > content of layerU.
> >
> > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > thus the layer sets are related to each other by an inner order. That's why 
> > I would use an array variable here with [].
> >
> > I don't know how to append a set. In the following example, I assumed there 
> > would be a function myappend(,  > set should be appended with>)
> >
> > myset layerset[];
> > layerset1 := {layerW,layerA};
> > layerset2 := myappend{layerset1, layerY};
> > layerset3 := myappend{layerset2, layersubsetGamma};
> > layerset4 := myappend{layerset2, layerU};
> > layerset5 := myappend{layerset4, layersubsetGamma};
> >
> > Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> > course on each page k, only the layers which appear in the definition of 
> > the layerset[k] should be drawn on top of each other in the order as they 
> > appear in that definition.
> >
> > I'm very curious to hear your suggestions.
> >
>
> Not beautiful, perhaps, but maybe something like this could work? I
> think there is no way out of doing some manual work to tell what you
> want included on each page.
>
> \startuseMPgraphic{base}
> z1 = origin ;
> z2 = (10,50) ;
> z3 = (40,30) ;
>
> picture layerA;
> layerA:=image(
> label("Word 1", z1);
> );
>
> picture layerW;
> layerW:=image(
> label("Mot 2", z2);
> );
>
> picture layerM;
> layerM:=image(
> label("Parola 3", z3);
> );
>
> picture layerC;
> layerC:=image(
> label("Wort 4", z3+z1);
> );
>
> picture layerY;
> layerY:=image(
> label("Nummer 5", z2+z3);
> );
>
> picture layerU;
> layerU:=image(
> label("number 6", z2+z1);
> );
> \stopuseMPgraphic
>
> \startuseMPgraphic{Gamma}
> draw layerU ;
> draw layerM ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset1}
> \includeMPgraphic{base}
> draw layerW ;
> draw layerA ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset2}
> \includeMPgraphic{layerset1} ;
> draw layerY ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset3}
> \includeMPgraphic{layerset2} ;
> \includeMPgraphic{Gamma} ;
> \stopuseMPgraphic
>
>
> \startuseMPgraphic{layerset4}
> \includeMPgraphic{layerset2} ;
> draw layerU ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset5}
> \includeMPgraphic{layerset4} ;
> \includeMPgraphic{Gamma} ;
> \stopuseMPgraphi

[NTG-context] Re: Working with layer sets with Metapost

2024-02-14 Thread Mikael Sundqvist
Hi

On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
 wrote:
>
> Dear list,
>
> the attached .tex file is the minimal working example we discussed today in 
> the online meeting.
>
> I realized that the approach of looping through k of p[k] is not fitting my 
> needs, because it's not flexible enough.
>
> I need another approach, one which works with layer sets.
>
> I would stop using p as an array, because with the layer sets approach we 
> don't have a fixed order of the layers.
>
> So the definition of the layers would be something like
>
> picture layerA;
> layerA:=image(
> label("Word 1", z1);
> );
>
> picture layerW;
> layerW:=image(
> label("Mot 2", z2);
> );
>
> picture layerM;
> layerM:=image(
> label("Parola 3", z3);
> );
>
> picture layerC;
> layerC:=image(
> label("Wort 4", z3+z1);
> );
>
> picture layerY;
> layerY:=image(
> label("Nummer 5", z2+z3);
> );
>
> picture layerU;
> layerU:=image(
> label("number 6", z2+z1);
> );
>
> After that, I would define layer sets and layer subsets. This will be done 
> manually for each layer set and each layer subset.
> I don't know the proper syntax to do that. Let's assume we could use a 
> variable type called "myset".
>
> myset layersubsetGamma;
> layersubsetGamma:={layerU,layerM};
>
> In my logic, the layers will be drawn in the order of their appearance within 
> the {}. In the example, drawn content of layerM might cover drawn content of 
> layerU.
>
> Contrary to a layer subset, each layer set will result in a PDF page, and 
> thus the layer sets are related to each other by an inner order. That's why I 
> would use an array variable here with [].
>
> I don't know how to append a set. In the following example, I assumed there 
> would be a function myappend(,  should be appended with>)
>
> myset layerset[];
> layerset1 := {layerW,layerA};
> layerset2 := myappend{layerset1, layerY};
> layerset3 := myappend{layerset2, layersubsetGamma};
> layerset4 := myappend{layerset2, layerU};
> layerset5 := myappend{layerset4, layersubsetGamma};
>
> Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> course on each page k, only the layers which appear in the definition of the 
> layerset[k] should be drawn on top of each other in the order as they appear 
> in that definition.
>
> I'm very curious to hear your suggestions.
>

Not beautiful, perhaps, but maybe something like this could work? I
think there is no way out of doing some manual work to tell what you
want included on each page.

\startuseMPgraphic{base}
z1 = origin ;
z2 = (10,50) ;
z3 = (40,30) ;

picture layerA;
layerA:=image(
label("Word 1", z1);
);

picture layerW;
layerW:=image(
label("Mot 2", z2);
);

picture layerM;
layerM:=image(
label("Parola 3", z3);
);

picture layerC;
layerC:=image(
label("Wort 4", z3+z1);
);

picture layerY;
layerY:=image(
label("Nummer 5", z2+z3);
);

picture layerU;
layerU:=image(
label("number 6", z2+z1);
);
\stopuseMPgraphic

\startuseMPgraphic{Gamma}
draw layerU ;
draw layerM ;
\stopuseMPgraphic

\startuseMPgraphic{layerset1}
\includeMPgraphic{base}
draw layerW ;
draw layerA ;
\stopuseMPgraphic

\startuseMPgraphic{layerset2}
\includeMPgraphic{layerset1} ;
draw layerY ;
\stopuseMPgraphic

\startuseMPgraphic{layerset3}
\includeMPgraphic{layerset2} ;
\includeMPgraphic{Gamma} ;
\stopuseMPgraphic


\startuseMPgraphic{layerset4}
\includeMPgraphic{layerset2} ;
draw layerU ;
\stopuseMPgraphic

\startuseMPgraphic{layerset5}
\includeMPgraphic{layerset4} ;
\includeMPgraphic{Gamma} ;
\stopuseMPgraphic

\starttext

\startTEXpage[offset=1DK]
\useMPgraphic{layerset1}
\stopTEXpage

\startTEXpage[offset=1DK]
\useMPgraphic{layerset2}
\stopTEXpage

\startTEXpage[offset=1DK]
\useMPgraphic{layerset3}
\stopTEXpage

\startTEXpage[offset=1DK]
\useMPgraphic{layerset4}
\stopTEXpage

\startTEXpage[offset=1DK]
\useMPgraphic{layerset5}
\stopTEXpage

\stoptext

/Mikael
___
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] Asking help for better way to make tickets.

2024-01-12 Thread Jeong Dal via ntg-context
Dear all,I’d like to make a ticket on A4 as follows:1. Use all of A4(no margin, no header, no footer,…)2. Arange 12 tickets in the form of 3 x 4 on one page,3. Two rows are same,4. Numbers in the center of the ticket which is increasing.I use the following code to make it.but I think that there is a better and simpler way to do it which I don’t know.I hope that someone give me a nicer way to do it.Thank you for reading.Best regards,Dalyoung\setuppapersize[A4]%[A4]\setuplayout[  width=210mm,  height=297mm,  topspace=0pt,  backspace=0pt,  header=0mm,  footer=0mm,  margin=0mm,  bottomspace=0mm   ]\startuseMPgraphic{ticket}{i,j}path p,q;pair A,B;p := unitsquare xyscaled (67mm,73mm);A := point 0.5 of p;B := point 2.5 of p;draw p;label(textext("Text"), .25A+.75B );label(textext("\tfd " & decimal (3*\MPvar{i}-\MPvar{j})), center p);label(textext("Text"), .75A + .25B);\stopuseMPgraphic\starttext\dorecurse{4}{\startcombination[3*1]%distance=0mm]{\useMPgraphic{ticket}{i=\recurselevel,j=2}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=1}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=0}}{}\stopcombination\startcombination[3*1]%distance=0mm]{\useMPgraphic{ticket}{i=\recurselevel,j=2}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=1}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=0}}{}\stopcombination}\page\dostepwiserecurse{5}{8}{1}{\startcombination[3*1]%distance=0mm]{\useMPgraphic{ticket}{i=\recurselevel,j=2}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=1}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=0}}{}\stopcombination\startcombination[3*1]%distance=0mm]{\useMPgraphic{ticket}{i=\recurselevel,j=2}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=1}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=0}}{}\stopcombination}\stoptext

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: 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: 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] Custom TOC with makeup and setups

2023-05-10 Thread Jethro Djan via ntg-context
Hello,

I am trying to create a presentation where at the start of each section in
my presentation, a custom TOC page is shown. When I am at a particular
section, the TOC will grey out all other sections (not implemented in my
MWE). I have tried different ways but I find using makeups for the TOC page
works ok (following
https://wiki.contextgarden.net/Command/setuplistalternative and Aditya's
presentation slides on their blog). My challenge is that when a makeup page
is inserted, it leaves a page with the section name blank before it. How do
I fix it? Any other way to achieve this is also welcome. My MWE:

\setuppapersize[S6]
\startuseMPgraphic{itemize:toc}
  save p; path p;
  p := ( (0,-0.5)--(0,0.5)--(0.866,0)--cycle ) scaled 1.5ExHeight;
  fill p withcolor \MPcolor{Black};
\stopuseMPgraphic

\definesymbol[itemize:toc][\useMPgraphic{itemize:toc}]

\definelistalternative
  [toclist]
  [renderingsetup=list:toclist]

\setupheadtext[section=Table of Contents]

\startsetups toclist
  \framed[align=normal, frame=off]{\placelist [section] [criterium=all,
alternative=toclist]}
\stopsetups

\definehspace[tspace][4cm]
\setupframed[
  height=fit,
  width=fit,
  location=middle,
  frame=off,
  align=normal,
  offset=none,
]
\startsetups list:toclist
  {\hbox to \hsize \bgroup
  \hspace[tspace]
  \framed[width=10mm,align=flushleft]{\symbol[itemize:toc]}%
  \framed[empty=yes]{\currentlistentrynumber\currentlistentrypagenumber}%
  \doifelse\currentlistentrylocation{\namedstructureheadlocation{section}}{%
\framed[align=flushright,]{{\bfb\currentlistentrytitle}}%
  }{\framed[align=flushright,]{\currentlistentrytitle}}
  \egroup}
\stopsetups



 \definemakeup
  [toc]
  [
doublesided=no,
page=yes,
bottom=,
top=,
pagestate=start,
headerstate=empty,
footerstate=empty,
setups={toclist},
before=\setups{toc:setups},
  ]
\startsetups toc:setups
  \setupbackgrounds[page][background=color, backgroundcolor=blue]
\stopsetups

 \definemakeup
  [standard]
  [
doublesided=no,
page=right,
pagestate=start,
headerstate=empty,
footerstate=empty,
before=\setups{standard:setups},
  ]

 \startsetups standard:setups
\setupbackgrounds[page][background=color, backgroundcolor=lightgray]
 \stopsetups

 \define\TOC{
  \starttocmakeup
  \stoptocmakeup
 }

\starttext

\startstandardmakeup
  \title{Your Title Here}
\stopstandardmakeup

\startsection[title={Motivation}]
\TOC
\startitemize

\item something cool
\item something else cool

\stopitemize
\stopsection

\startsection[title={Main strands of theory}]
\TOC
\startitemize

\item another cool thing
\item cool too

\stopitemize
\stopsection


\stoptext

Thanks in advance.

Jethro
___
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] MP figure continuation

2023-01-06 Thread Mikael Sundqvist via ntg-context
On Fri, Jan 6, 2023 at 3:43 PM Alexandre Christe via ntg-context
 wrote:
>
> Dear list,
>
> Is there a way to "continue" an MP figure? Like keeping the axes, etc. and 
> just adding code to the figure?
>
> Maybe I missed something, otherwise I'd find it super useful.
>
> Thanks in advance and happy new year,
> Alex

Hi Alex,

Maybe there are other ways, but one can use \includeMPgraphic. One
simple example given below.

/Mikael

\starttext
\startuseMPgraphic{vanderwaerdenbas}
u:=3cm ;

def vdwbas(expr x) = abs(x-round x) enddef ;

def vdw(expr n,x) =
  if n = 0:
vdwbas(x)
  else:
vdwbas(x*pow(4,n))/pow(4,n)
  fi
enddef ;

path xaxis, yaxis ;
xaxis = ((-1.1,0)--(1.1,0)) scaled u ;
yaxis = ((0,-0.1)--(0,0.6)) scaled u ;

drawarrow xaxis withpen pencircle scaled 0.25 ;
drawarrow yaxis withpen pencircle scaled 0.25 ;
\stopuseMPgraphic

\startuseMPgraphic{vanderwaerden0}
\includeMPgraphic{vanderwaerdenbas}
draw function(1,"x","vdw(0,x)",epsed(-1),epsed(1),1/1000) scaled u ;
\stopuseMPgraphic

\startuseMPgraphic{vanderwaerden1}
\includeMPgraphic{vanderwaerdenbas}
draw function(1,"x","vdw(1,x)",epsed(-1),epsed(1),1/1000) scaled u ;
\stopuseMPgraphic

\startuseMPgraphic{vanderwaerden2}
\includeMPgraphic{vanderwaerdenbas}
draw function(1,"x","vdw(2,x)",epsed(-1),epsed(1),1/1000) scaled u ;
\stopuseMPgraphic

\startuseMPgraphic{vanderwaerden3}
\includeMPgraphic{vanderwaerdenbas}
draw function(1,"x","vdw(3,x)",epsed(-1),epsed(1),1/1000) scaled u ;
\stopuseMPgraphic

\startuseMPgraphic{vanderwaerden01}
\includeMPgraphic{vanderwaerdenbas}
draw function(1,"x","vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000) scaled u ;
\stopuseMPgraphic

\startuseMPgraphic{vanderwaerden012}
\includeMPgraphic{vanderwaerdenbas}
draw function(1,"x","vdw(2,x)+vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000)
scaled u ;
\stopuseMPgraphic

\startuseMPgraphic{vanderwaerden0123}
\includeMPgraphic{vanderwaerdenbas}
draw 
function(1,"x","vdw(3,x)+vdw(2,x)+vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000)
scaled u ;
\stopuseMPgraphic

\startplacefigure[reference=fig:vdw]
\startcombination[nx=2,ny=4]
{\useMPgraphic{vanderwaerden0}}   {(a)}
{\useMPgraphic{vanderwaerden0}}   {(b)}
{\useMPgraphic{vanderwaerden1}}   {(c)}
{\useMPgraphic{vanderwaerden01}}  {(d)}
{\useMPgraphic{vanderwaerden2}}   {(e)}
{\useMPgraphic{vanderwaerden012}} {(f)}
{\useMPgraphic{vanderwaerden3}}   {(g)}
{\useMPgraphic{vanderwaerden0123}}{(h)}
\stopcombination
\stopplacefigure

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


[NTG-context] Write a long chapter title in two lines

2022-08-18 Thread Jeong Dal via ntg-context
Dear all,

A few days ago, I sent an email as follows. But it is linked to another subject 
because I choose reply of another subject.
So, I send the same mail again.

Thank you for reading.

Best regards,
Dalyoung

**
I’d like to write a long chapter title in two lines if it is longer than the 
textwidth.
It is OK when I use just bigger fonts.

But it writes the long title in one line if I use outlined font for title as in 
MWE.

Is there a way to write it in two lines using the outlined font?

Thanks,

Best regards,

Dalyoung

\startuseMPgraphic{outlineT}
  draw outlinetext.b (\MPvar{tt})
  (withcolor .75white)
  (withcolor .725blue withpen pencircle scaled .75pt);%\MPvar{thick});
\stopuseMPgraphic
\definefont[BigFontOne][NotoSansCJKkr-Bold sa 4]
\define[1]\outlineTitle{\useMPgraphic{outlineT}{tt="#1"}}

\setuphead[chapter]
[textcommand=\outlineTitle,
 style=\BigFontOne,
 numbercommand=\outlineTitle,
% align = middle,
 number=yes]

\setupexternalfigures[location={default,local,global}]
%\definefont[fancy][Zapfino at 24pt]

\starttext
\startchapter[title={Very Long Long Long Title}]
\startcombination[3*1]
 {\externalfigure[cow]   [combination]}{cow}
 {\externalfigure[mill]  [combination]}{mill}
 {\externalfigure[hacker][combination]}{hacker}
\stopcombination
\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] Write a long chapter title in two lines

2022-08-15 Thread Jeong Dal via ntg-context
Dear all,

I’d like to write a long chapter title in two lines if it is longer than the 
textwidth.
It is OK when I use just bigger fonts.

But it writes the long title in one line if I use outlined font for title as in 
MWE.

Is there a way to write it in two lines using the outlined font?

Thanks,

Best regards,

Dalyoung

\startuseMPgraphic{outlineT}
  draw outlinetext.b (\MPvar{tt})
  (withcolor .75white)
  (withcolor .725blue withpen pencircle scaled .75pt);%\MPvar{thick});
\stopuseMPgraphic
\definefont[BigFontOne][NotoSansCJKkr-Bold sa 4]
\define[1]\outlineTitle{\useMPgraphic{outlineT}{tt="#1"}}

\setuphead[chapter]
[textcommand=\outlineTitle,
 style=\BigFontOne,
 numbercommand=\outlineTitle,
% align = middle,
 number=yes]

\setupexternalfigures[location={default,local,global}]
%\definefont[fancy][Zapfino at 24pt]

\starttext
\startchapter[title={Very Long Long Long Title}]
\startcombination[3*1]
 {\externalfigure[cow]   [combination]}{cow}
 {\externalfigure[mill]  [combination]}{mill}
 {\externalfigure[hacker][combination]}{hacker}
\stopcombination
\stopchapter
\stoptext


> On Aug 15, 2022, at 7:42 PM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> Dear list,
> 
> adapting a the sample from mkxl/page-str.mkxl (and code from the list),
> I came with the following sample:
> 
>  \setuppapersize[A6]
>  \showgrid
>  %\setuplayout[grid=yes]
>  \starttext
>  \input tufte
>  \startoutputstream[es]
>   \dorecurse{25}
>{\startlanguage[es]\input cervantes-es\stoplanguage%
>  \par\pushoutputstream}
>  \enableoutputstream[en]
>   \dorecurse{25}
>{\input zapf\par\pushoutputstream}
>  \disableoutputstream
>  \stopoutputstream
>  \synchronizestreams[es,en]
>  \page \flushoutputstream[es]
>  \page \flushoutputstream[en]
>  \stoptext
> 
> To reorder pages, I rename the output to "wg.pdf" and run the following
> code:
> 
>  \setuppapersize[A6]
>  \setuplayout[page]
>  \starttext
>  \dorecurse{26}
>  {\ifnum\recurselevel = 1
>\externalfigure[wg.pdf][page=\recurselevel]\else
>\externalfigure[wg.pdf][page=\recurselevel]
>\externalfigure[wg.pdf][page={\the\numexpr \recurselevel + 25}]\fi}
>  \stoptext
> 
> I’m afraid that the paragraph mistmatch is clear (the number of pages is
> way different for each versions).
> 
> Using the grid, the mismatch is not so evident (but there is still a
> different number of pages for each version).
> 
> Page reordering would be in this case:
> 
>  \setuppapersize[A6]
>  \setuplayout[page]
>  \starttext
>  \dorecurse{20}
>  {\ifnum\recurselevel = 1
>\externalfigure[wg.pdf][page=\recurselevel]\else
>\externalfigure[wg.pdf][page=\recurselevel]
>\externalfigure[wg.pdf][page={\the\numexpr \recurselevel + 19}]\fi}
>  \stoptext
> 
> I would need that for a bilingual edition. I don’t mind reodering the
> pages (if there is no other option).
> 
> But what am I doing wrong not to get synced text streams for facing pages?
> 
> 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://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] 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] 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
___


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] 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] Solved! Itemize columns with MPgraphics: another vertical spacing puzzle

2022-01-14 Thread Gavin via ntg-context
Thanks, Hans!

That works, and it makes sense. Playing with frames always pays, indeed.

-Gavin


> On Jan 14, 2022, at 3:18 PM, Hans Hagen  wrote:
> 
> On 1/14/2022 8:10 PM, Gavin via ntg-context wrote:
>> Hi List,
>> I solved this problem, but the solution is a bit mysterious to me. I was 
>> trying to solve another problem – removing the small space underneath the 
>> graphic in the framed box. I did this by adding boffset=-\strutdepth to the 
>> framed command. That not only got rid of the space inside the frame, it also 
>> removed the excess space between the rows in the itemize columns!
>> I don’t know why this fix solved both problems, but I’m happy with the 
>> result. Now I can use options for the choices – like packed and joinedup – 
>> with consistent results for any number of columns. I’ve put the fixed code 
>> and output below, for anyone who is interested.
>> Even when I’m a bit confused, I’m glad to be working with ConTeXt rather 
>> than any other system!
> 
> % your hack:
> 
> \define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,boffset=-\strutdepth,xframe=off]{\useMPgraphic{name}}}
> 
> % but ... you just don't want struts
> 
> \define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,strut=no,frame=off]{\useMPgraphic{name}}}
> 
> % and no offset but also no invisible frame
> 
> \define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=overlay,frame=off]{\useMPgraphic{name}}}
> 
> playing with framed for a while alway spays back
> 
> 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] Solved! Itemize columns with MPgraphics: another vertical spacing puzzle

2022-01-14 Thread Hans Hagen via ntg-context

On 1/14/2022 8:10 PM, Gavin via ntg-context wrote:

Hi List,

I solved this problem, but the solution is a bit mysterious to me. I was trying 
to solve another problem – removing the small space underneath the graphic in 
the framed box. I did this by adding boffset=-\strutdepth to the framed 
command. That not only got rid of the space inside the frame, it also removed 
the excess space between the rows in the itemize columns!

I don’t know why this fix solved both problems, but I’m happy with the result. 
Now I can use options for the choices – like packed and joinedup – with 
consistent results for any number of columns. I’ve put the fixed code and 
output below, for anyone who is interested.

Even when I’m a bit confused, I’m glad to be working with ConTeXt rather than 
any other system!


% your hack:

\define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,boffset=-\strutdepth,xframe=off]{\useMPgraphic{name}}}

% but ... you just don't want struts

\define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,strut=no,frame=off]{\useMPgraphic{name}}}

% and no offset but also no invisible frame

\define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=overlay,frame=off]{\useMPgraphic{name}}}

playing with framed for a while alway spays back

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] Solved! Itemize columns with MPgraphics: another vertical spacing puzzle

2022-01-14 Thread Gavin via ntg-context
Hi List,

I solved this problem, but the solution is a bit mysterious to me. I was trying 
to solve another problem – removing the small space underneath the graphic in 
the framed box. I did this by adding boffset=-\strutdepth to the framed 
command. That not only got rid of the space inside the frame, it also removed 
the excess space between the rows in the itemize columns!

I don’t know why this fix solved both problems, but I’m happy with the result. 
Now I can use options for the choices – like packed and joinedup – with 
consistent results for any number of columns. I’ve put the fixed code and 
output below, for anyone who is interested.

Even when I’m a bit confused, I’m glad to be working with ConTeXt rather than 
any other system!

Best,
Gavin


\starttext

\defineitemgroup[questions]
\setupquestions [1] [n]
\define\question{\item}

\defineitemgroup[choices]
\setupchoices [each] [A,columns] [left=(, right=), width=1.7em, stopper=,]
\define\choice{\item}

\def\mycolor{.625red}

\startuseMPgraphic{name}
  fill fullcircle scaled 40pt withcolor \mycolor;
\stopuseMPgraphic

\define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,boffset=-\strutdepth,frame=off]{\useMPgraphic{name}}}

Here are a few great looking multiple choice questions about colors.
\startquestions
\question What is your favorite color?
\startchoices[columns,four]
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

\question What is your least favorite color?
\startchoices[columns]
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

\question Toward which colors do you feel indifferent?
\startchoices[one]
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices
\stopquestions

That's it for questions about colors!

\stoptext



PastedGraphic-2.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] Itemize columns with MPgraphics: another vertical spacing puzzle

2022-01-14 Thread Gavin via ntg-context
Hi List,

I need to itemize graphics when I use those graphics as the choices in a 
multiple choice question. When I do that in columns, I am getting excess space 
below the graphics. See example code and output below. Any suggestions for how 
I get rid of this space?

I’m not sure if this is related to the itemize column spacing in my previous 
comment.

Thanks, again!
Gavin


\starttext

\defineitemgroup[choices]
\setupchoices [each] [A,joinedup] [left=(, right=), width=1.7em, stopper=,]
\define\choice{\item}

\def\mycolor{.625red}

\startuseMPgraphic{name}
  fill fullcircle scaled 40pt withcolor \mycolor;
\stopuseMPgraphic

\define[1]\mycolordot{\def\mycolor{#1}\framed[location=top,offset=0pt,frame=off]{\useMPgraphic{name}}}

What is your favorite color? (There is too much space after these choices.)
\startchoices[columns,four]
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

A ruledhboxs show the extra space is in the itemize, but not in the item 
contents.

\ruledhbox{\startchoices[columns, four]
  \choice \ruledhbox{\mycolordot{.625red}}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices}

Putting a ruledhbox around the first item shows that each item has extra space 
that is not part of the item contents. (The ruledhbox also messes with the 
horizontal alignment, but I don't care about that.)
\startchoices[columns]
  \ruledhbox{\choice \mycolordot{.625red}}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

The extra space is not present without columns.
\startchoices
  \choice \mycolordot{.625red}
  \choice \mycolordot{.625blue}
  \choice \mycolordot{.625green}
  \choice \mycolordot{.625magenta}
\stopchoices

\ruledhbox{My favorite color is:\def\mycolor{.625blue}
\framed[location=top,offset=0pt,frame=on] {\useMPgraphic{name}}}

\stoptext



PastedGraphic-1.pdf
Description: Adobe PDF document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Laundry symbols (now: altered picture)

2022-01-02 Thread Alfredo Catalina via ntg-context
Great! Thanks Hans, now it works. I replaced the "draw externalfigure"
commands by

draw externalfigure "./skysprite.png" xsized 4u ysized 5u shifted (0u,-0u);
draw externalfigure "./sandsprite.png" xsized 4u ysized 5u shifted (0u,-5u);

Best regards

On Sun, Jan 2, 2022 at 3:36 PM Hans Hagen  wrote:

> On 1/2/2022 3:12 PM, Alfredo Catalina via ntg-context wrote:
> > I'm trying to use ConTeXt with Metafun to produce a map of a videogame I
> > am working on. In fact I did it 9 years ago but it seems that now it
> > doesn't work.
> >
> > I have two 32 pixels wide by 40 pixels high sprites. They are saved in
> > the skysprite.png and sandsprite.png files. Since 32 = 4 x 8 and 40 = 5
> > x 8, the width/height ratio is 4/5.
> >
> > This should produce a page with a sky sprite and a sand sprite, one
> > below the other. It worked in the past. Each sprite should be 4 x 0.095
> > cm = 0,38 cm wide and 5 x 0.095 cm = 0.475 cm high:
> >
> > \starttext
> > \setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,8pt]}]
> > \startuseMPgraphic{mapa}
> > u:=.095cm;
> > draw externalfigure "./skysprite.png" xscaled 4u yscaled 5u shifted
> > (0u,-0u);
> > draw externalfigure "./sandsprite.png" xscaled 4u yscaled 5u shifted
> > (0u,-5u);
> > \stopuseMPgraphic
> > \useMPgraphic{mapa}
> > \stoptext
> >
> > But instead I got two huge sprites of 2.8 cm x 4.4 cm.
> >
> > Am I forgetting something?
> Originally that worked because the image was always 'included' at 1 bp
> and then scaled but that was (1) inaccurate and (2) a bit depending on
> the image and (3) could overflow metapost.
>
> Use xsized and ysized instead (absolute measures instead of scaling the
> unknown)
>
> 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] Laundry symbols (now: altered picture)

2022-01-02 Thread Hans Hagen via ntg-context

On 1/2/2022 3:12 PM, Alfredo Catalina via ntg-context wrote:
I'm trying to use ConTeXt with Metafun to produce a map of a videogame I 
am working on. In fact I did it 9 years ago but it seems that now it 
doesn't work.


I have two 32 pixels wide by 40 pixels high sprites. They are saved in 
the skysprite.png and sandsprite.png files. Since 32 = 4 x 8 and 40 = 5 
x 8, the width/height ratio is 4/5.


This should produce a page with a sky sprite and a sand sprite, one 
below the other. It worked in the past. Each sprite should be 4 x 0.095 
cm = 0,38 cm wide and 5 x 0.095 cm = 0.475 cm high:


\starttext
\setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,8pt]}]
\startuseMPgraphic{mapa}
u:=.095cm;
draw externalfigure "./skysprite.png" xscaled 4u yscaled 5u shifted 
(0u,-0u);
draw externalfigure "./sandsprite.png" xscaled 4u yscaled 5u shifted 
(0u,-5u);

\stopuseMPgraphic
\useMPgraphic{mapa}
\stoptext

But instead I got two huge sprites of 2.8 cm x 4.4 cm.

Am I forgetting something?
Originally that worked because the image was always 'included' at 1 bp 
and then scaled but that was (1) inaccurate and (2) a bit depending on 
the image and (3) could overflow metapost.


Use xsized and ysized instead (absolute measures instead of scaling the 
unknown)


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] Laundry symbols (now: altered picture)

2022-01-02 Thread Alfredo Catalina via ntg-context
I'm trying to use ConTeXt with Metafun to produce a map of a videogame I
am working on. In fact I did it 9 years ago but it seems that now it
doesn't work.

I have two 32 pixels wide by 40 pixels high sprites. They are saved in the
skysprite.png and sandsprite.png files. Since 32 = 4 x 8 and 40 = 5 x 8,
the width/height ratio is 4/5.

This should produce a page with a sky sprite and a sand sprite, one
below the other. It worked in the past. Each sprite should be 4 x 0.095 cm
= 0,38 cm wide and 5 x 0.095 cm = 0.475 cm high:

\starttext
\setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,8pt]}]
\startuseMPgraphic{mapa}
u:=.095cm;
draw externalfigure "./skysprite.png" xscaled 4u yscaled 5u shifted
(0u,-0u);
draw externalfigure "./sandsprite.png" xscaled 4u yscaled 5u shifted
(0u,-5u);
\stopuseMPgraphic
\useMPgraphic{mapa}
\stoptext

But instead I got two huge sprites of 2.8 cm x 4.4 cm.

Am I forgetting something?

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

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


Re: [NTG-context] [MetaFun] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2022-01-01 Thread Hans Hagen via ntg-context

On 12/31/2021 3:13 AM, kauśika via ntg-context wrote:

Dear list,

I have the following graphic

\startuseMPgraphic{TitleGraphic}
draw outlinetext.b (\MPstring{TitleText})
 (withcolor "titlefg")
 (withcolor "titleoutline");
\stopuseMPgraphic

which I tried to use as follows to produce a stylized 'title' head:

\setupMPtext{TitleText}{%
\starteffect[stretch]\bfc\namedstructurevariable{title}{title}\stopeffect}
\useMPgraphic{TitleGraphic}


low level pdf magic ... so not done in mp


[colors "titlefg" and "titleoutline" are set using \definecolor]

But, the 'stretch' effect caused by \starteffect[stretch]…\stopeffect does not
work with 'outlinetext' method in the MPgraphic. I have verified that the
desired effect is produced using 'textext' method instead. But in that case I
have to cheat (i.e draw twice; once with blownup) to get the text outline.

Now, if I write instead

\setupMPtext{TitleText}{%
\kerncharacters[0.15]\bfc\namedstructurevariable{title}{title}}
\useMPgraphic{TitleGraphic}


tex magic so done in tex


then the desired effect is produced. As such, my purpose is served well by
using \kerncharacters.

Nonetheless, I request your kind help in understanding why this is happening
and/or if I am doing something wrong.
\starteffect is kind of old (comes from mkii), but you could use the 
pseudo font feature effect in mkiv / lmtx which then makes a real font 
instance instead of mixing in some pdf magic


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] [MetaFun] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2021-12-30 Thread kauśika via ntg-context
On Friday, December 31, 2021 7:43:21 AM IST kauśika wrote:
> Dear list,
> 
> I have the following graphic
> 
> \startuseMPgraphic{TitleGraphic}
> draw outlinetext.b (\MPstring{TitleText})
> (withcolor "titlefg")
> (withcolor "titleoutline");
> \stopuseMPgraphic
> 
> which I tried to use as follows to produce a stylized 'title' head:
> 
> \setupMPtext{TitleText}{%
> \starteffect[stretch]\bfc\namedstructurevariable{title}{title}\stopeffect}
> \useMPgraphic{TitleGraphic}
> 
> [colors "titlefg" and "titleoutline" are set using \definecolor]
> 
> But, the 'stretch' effect caused by \starteffect[stretch]…\stopeffect does
> not work with 'outlinetext' method in the MPgraphic. I have verified that
> the desired effect is produced using 'textext' method instead. But in that
> case I have to cheat (i.e draw twice; once with blownup) to get the text
> outline.
> 
> Now, if I write instead
> 
> \setupMPtext{TitleText}{%
> \kerncharacters[0.15]\bfc\namedstructurevariable{title}{title}}
> \useMPgraphic{TitleGraphic}
> 
> then the desired effect is produced. As such, my purpose is served well by
> using \kerncharacters.
> 
> Nonetheless, I request your kind help in understanding why this is happening
> and/or if I am doing something wrong.
> 
> Thanks,
> kauśika

Please read '\setupMPtext' as '\setMPtext' in the above. Apologies for the 
typos.

kauśika


___
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] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2021-12-30 Thread kauśika via ntg-context
Dear list,

I have the following graphic

\startuseMPgraphic{TitleGraphic}
draw outlinetext.b (\MPstring{TitleText})
(withcolor "titlefg")
(withcolor "titleoutline");
\stopuseMPgraphic

which I tried to use as follows to produce a stylized 'title' head:

\setupMPtext{TitleText}{%
\starteffect[stretch]\bfc\namedstructurevariable{title}{title}\stopeffect}
\useMPgraphic{TitleGraphic}

[colors "titlefg" and "titleoutline" are set using \definecolor]

But, the 'stretch' effect caused by \starteffect[stretch]…\stopeffect does not 
work with 'outlinetext' method in the MPgraphic. I have verified that the 
desired effect is produced using 'textext' method instead. But in that case I 
have to cheat (i.e draw twice; once with blownup) to get the text outline.

Now, if I write instead 

\setupMPtext{TitleText}{%
\kerncharacters[0.15]\bfc\namedstructurevariable{title}{title}}
\useMPgraphic{TitleGraphic}

then the desired effect is produced. As such, my purpose is served well by 
using \kerncharacters.

Nonetheless, I request your kind help in understanding why this is happening 
and/or if I am doing something wrong.

Thanks,
kauśika


___
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] metafun: circular arc

2021-10-05 Thread Floris van Manen via ntg-context

In the example the text is drawn as:

draw followtext(q, "\strut TEXT ONE")


it looks as if the \strut generates a space before the text.
e.g. if you omit the \strut, the text will align at the start point.
In my perception, the \strut is a zero width box, so it should not 
generate the space before.

But I might be wrong here (most likely ;-)

.F




On 05/10/2021 23:32, Thomas A. Schmitz via ntg-context wrote:


\startuseMPgraphic{empedocless}
path p, q, r ;
pair a ;

p := fullcircle scaled 10cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
draw    point 0 of p withpen pencircle scaled 1mm withcolor blue ;
q := p cutafter (point .4 along p) ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT ONE") ;

p := fullcircle scaled 8cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor cyan ;
draw    point 0 of p withpen pencircle scaled 1mm withcolor magenta ;
q := p cutafter (point .3 along p) ;
q := q rotated 120 ;
drawarrow q  withpen pencircle scaled .5mm withcolor yellow ;
draw followtext(q, "\strut TEXT TWO") ;

% the real deal: best make a macro for this

p := fullcircle scaled 6cm ;
draw    point 0 of p withpen pencircle scaled 5mm withcolor blue ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
a := (point eps of p) rotated 45 ;
draw a withpen pencircle scaled 2mm;
q := p cutafter a ;
q := q rotated 20 ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT TWO") ;

\stopuseMPgraphic

\useMPgraphic{empedocless}

___
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: circular arc

2021-10-05 Thread Thomas A. Schmitz via ntg-context


Thank you so much, Hans, that's a neat solution! I was banging my head 
against the wall, but this makes sense.


On 10/5/21 6:38 PM, Hans Hagen wrote:

Because you know how to rotate and scale:

\startuseMPgraphic{empedocless}
path p, q, r ;
pair a ;

p := fullcircle scaled 10cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
draw    point 0 of p withpen pencircle scaled 1mm withcolor blue ;
q := p cutafter (point .4 along p) ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT ONE") ;

p := fullcircle scaled 8cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor cyan ;
draw    point 0 of p withpen pencircle scaled 1mm withcolor magenta ;
q := p cutafter (point .3 along p) ;
q := q rotated 120 ;
drawarrow q  withpen pencircle scaled .5mm withcolor yellow ;
draw followtext(q, "\strut TEXT TWO") ;

% the real deal: best make a macro for this

p := fullcircle scaled 6cm ;
draw    point 0 of p withpen pencircle scaled 5mm withcolor blue ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
a := (point eps of p) rotated 45 ;
draw a withpen pencircle scaled 2mm;
q := p cutafter a ;
q := q rotated 20 ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT TWO") ;

\stopuseMPgraphic

\useMPgraphic{empedocless}

So, just always start at point 0 and then just rotate the cutof piece 
over the angle that you want. The eps in the last case makes that we 
actually have a cut off piece (zero fails here).


So ... solution 4. best suits non math gurus (like you and me).


This is the part of your reply that fails to convince. You don't even 
know how bad I am at math...


Thanks, and 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 / 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: circular arc

2021-10-05 Thread Hans Hagen via ntg-context

On 10/5/2021 4:58 PM, Thomas A. Schmitz via ntg-context wrote:


Hi all,

I hope the following example is not too convoluted:

\useMPlibrary [txt]

\define\EmpArrow{\getscaledglyph{1.6}{name:dejavumath}{\char"2B05}}

\setupbodyfont [ss,9pt]

\starttext

\startuseMPgraphic{empedocles}
%numeric a ; a = 6.56cm ;
%numeric b ; b = 1.1 ;
save S; path S[] ;
S[1] = fullcircle scaled 8cm rotated 306 ;
S[2] = S[1] scaled 1.1 ;
S[3] = S[1] scaled 1.23 ;
S[4] = S[1] scaled 1.3 ;
S[5] = S[1] scaled 1.43 ;
S[6] = S[1] scaled 1.5 ;
S[7] = S[1] scaled 1.6 ;
z[1] = point 1 along S[7] ;
z[2] = point 1 along S[1] ;
z[3] = point 0.1 along S[7] ;
z[4] = point 0.1 along S[1] ;
z[5] = point 0.2 along S[7] ;
z[6] = point 0.2 along S[1] ;
z[7] = point 0.3 along S[7] ;
z[8] = point 0.3 along S[1] ;
z[9] = point 0.4 along S[7] ;
z[10] = point 0.4 along S[1] ;
z[11] = point 0.5 along S[7] ;
z[12] = point 0.5 along S[1] ;
z[13] = point 0.6 along S[7] ;
z[14] = point 0.6 along S[1] ;
z[15] = point 0.7 along S[7] ;
z[16] = point 0.7 along S[1] ;
z[17] = point 0.8 along S[7] ;
z[18] = point 0.8 along S[1] ;
S[8] = z[1] -- z[2] ;
S[9] = z[3] -- z[4] ;
S[10] = z[5] -- z[6] ;
S[11] = z[7] -- z[8] ;
S[12] = z[9] -- z[10] ;
S[13] = z[11] -- z[12] ;
S[14] = z[13] -- z[14] ;
S[15] = z[15] -- z[16] ;
S[16] = z[17] -- z[18] ;
z[19] = S[3] intersection_point S[8] ;
z[20] = S[3] intersection_point S[16] ;
S[18] = S[3] cutbefore z[20] cutafter z[19] ;
z[21] = S[5] intersection_point S[8] ;
z[22] = S[5] intersection_point S[16] ;
S[19] = S[5] cutbefore z[22] cutafter z[21] ;
z[23] = S[12] intersection_point S[3] ;
S[20] = S[3] cutbefore z[20] cutafter z[23] ;
for i = 1 upto 16:
 draw S[i] withcolor 0.7white ;
endfor ;
draw z[23] -- z[20] withcolor red ;
draw S[20] withcolor blue ;
label.bot(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
20.000 = 0}"), z[10]) ;
label.llft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
2.000}"), z[8]) ;
label.lft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
4.000}"), z[6]) ;
label.lft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
6.000}"), z[4]) ;
label.ulft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
8.000}"), z[2]) ;
label.urt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
12.000}"), z[18]) ;
label.rt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
14.000}"), z[16]) ;
label.rt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
16.000}"), z[14]) ;
label.lrt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
18.000}"), z[12]) ;
draw followtext(S[18], "\strut\hbox to 2em{\EmpArrow}\hskip2em 
RUHEPAUSE\hskip4em\strut") ;
draw followtext(S[19], "\strut\hbox to 2em{\EmpArrow}EINHEIT 
(SPHAIROS)\hskip2em\strut") ;

\stopuseMPgraphic

\useMPgraphic{empedocles}

\stoptext

I have a big problem and some smaller questions, for those who are 
better at math and at metafun than I am:


1. The big problem: for the next followtext, I need the circular arc 
between points z[23] and z[20]. But however I place the cutbefore and 
cutafter, I don't get the proper part of the circle. I'm looking at the 
right intersection points, as the red line shows, but the blue line 
shows that I'm not getting the right section of the circle. How can I 
get this section into the path S[20]?


2. Math... :-) Is there a better way to define three circles that are at 
exactly the same distance than my naive "scaled 1.3" and "scaled 1.5"?


3. TeX and metafun: is there a better way to have the followtext exactly 
centered between the two circles rather than just fiddle with the scale 
factor?


4. Or is there a better approach to my problem altogether? I'm trying to 
reproduce an illustration from a book, so I'm very open to suggestions 
here. I looked at the example in the metafun manual chapter 10.4, but 
I'm not sure if using an overlay and multiple \followtokens would be 
easier. Especially since there is the scary remark "This definition is 
not the right one!" in this chapter without any further explanation.


I hope you all had a wonderful meeting last week. I was sad I couldn't 
come, I was in Paris for a conference, the first after 18 months, so I 
couldn't skip this one.

Because you know how to rotate and scale:

\startuseMPgraphic{empedocless}
path p, q, r ;
pair a ;

p := fullcircle scaled 10cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
drawpoint 0 of p withpen pencircle scaled 1mm withcolor blue ;
q := p cutafter (point .4 along p) ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT ONE") ;

p := fullcircle scaled 8cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor cyan ;
drawpoint 0 of p withpen pencircle scaled 1mm withcolor mage

[NTG-context] metafun: circular arc

2021-10-05 Thread Thomas A. Schmitz via ntg-context


Hi all,

I hope the following example is not too convoluted:

\useMPlibrary [txt]

\define\EmpArrow{\getscaledglyph{1.6}{name:dejavumath}{\char"2B05}}

\setupbodyfont [ss,9pt]

\starttext

\startuseMPgraphic{empedocles}
%numeric a ; a = 6.56cm ;
%numeric b ; b = 1.1 ;
save S; path S[] ;
S[1] = fullcircle scaled 8cm rotated 306 ;
S[2] = S[1] scaled 1.1 ;
S[3] = S[1] scaled 1.23 ;
S[4] = S[1] scaled 1.3 ;
S[5] = S[1] scaled 1.43 ;
S[6] = S[1] scaled 1.5 ;
S[7] = S[1] scaled 1.6 ;
z[1] = point 1 along S[7] ;
z[2] = point 1 along S[1] ;
z[3] = point 0.1 along S[7] ;
z[4] = point 0.1 along S[1] ;
z[5] = point 0.2 along S[7] ;
z[6] = point 0.2 along S[1] ;
z[7] = point 0.3 along S[7] ;
z[8] = point 0.3 along S[1] ;
z[9] = point 0.4 along S[7] ;
z[10] = point 0.4 along S[1] ;
z[11] = point 0.5 along S[7] ;
z[12] = point 0.5 along S[1] ;
z[13] = point 0.6 along S[7] ;
z[14] = point 0.6 along S[1] ;
z[15] = point 0.7 along S[7] ;
z[16] = point 0.7 along S[1] ;
z[17] = point 0.8 along S[7] ;
z[18] = point 0.8 along S[1] ;
S[8] = z[1] -- z[2] ;
S[9] = z[3] -- z[4] ;
S[10] = z[5] -- z[6] ;
S[11] = z[7] -- z[8] ;
S[12] = z[9] -- z[10] ;
S[13] = z[11] -- z[12] ;
S[14] = z[13] -- z[14] ;
S[15] = z[15] -- z[16] ;
S[16] = z[17] -- z[18] ;
z[19] = S[3] intersection_point S[8] ;
z[20] = S[3] intersection_point S[16] ;
S[18] = S[3] cutbefore z[20] cutafter z[19] ;
z[21] = S[5] intersection_point S[8] ;
z[22] = S[5] intersection_point S[16] ;
S[19] = S[5] cutbefore z[22] cutafter z[21] ;
z[23] = S[12] intersection_point S[3] ;
S[20] = S[3] cutbefore z[20] cutafter z[23] ;
for i = 1 upto 16:
draw S[i] withcolor 0.7white ;
endfor ;
draw z[23] -- z[20] withcolor red ;
draw S[20] withcolor blue ;
label.bot(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
20.000 = 0}"), z[10]) ;
label.llft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
2.000}"), z[8]) ;
label.lft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
4.000}"), z[6]) ;
label.lft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
6.000}"), z[4]) ;
label.ulft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
8.000}"), z[2]) ;
label.urt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
12.000}"), z[18]) ;
label.rt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
14.000}"), z[16]) ;
label.rt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
16.000}"), z[14]) ;
label.lrt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
18.000}"), z[12]) ;
draw followtext(S[18], "\strut\hbox to 2em{\EmpArrow}\hskip2em 
RUHEPAUSE\hskip4em\strut") ;
draw followtext(S[19], "\strut\hbox to 2em{\EmpArrow}EINHEIT 
(SPHAIROS)\hskip2em\strut") ;

\stopuseMPgraphic

\useMPgraphic{empedocles}

\stoptext

I have a big problem and some smaller questions, for those who are 
better at math and at metafun than I am:


1. The big problem: for the next followtext, I need the circular arc 
between points z[23] and z[20]. But however I place the cutbefore and 
cutafter, I don't get the proper part of the circle. I'm looking at the 
right intersection points, as the red line shows, but the blue line 
shows that I'm not getting the right section of the circle. How can I 
get this section into the path S[20]?


2. Math... :-) Is there a better way to define three circles that are at 
exactly the same distance than my naive "scaled 1.3" and "scaled 1.5"?


3. TeX and metafun: is there a better way to have the followtext exactly 
centered between the two circles rather than just fiddle with the scale 
factor?


4. Or is there a better approach to my problem altogether? I'm trying to 
reproduce an illustration from a book, so I'm very open to suggestions 
here. I looked at the example in the metafun manual chapter 10.4, but 
I'm not sure if using an overlay and multiple \followtokens would be 
easier. Especially since there is the scary remark "This definition is 
not the right one!" in this chapter without any further explanation.


I hope you all had a wonderful meeting last week. I was sad I couldn't 
come, I was in Paris for a conference, the first after 18 months, so I 
couldn't skip this one.


Thanks and best wishes

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


[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] weekend upload - stacking and animation

2021-07-13 Thread Jeong Dal
Dear Hans, Wolfgang,

Both of your methods are working well.

Using \frame, the \dorecurse problem is solved.

\starttext
\startanimation[menu=yes]
 \dorecurse{10}
  { \frame{\useMPgraphic[stacking={#1}]{demo}}}
\stopanimation
\stoptext

Thank you for your solutions.

Best regards,

Dalyoung

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

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


Re: [NTG-context] 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] weekend upload - stacking and animation

2021-07-13 Thread Hans Hagen

On 7/13/2021 4:11 PM, Floris van Manen wrote:



On 13/07/2021 15:14, Hans Hagen wrote:

How about:

\startuseMPgraphic{demo}
 for i=1 upto 10:
 draw fullcircle scaled (i*cm/3)
 withcolor (i*red/10)
 withpen   pencircle scaled (bp/2)
 withstacking i
 ;
 endfor ;
\stopuseMPgraphic

\unprotect

\tolerant\protected\def\useMPanimation[#1]#2%
   {\begingroup
    \scratchtoks\emptytoks

\dorecurse{10}{\etoksapp\scratchtoks{{\useMPgraphic[\c!stacking={\recurselevel}]{#2% 


    \expanded{\startanimation[#1]\the\scratchtoks\stopanimation}%
    \endgroup}

\protect

\setupinteraction[state=start]

\usemodule[animation]

\starttext
 \useMPanimation[menu=yes]{demo}
\stoptext


Placing this excerpt in a file and compiling it I get an error:


you probably don't have the animation module installed


-
  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] weekend upload - stacking and animation

2021-07-13 Thread Wolfgang Schuster

Jeong Dal schrieb am 13.07.2021 um 12:25:

Dear Hans, Aditya,

Now, I understand the stacking method.
I made a simple animation using it.

\startuseMPgraphic{demo}
for i=1 upto 10:
draw fullcircle scaled (.3*i*cm) withcolor (.1*i*red) withpen 
pencircle scaled (.5*bp) withstacking i;

endfor;
\stopuseMPgraphic
\setupinteraction[state=start]
\usemodule[animation]
\starttext
\startanimation[menu=yes]
% \dorecurse{10}
% { {\useMPgraphic[stacking={#1}]{demo}}}
{\useMPgraphic[stacking={1}]{demo}}
{\useMPgraphic[stacking={2}]{demo}}
{\useMPgraphic[stacking={3}]{demo}}
{\useMPgraphic[stacking={4}]{demo}}
{\useMPgraphic[stacking={5}]{demo}}
{\useMPgraphic[stacking={6}]{demo}}
{\useMPgraphic[stacking={7}]{demo}}
{\useMPgraphic[stacking={8}]{demo}}
{\useMPgraphic[stacking={9}]{demo}}
{\useMPgraphic[stacking={10}]{demo}}
\stopanimation
\stoptext

However, I cannot succeed to use \dorecurse to make the code simple.
If there is another good method, please let me know.


\dorecurse {...} {\frame{...}}

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] weekend upload - stacking and animation

2021-07-13 Thread Jeong Dal
Dear Hans, Aditya,

Now, I understand the stacking method.
I made a simple animation using it.


\startuseMPgraphic{demo}
  for i=1 upto 10:
  draw fullcircle scaled (.3*i*cm)  withcolor (.1*i*red) withpen  pencircle 
scaled (.5*bp) withstacking i;
  endfor;
\stopuseMPgraphic
\setupinteraction[state=start]
\usemodule[animation]

\starttext
\startanimation[menu=yes]
%  \dorecurse{10}
%  { {\useMPgraphic[stacking={#1}]{demo}}}
  {\useMPgraphic[stacking={1}]{demo}}
  {\useMPgraphic[stacking={2}]{demo}}
  {\useMPgraphic[stacking={3}]{demo}}
  {\useMPgraphic[stacking={4}]{demo}}
  {\useMPgraphic[stacking={5}]{demo}}
  {\useMPgraphic[stacking={6}]{demo}}
  {\useMPgraphic[stacking={7}]{demo}}
  {\useMPgraphic[stacking={8}]{demo}}
  {\useMPgraphic[stacking={9}]{demo}}
  {\useMPgraphic[stacking={10}]{demo}}
\stopanimation
\stoptext


However, I cannot succeed to use \dorecurse to make the code simple.
If there is another good method, please let me know.

Anyway, thanks for this new feature!

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

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


Re: [NTG-context] weekend upload - stacking and animation

2021-07-13 Thread Floris van Manen



On 13/07/2021 15:14, Hans Hagen wrote:

How about:

\startuseMPgraphic{demo}
     for i=1 upto 10:
     draw fullcircle scaled (i*cm/3)
     withcolor (i*red/10)
     withpen   pencircle scaled (bp/2)
     withstacking i
     ;
     endfor ;
\stopuseMPgraphic

\unprotect

\tolerant\protected\def\useMPanimation[#1]#2%
   {\begingroup
    \scratchtoks\emptytoks

\dorecurse{10}{\etoksapp\scratchtoks{{\useMPgraphic[\c!stacking={\recurselevel}]{#2% 


    \expanded{\startanimation[#1]\the\scratchtoks\stopanimation}%
    \endgroup}

\protect

\setupinteraction[state=start]

\usemodule[animation]

\starttext
     \useMPanimation[menu=yes]{demo}
\stoptext


Placing this excerpt in a file and compiling it I get an error:


$ context animation.tex

resolvers   | formats | executing runner 'run luametatex format': 
/home/vm/context/tex/texmf-linux-64/bin/luametatex --jobname="animation" 
--fmt=/home/vm/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt 
--lua=/home/vm/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui 
cont-yes.mkiv --c:currentrun=1 --c:fulljobname="./animation.tex" 
--c:input="./animation.tex" --c:kindofrun=1 --c:maxnofruns=9 
--c:texmfbinpath="/home/vm/context/tex/texmf-linux-64/bin"

open source > level 1, order 1, name 'cont-yes.mkiv'
fonts   > beware: no fonts are loaded yet, using 'lm mono' in box
system  >
system  > ConTeXt  ver: 2021.07.10 21:51 LMTX  fmt: 2021.7.12 
int: english/english

system  > system  > 'cont-new.mkxl' loaded
open source > level 2, order 2, name 
'/home/vm/context/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'

system  > beware: some patches loaded from cont-new.mkiv
close source> level 2, order 2, name 
'/home/vm/context/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname './animation', input 
'./animation.tex', result './animation'

fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
open source > level 2, order 3, name './animation.tex'
modules > 'animation' is not found
fonts   > preloading latin modern fonts (second stage)
fonts   > 'fallback modern-designsize rm 12pt' is loaded
tex error   > tex error on line 31 in file ./animation.tex: 
Undefined control sequence


\startanimation [menu=yes]{\useMPgraphic 
[stacking={1}]{demo}}{\useMPgraphic [stacking={2}]{demo}}{\useMPgraphic 
[stacking={3}]{demo}}{\useMPgraphic [stacking={4}]{demo}}{\useMPgraphic 
[stacking={5}]{demo}}{\useMPgraphic [stacking={6}]{demo}}{\useMPgraphic 
[stacking={7}]{demo}}{\useMPgraphic [stacking={8}]{demo}}{\useMPgraphic 
[stacking={9}]{demo}}{\useMPgraphic [stacking={10}]{demo}}


 \startanimation [menu=yes]\the \scratchtoks \stopanimation

 \expanded #1->\xdef \m_syst_helpers_expanded {\noexpand #1
}\m_syst_helpers_expanded
 \useMPanimation [#1]#2->\begingroup \scratchtoks \emptytoks \par 
\dorecurse {10}{\etoksapp \scratchtoks {{\useMPgraphic [\c!stacking 
={\recurselevel }]{#2\expanded {\startanimation [#1]\the 
\scratchtoks \stopanimation }

\endgroup

 \useMPanimation[menu=yes]{demo}

21\expanded{\startanimation[#1]\the\scratchtoks\stopanimation}%
22\endgroup}
23
24 \protect
25
26 \setupinteraction[state=start]
27
28 \usemodule[animation]
29
30 \starttext
31 >>  \useMPanimation[menu=yes]{demo}
32 \stoptext
33
The control sequence at the end of the top line of your error message 
was never

\def'ed. You can just continue as I'll forget about whatever was undefined.
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] weekend upload - stacking and animation

2021-07-13 Thread Hans Hagen

On 7/13/2021 12:25 PM, Jeong Dal wrote:

Dear Hans, Aditya,

Now, I understand the stacking method.
I made a simple animation using it.


\startuseMPgraphic{demo}
for i=1 upto 10:
draw fullcircle scaled (.3*i*cm) withcolor (.1*i*red) withpen pencircle 
scaled (.5*bp) withstacking i;

endfor;
\stopuseMPgraphic
\setupinteraction[state=start]
\usemodule[animation]

\starttext
\startanimation[menu=yes]
% \dorecurse{10}
% { {\useMPgraphic[stacking={#1}]{demo}}}
{\useMPgraphic[stacking={1}]{demo}}
{\useMPgraphic[stacking={2}]{demo}}
{\useMPgraphic[stacking={3}]{demo}}
{\useMPgraphic[stacking={4}]{demo}}
{\useMPgraphic[stacking={5}]{demo}}
{\useMPgraphic[stacking={6}]{demo}}
{\useMPgraphic[stacking={7}]{demo}}
{\useMPgraphic[stacking={8}]{demo}}
{\useMPgraphic[stacking={9}]{demo}}
{\useMPgraphic[stacking={10}]{demo}}
\stopanimation
\stoptext


However, I cannot succeed to use \dorecurse to make the code simple.
If there is another good method, please let me know.

Anyway, thanks for this new feature!

How about:

\startuseMPgraphic{demo}
for i=1 upto 10:
draw fullcircle scaled (i*cm/3)
withcolor (i*red/10)
withpen   pencircle scaled (bp/2)
withstacking i
;
endfor ;
\stopuseMPgraphic

\unprotect

\tolerant\protected\def\useMPanimation[#1]#2%
  {\begingroup
   \scratchtoks\emptytoks

\dorecurse{10}{\etoksapp\scratchtoks{{\useMPgraphic[\c!stacking={\recurselevel}]{#2%
   \expanded{\startanimation[#1]\the\scratchtoks\stopanimation}%
   \endgroup}

\protect

\setupinteraction[state=start]

\usemodule[animation]

\starttext
\useMPanimation[menu=yes]{demo}
\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] weekend upload

2021-07-12 Thread Jeong Dal
Dear Aditya,

Thank you for your code and an explanation.

> Let's assume that the last MPpage was a \startuseMPgraphic{boxes}  
> \stopuseMPgraphic. Suppose I wanted to use these pictures in a presentation. 
> On the first slide, I can use
> 
>    \useMPgraphic[stacking=0]{boxes}
> 
> to show the three boxes, and on the next slide, I can use
> 
>\useMPgraphic[stacking={-1,0}]{boxes}
> 

I tried to reproduce your example using \startuseMPgraphic{boxes} … 
\stopuseMPgraphic, and useMPgraphic[stacking=0]{boxes} .
A modified one of your code is below.
There is no error message but no output at all.
Would you please tell me what is wrong in here?

Best regards,
Dalyoung


\startMPdefinitions
  input boxes;

  primarydef a +- b =
a -- (xpart a, ypart b) -- b
  enddef ;
  primarydef a -+ b =
a -- (xpart b, ypart a) -- b
  enddef ;
\stopMPdefinitions
\defineframed
  [boxframed]
  [
width=6em,
height=2\lineheight,
align={middle,lohi},
background=color,
backgroundcolor=blue,
foregroundcolor=white,
forefroundstyle=bold,
  ]

\startuseMPgraphic[offset=2mm]{boxes}
  boxit.A("\boxframed{Box A}");
  boxit.B("\boxframed{Box B}");
  boxit.C("\boxframed{Box C}");

  defaultdx := 0pt;
  defaultdy := 0pt;

  A.c = origin;

  B.w - A.e = (1cm, 0);

  0.5[ A.s, B.s ] - C.n = (0, 1cm);

  stacking := 0;
  drawunboxed(A,B,C);
  stacking := 1;
  drawarrow A.s +- C.w ;
  drawarrow B.s +- C.e ;

  newpath highlight;

  highlight := (A.sw -- B.se -- B.ne -- A.nw) enlarged EmWidth;
  fill highlight withcolor "darkgray" withstacking -1;

\stopuseMPgraphic

\starttext
\useMPgraphic[stacking={0}]{boxes}
\useMPgraphic[stacking={0,1}]{boxes}
\useMPgraphic[stacking=-1]{boxes}
\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] weekend upload

2021-07-12 Thread Aditya Mahajan
On Tue, 13 Jul 2021, Jeong Dal wrote:

> Dear Aditya,
> 
> Thank you for your code and an explanation.
> 
> > Let's assume that the last MPpage was a \startuseMPgraphic{boxes}  
> > \stopuseMPgraphic. Suppose I wanted to use these pictures in a 
> > presentation. On the first slide, I can use
> > 
> >\useMPgraphic[stacking=0]{boxes}
> > 
> > to show the three boxes, and on the next slide, I can use
> > 
> >\useMPgraphic[stacking={-1,0}]{boxes}
> > 
> 
> I tried to reproduce your example using \startuseMPgraphic{boxes} … 
> \stopuseMPgraphic, and useMPgraphic[stacking=0]{boxes} .
> A modified one of your code is below.
> There is no error message but no output at all.
> Would you please tell me what is wrong in here?

> [...]
> \startuseMPgraphic[offset=2mm]{boxes}
> [...]

You cannot use [offset=2mm] here. Just use \startuseMPgraphic{boxes}.

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

2021-07-12 Thread Hans Hagen

On 7/12/2021 5:31 AM, Aditya Mahajan wrote:

On Sun, 11 Jul 2021, Bruce Horrocks wrote:


On 9 Jul 2021, at 17:29, Hans Hagen  wrote:

This weekend upload has something new for metapost animation lovers:


Forgive my ignorance but what exactly am I supposed to be seeing here? I run 
the example and get two rows of ten boxes. They don't move so it's not like an 
animated GIF was put into the PDF and they don't appear to be consecutive 
frames that could be joined into an animated GIF.


For me, this feature provides the same capability as 'layers' in a graphical program. 
Consider the diagram shown in page 1 of the attached PDF. Suppose I want to 
"highlight" boxes A and B by drawing a square around them. That is easy; simply 
determine the bounding box of A, B (I do that manually here), and expand it a bit and 
draw it. Simple. See page 2.

Now, suppose I want to fill this highlighted box. Suddenly, we have a problem. The 
highlight box needs to be "behind" the other boxes. How do we do it. We 
determine the location of boxes A, B, and C, but do not draw them. Determine the 
highlight box. Now draw the highlight box first and then draw the boxes. Suddenly the 
code became an order of magnitude more complicated.

With the new stacking mechanism, I can just put the highlight box on "stack 
-1", and everything works well. See page 4. What's also super cool is that I can 
control what gets shown by changing the stacking key.

Let's assume that the last MPpage was a \startuseMPgraphic{boxes}  
\stopuseMPgraphic. Suppose I wanted to use these pictures in a presentation. On 
the first slide, I can use

 \useMPgraphic[stacking=0]{boxes}

to show the three boxes, and on the next slide, I can use

 \useMPgraphic[stacking={-1,0}]{boxes}

to show the boxes and the highlight. Drawing such "conditional" graphics was 
cumbersome in the past. Now, it is easier.

If you show a bunch of such "conditional" graphics in a sequence, you get an 
animation (or you could wrap around the animation module).

Aditya

PS: Hans, stacking doesn't completely work with the boxes macro. drawunboxed is always 
drawn on stack 0, which the bpath is drawn on the right stack. That is the reason I use 
stack = -1 to put the highlight in the "background".


in a netx upload this will work ok

\startMPpage[offset=2mm, stacking={1,2}]

draw fullsquare scaled 4cm withstacking 2 withcolor "red" ;
draw image (
draw fullsquare scaled 2cm withstacking 3 withcolor "green" 
withstacking 3 ;
draw fullsquare scaled 1cm withstacking 4 withcolor "blue" 
withstacking 4 ;

) withstacking 2 withcolor "cyan";

drawarrow llcorner currentpicture .. origin withstacking 3;
\stopMPpage





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

2021-07-12 Thread Hans Hagen

On 7/12/2021 5:31 AM, Aditya Mahajan wrote:

On Sun, 11 Jul 2021, Bruce Horrocks wrote:


On 9 Jul 2021, at 17:29, Hans Hagen  wrote:

This weekend upload has something new for metapost animation lovers:


Forgive my ignorance but what exactly am I supposed to be seeing here? I run 
the example and get two rows of ten boxes. They don't move so it's not like an 
animated GIF was put into the PDF and they don't appear to be consecutive 
frames that could be joined into an animated GIF.


For me, this feature provides the same capability as 'layers' in a graphical program. 
Consider the diagram shown in page 1 of the attached PDF. Suppose I want to 
"highlight" boxes A and B by drawing a square around them. That is easy; simply 
determine the bounding box of A, B (I do that manually here), and expand it a bit and 
draw it. Simple. See page 2.

Now, suppose I want to fill this highlighted box. Suddenly, we have a problem. The 
highlight box needs to be "behind" the other boxes. How do we do it. We 
determine the location of boxes A, B, and C, but do not draw them. Determine the 
highlight box. Now draw the highlight box first and then draw the boxes. Suddenly the 
code became an order of magnitude more complicated.

With the new stacking mechanism, I can just put the highlight box on "stack 
-1", and everything works well. See page 4. What's also super cool is that I can 
control what gets shown by changing the stacking key.

Let's assume that the last MPpage was a \startuseMPgraphic{boxes}  
\stopuseMPgraphic. Suppose I wanted to use these pictures in a presentation. On 
the first slide, I can use

 \useMPgraphic[stacking=0]{boxes}

to show the three boxes, and on the next slide, I can use

 \useMPgraphic[stacking={-1,0}]{boxes}

to show the boxes and the highlight. Drawing such "conditional" graphics was 
cumbersome in the past. Now, it is easier.

If you show a bunch of such "conditional" graphics in a sequence, you get an 
animation (or you could wrap around the animation module).

Aditya

PS: Hans, stacking doesn't completely work with the boxes macro. drawunboxed is always 
drawn on stack 0, which the bpath is drawn on the right stack. That is the reason I use 
stack = -1 to put the highlight in the "background".
I need to ckeck if the range checked does negative numbers ... anyway, 
you can do this


\startMPpage[offset=2mm, stacking={1,2,3,4}]

  boxit.A("\boxframed{Box A}");
  boxit.B("\boxframed{Box B}");
  boxit.C("\boxframed{Box C}");

  defaultdx := 0pt;
  defaultdy := 0pt;

  A.c = origin;

  B.w - A.e = (1cm, 0);

  0.5[ A.s, B.s ] - C.n = (0, 1cm);

  draw image (drawunboxed(A,B,C)) withstacking 2;

  drawarrow A.s +- C.w withstacking 3 ;
  drawarrow B.s +- C.e withstacking 4 ;

  newpath highlight;

  highlight := (A.sw -- B.se -- B.ne -- A.nw) enlarged EmWidth;
  fill highlight withcolor "darkgray" withstacking 1;

\stopMPpage

but only the first edge in an image picture is adapted ... (i actually 
know that i need to fix that in mplib because i noticed the same issue 
with color etc (some old issue)


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

2021-07-11 Thread Aditya Mahajan
On Sun, 11 Jul 2021, Bruce Horrocks wrote:

> > On 9 Jul 2021, at 17:29, Hans Hagen  wrote:
> > 
> > This weekend upload has something new for metapost animation lovers:
> 
> Forgive my ignorance but what exactly am I supposed to be seeing here? I run 
> the example and get two rows of ten boxes. They don't move so it's not like 
> an animated GIF was put into the PDF and they don't appear to be consecutive 
> frames that could be joined into an animated GIF.

For me, this feature provides the same capability as 'layers' in a graphical 
program. Consider the diagram shown in page 1 of the attached PDF. Suppose I 
want to "highlight" boxes A and B by drawing a square around them. That is 
easy; simply determine the bounding box of A, B (I do that manually here), and 
expand it a bit and draw it. Simple. See page 2. 

Now, suppose I want to fill this highlighted box. Suddenly, we have a problem. 
The highlight box needs to be "behind" the other boxes. How do we do it. We 
determine the location of boxes A, B, and C, but do not draw them. Determine 
the highlight box. Now draw the highlight box first and then draw the boxes. 
Suddenly the code became an order of magnitude more complicated. 

With the new stacking mechanism, I can just put the highlight box on "stack 
-1", and everything works well. See page 4. What's also super cool is that I 
can control what gets shown by changing the stacking key. 

Let's assume that the last MPpage was a \startuseMPgraphic{boxes}  
\stopuseMPgraphic. Suppose I wanted to use these pictures in a presentation. On 
the first slide, I can use

\useMPgraphic[stacking=0]{boxes}

to show the three boxes, and on the next slide, I can use

\useMPgraphic[stacking={-1,0}]{boxes}

to show the boxes and the highlight. Drawing such "conditional" graphics was 
cumbersome in the past. Now, it is easier. 

If you show a bunch of such "conditional" graphics in a sequence, you get an 
animation (or you could wrap around the animation module). 

Aditya

PS: Hans, stacking doesn't completely work with the boxes macro. drawunboxed is 
always drawn on stack 0, which the bpath is drawn on the right stack. That is 
the reason I use stack = -1 to put the highlight in the "background". 

background.pdf
Description: Adobe PDF document


background.tex
Description: TeX document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] weekend upload

2021-07-10 Thread Hans Hagen

On 7/9/2021 11:33 PM, Aditya Mahajan wrote:



On Fri, 9 Jul 2021, Hans Hagen wrote:


Hi,

This weekend upload has something new for metapost animation lovers:

\starttext

\startuseMPgraphic{demo}
  stacking := 6;
  fill fullcircle scaled 10cm
  withcolor "red" ;
% stacking := 3;
  stacking := 9;
  fill fullcircle scaled 10cm shifted (3cm,0)
  withcolor "green" ;
  interim stacking := 4;
  fill fullcircle scaled 10cm shifted (3cm,3cm)
  withcolor "blue" ;
  for i=1 upto 10 :
  draw fullcircle scaled (i*cm)
  withstacking 8
  withpen  pencircle scaled 1mm
  withcolor"gray" ;
  endfor ;
  for i=1 upto 20 :
  draw fullcircle scaled (i*cm/2)
  withstacking (if odd(i) : i else : 5 fi)
  withpen  pencircle scaled 2mm ;
  endfor ;
  draw boundingbox currentpicture
  withpen  pencircle scaled 1pt
  withstacking 0 ;
  currentpicture := currentpicture xsized 15mm;
\stopuseMPgraphic

\setupMPvariables[demo]

\startTEXpage
  \vskip1ex
  \hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,#1}}\space}}
  \vskip1ex \nointerlineskip
  \hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,1-#1}}\space}}
  \vskip1ex
\stopTEXpage

\stoptext

I have some more ideas but want to approach it stepwise. It bpils down
to the fact that one can put stuff on different 'layers' and optionally
flush these (by default all are flushed but the stackling order is
honored). An advantage is that one doesn't have to set up a graphic in
order (read: save pictures, flush them later on) and it is actually a
rather cheap extension in terms of runtime and overhead. Although I
could emulate it in mkiv, it is currently an LMTX only feature.

The (optional) list accepts the usual {1,2,5,7-9} kind of specification.


Very interesting. What will be the syntax to use this with \processMPbuffer and 
\startMPcode?

In order to avoid a slash I went for the 'stacking' key:

 \startMPcode[instance=doublefun,stacking=0] % 4
 draw (fullcircle scaled 5cm shifted (0cm,0cm)) withstacking 4;
 draw (fullcircle scaled 5cm shifted (0cm,0cm))
 withpattern image (fill fullcircle scaled 1cm withcolor 
"darkred" ;)

 withpatternscale (1/10,1/10)
 ;
 \stopMPcode

 \startMPpage[offset=1cm,instance=doublefun,stacking=0] % 4
 draw (fullcircle scaled 5cm shifted (0cm,0cm)) withstacking 4;
 draw (fullcircle scaled 5cm shifted (0cm,0cm))
 withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue";)

 withpatternscale (1/10,1/10)
 ;
 \stopMPpage

we also have optionals to \use.., \reuse.. and \unique..

\startTEXpage
\vskip1ex
\hbox{\space\dorecurse{10}{\useMPgraphic
   {demo}{stacking={0,#1}}\space}}
    \vskip1ex \nointerlineskip
\hbox{\space\dorecurse{10}{\useMPgraphic
   {demo}{stacking={0,1-#1}}\space}}
    \vskip1ex \nointerlineskip
\hbox{\space\dorecurse{10}{\useMPgraphic
   [instance=doublefun,stacking={0,1-#1}]{demo}\space}}
\vskip1ex
\stopTEXpage

work in progress (new upload anyway, also with clipping fixed wrt stacking)

(i was wondering for a moment if "undergraphic removal" makes sense but 
it is a somewhat costly operation)


(an other feature to explore is not to rerun but use some wrapper that 
keeps the image for as long as we flush ... it might save some runtime 
but first i need to run into a case where it pays off)


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

2021-07-09 Thread Hans Hagen

On 7/9/2021 11:33 PM, Aditya Mahajan wrote:



On Fri, 9 Jul 2021, Hans Hagen wrote:


Hi,

This weekend upload has something new for metapost animation lovers:

\starttext

\startuseMPgraphic{demo}
  stacking := 6;
  fill fullcircle scaled 10cm
  withcolor "red" ;
% stacking := 3;
  stacking := 9;
  fill fullcircle scaled 10cm shifted (3cm,0)
  withcolor "green" ;
  interim stacking := 4;
  fill fullcircle scaled 10cm shifted (3cm,3cm)
  withcolor "blue" ;
  for i=1 upto 10 :
  draw fullcircle scaled (i*cm)
  withstacking 8
  withpen  pencircle scaled 1mm
  withcolor"gray" ;
  endfor ;
  for i=1 upto 20 :
  draw fullcircle scaled (i*cm/2)
  withstacking (if odd(i) : i else : 5 fi)
  withpen  pencircle scaled 2mm ;
  endfor ;
  draw boundingbox currentpicture
  withpen  pencircle scaled 1pt
  withstacking 0 ;
  currentpicture := currentpicture xsized 15mm;
\stopuseMPgraphic

\setupMPvariables[demo]

\startTEXpage
  \vskip1ex
  \hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,#1}}\space}}
  \vskip1ex \nointerlineskip
  \hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,1-#1}}\space}}
  \vskip1ex
\stopTEXpage

\stoptext

I have some more ideas but want to approach it stepwise. It bpils down
to the fact that one can put stuff on different 'layers' and optionally
flush these (by default all are flushed but the stackling order is
honored). An advantage is that one doesn't have to set up a graphic in
order (read: save pictures, flush them later on) and it is actually a
rather cheap extension in terms of runtime and overhead. Although I
could emulate it in mkiv, it is currently an LMTX only feature.

The (optional) list accepts the usual {1,2,5,7-9} kind of specification.


Very interesting. What will be the syntax to use this with \processMPbuffer and 
\startMPcode?

For now just use:

\setupMPvariables[list=4]

etc (grouped)

btw, i noticed that I need to reset something between graphics

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

2021-07-09 Thread Aditya Mahajan


On Fri, 9 Jul 2021, Hans Hagen wrote:

> Hi,
> 
> This weekend upload has something new for metapost animation lovers:
> 
> \starttext
> 
> \startuseMPgraphic{demo}
>  stacking := 6;
>  fill fullcircle scaled 10cm
>  withcolor "red" ;
>% stacking := 3;
>  stacking := 9;
>  fill fullcircle scaled 10cm shifted (3cm,0)
>  withcolor "green" ;
>  interim stacking := 4;
>  fill fullcircle scaled 10cm shifted (3cm,3cm)
>  withcolor "blue" ;
>  for i=1 upto 10 :
>  draw fullcircle scaled (i*cm)
>  withstacking 8
>  withpen  pencircle scaled 1mm
>  withcolor"gray" ;
>  endfor ;
>  for i=1 upto 20 :
>  draw fullcircle scaled (i*cm/2)
>  withstacking (if odd(i) : i else : 5 fi)
>  withpen  pencircle scaled 2mm ;
>  endfor ;
>  draw boundingbox currentpicture
>  withpen  pencircle scaled 1pt
>  withstacking 0 ;
>  currentpicture := currentpicture xsized 15mm;
> \stopuseMPgraphic
> 
> \setupMPvariables[demo]
> 
> \startTEXpage
>  \vskip1ex
>  \hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,#1}}\space}}
>  \vskip1ex \nointerlineskip
>  \hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,1-#1}}\space}}
>  \vskip1ex
> \stopTEXpage
> 
> \stoptext
> 
> I have some more ideas but want to approach it stepwise. It bpils down 
> to the fact that one can put stuff on different 'layers' and optionally 
> flush these (by default all are flushed but the stackling order is 
> honored). An advantage is that one doesn't have to set up a graphic in 
> order (read: save pictures, flush them later on) and it is actually a 
> rather cheap extension in terms of runtime and overhead. Although I 
> could emulate it in mkiv, it is currently an LMTX only feature.
> 
> The (optional) list accepts the usual {1,2,5,7-9} kind of specification.

Very interesting. What will be the syntax to use this with \processMPbuffer and 
\startMPcode?

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
___


[NTG-context] weekend upload

2021-07-09 Thread Hans Hagen

Hi,

This weekend upload has something new for metapost animation lovers:

\starttext

\startuseMPgraphic{demo}
stacking := 6;
fill fullcircle scaled 10cm
withcolor "red" ;
  % stacking := 3;
stacking := 9;
fill fullcircle scaled 10cm shifted (3cm,0)
withcolor "green" ;
interim stacking := 4;
fill fullcircle scaled 10cm shifted (3cm,3cm)
withcolor "blue" ;
for i=1 upto 10 :
draw fullcircle scaled (i*cm)
withstacking 8
withpen  pencircle scaled 1mm
withcolor"gray" ;
endfor ;
for i=1 upto 20 :
draw fullcircle scaled (i*cm/2)
withstacking (if odd(i) : i else : 5 fi)
withpen  pencircle scaled 2mm ;
endfor ;
draw boundingbox currentpicture
withpen  pencircle scaled 1pt
withstacking 0 ;
currentpicture := currentpicture xsized 15mm;
\stopuseMPgraphic

\setupMPvariables[demo]

\startTEXpage
\vskip1ex
\hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,#1}}\space}}
\vskip1ex \nointerlineskip
\hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,1-#1}}\space}}
\vskip1ex
\stopTEXpage

\stoptext

I have some more ideas but want to approach it stepwise. It bpils down 
to the fact that one can put stuff on different 'layers' and optionally 
flush these (by default all are flushed but the stackling order is 
honored). An advantage is that one doesn't have to set up a graphic in 
order (read: save pictures, flush them later on) and it is actually a 
rather cheap extension in terms of runtime and overhead. Although I 
could emulate it in mkiv, it is currently an LMTX only feature.


The (optional) list accepts the usual {1,2,5,7-9} kind of specification.

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] Delivering the value of a variable in MetaFun to ConTeXt

2021-06-25 Thread Jeong Dal
Dear Aditya and Hans,

Thank you for your suggestion.
I add 

> \startMPcalculation
>  
> \stopMPcalculation

and it works.

\setupinteraction[state=start]
\usemodule[animation]
\starttext
%\startanimation[menu=yes]
%{
\startMPcalculation
 path p;
\stopMPcalculation
\dorecurse{\udCount}
 {\useMPgraphic{foldUD}{num=\recurselevel}}
 {\useMPgraphic{dotLines}{num=\recurselevel}}
%}
%\stopanimation
\stoptext

However, it draws all the figures under the \startanimation case.

There may be something I missed or there is something uncertain between 
\dorecurse and \startanimation.

Thank you.

Best regards,

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

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


Re: [NTG-context] Delivering the value of a variable in MetaFun to ConTeXt

2021-06-24 Thread Jeong Dal
Dear Hans,

Your code works fine.

> \starttext
> 
> \startMPcode
>numeric maxCount;
>maxCount := 10;
>setglobalmacro("MyMacro",decial maxCount);
>setglobalcount("MyCount",maxCount);
> \stopMPcode
> 
> 
> \dorecurse{\MyMacro}{It is \recurselevel. }\par
> \dorecurse{\MyCount}{It is \recurselevel. }\par
> 
> \stoptext

I applied your method to my code as following. 

\newcount\udCount  %%% add count
\startMPinitializations%{UDBasic}
  pair A,B,C,D;
  pair E, F, G, H;
  path p,q;
  numeric ang,maxNum;

  numeric n; %AM Added

  u:=1in;
  A=(.95*TextWidth,u); B=(0,u); C=(0,0); D=(.95*TextWidth,0);
  p := A--B--C--D;
  q := (TextWidth,1.5u)--(0,1.5u)--(0,-.5u)--(TextWidth,-.5u)--cycle;
  z0=(.1u,0);
  
   vardef nextPt (expr M,N) = 
   if ypart(N) = 0: 
   H := whatever[N, N + dir(.5*angle(M-N))*u] = whatever[A,B];
   else:
   H := whatever[N, N + dir(.5*angle(M-N))*u] = whatever[C,D];
   fi;
   H
   enddef;

   def grayUD(expr i) =
  draw G -- if ypart(B)=ypart(G): B -- C else: C -- B fi --z[i];
  filldraw z[i]+2*(G-z[i])*u -- z[i] -- z[i+1] -- z[i+1]+(G-z[i])*u -- 
cycle withcolor .75white; 
  draw G -- z[i+1] dashed evenly;
  draw z[0] for k=0 upto i: --z[k] endfor dashed evenly;
  clip currentpicture to q;
   enddef;

   def linesUD(expr i) =
  draw p;
  draw z0 for k=0 upto i+1: --z[k] endfor dashed evenly;

  % AM: removed. Set in in the main code
  % setbounds currentpicture to boundingbox q;
   enddef;

   ang := 40;
   z[1] = whatever[z[0], z[0]+dir(ang)*u] = whatever[A,B];

   % AM: Changed next line from G to z[-1]
   z[-1] = whatever[z[0], z[0]+dir(2*ang)*u] = whatever[A,B];
   for k = 2 upto 20:
  z[k] = nextPt(z[k-2],z[k-1]);
  maxNum := k;
  exitif xpart(z[k]) > TextWidth;
   endfor;
   maxNum := maxNum-1;
   setglobalmacro("udMacro",decimal maxNum);  %%% define udMacro and udCount
   setglobalcount("udCount",maxNum);

\stopMPinitializations

\startuseMPgraphic{foldUD}{num}
   numeric n;
   n := \MPvar{num}-1;
   G := z[n-1];
   grayUD(n);
\stopuseMPgraphic
\startuseMPgraphic{dotLines}{num}
   numeric n;
   n := \MPvar{num}-1;
   linesUD(n);
\stopuseMPgraphic

\setupinteraction[state=start]
\usemodule[animation]
\starttext
%\startanimation[menu=yes]
%{
\dorecurse{\udCount}
 {\useMPgraphic{foldUD}{num=\recurselevel}}
 {\useMPgraphic{dotLines}{num=\recurselevel}}
%}
%\stopanimation
\stoptext

1. Using “udCount” doesn’t issue error message, but it draws the path p only.
2. Using “udMacro” issue the error message.

Is there anything that I miss?

Best regards,

Dalyoung

**
tex error   > tex error on line 75 in file /Users/graph/Library/Mobile 
Documents/com~apple~CloudDocs/texMain/funmath/foldBandMPnew.tex: Undefined 
control sequence

 \udMacro 

 \dorecurse #1->\ifcase #1
\relax \expandafter \gobbletwoarguments \or \expandafter 
\syst_helpers_recurse_y \else \expandafter \syst_helpers_recurse_x \fi {#1}
 \dorecurse{\udMacro}

65numeric n;
66n := \MPvar{num}-1;
67linesUD(n);
68 \stopuseMPgraphic
69 
70 \setupinteraction[state=start]
71 \usemodule[animation]
72 \starttext
73 %\startanimation[menu=yes]
74 %{
75 >>  \dorecurse{\udMacro}
76  {\useMPgraphic{foldUD}{num=\recurselevel}}
77  {\useMPgraphic{dotLines}{num=\recurselevel}}
78 %}
 ___
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] Delivering the value of a variable in MetaFun to ConTeXt

2021-06-24 Thread Hans Hagen

On 6/24/2021 5:39 AM, Aditya Mahajan wrote:


You need to call the setglobalmacro(...) macro. The code inside 
\startMPinitializations is only executed when you call any MP environment. But 
you are using \udCount before \useMPgraphic. A simple solution is to run dummy 
MP code so that MP initializations are run:

 \starttext
 \setbox\scratchbox\hbox{\startMPcode draw unitcircle; \stopMPcode}
 \dorecurse{\udCount}
  {\useMPgraphic{foldUD}{num=\recurselevel}}
  {\useMPgraphic{dotLines}{num=\recurselevel}}
 \stoptext

A run with no sideeffects in the content stream is:

\startMPcalculation
 
\stopMPcalculation

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] Delivering the value of a variable in MetaFun to ConTeXt

2021-06-23 Thread Aditya Mahajan
On Thu, 24 Jun 2021, Jeong Dal wrote:

> Dear Hans,
> 
> Your code works fine.
> 
> > \starttext
> > 
> > \startMPcode
> >numeric maxCount;
> >maxCount := 10;
> >setglobalmacro("MyMacro",decial maxCount);
> >setglobalcount("MyCount",maxCount);
> > \stopMPcode
> > 
> > 
> > \dorecurse{\MyMacro}{It is \recurselevel. }\par
> > \dorecurse{\MyCount}{It is \recurselevel. }\par
> > 
> > \stoptext
> 
> I applied your method to my code as following. 
> 
> \newcount\udCount  %%% add count
> \startMPinitializations%{UDBasic}
>   pair A,B,C,D;
>   pair E, F, G, H;
>   path p,q;
>   numeric ang,maxNum;
> 
>   numeric n; %AM Added
> 
>   u:=1in;
>   A=(.95*TextWidth,u); B=(0,u); C=(0,0); D=(.95*TextWidth,0);
>   p := A--B--C--D;
>   q := (TextWidth,1.5u)--(0,1.5u)--(0,-.5u)--(TextWidth,-.5u)--cycle;
>   z0=(.1u,0);
>   
>vardef nextPt (expr M,N) = 
>if ypart(N) = 0: 
>H := whatever[N, N + dir(.5*angle(M-N))*u] = whatever[A,B];
>else:
>H := whatever[N, N + dir(.5*angle(M-N))*u] = whatever[C,D];
>fi;
>H
>enddef;
> 
>def grayUD(expr i) =
>   draw G -- if ypart(B)=ypart(G): B -- C else: C -- B fi --z[i];
>   filldraw z[i]+2*(G-z[i])*u -- z[i] -- z[i+1] -- z[i+1]+(G-z[i])*u -- 
> cycle withcolor .75white; 
>   draw G -- z[i+1] dashed evenly;
>   draw z[0] for k=0 upto i: --z[k] endfor dashed evenly;
>   clip currentpicture to q;
>enddef;
> 
>def linesUD(expr i) =
>   draw p;
>   draw z0 for k=0 upto i+1: --z[k] endfor dashed evenly;
> 
>   % AM: removed. Set in in the main code
>   % setbounds currentpicture to boundingbox q;
>enddef;
> 
>ang := 40;
>z[1] = whatever[z[0], z[0]+dir(ang)*u] = whatever[A,B];
> 
>% AM: Changed next line from G to z[-1]
>z[-1] = whatever[z[0], z[0]+dir(2*ang)*u] = whatever[A,B];
>for k = 2 upto 20:
>   z[k] = nextPt(z[k-2],z[k-1]);
>   maxNum := k;
>   exitif xpart(z[k]) > TextWidth;
>endfor;
>maxNum := maxNum-1;
>setglobalmacro("udMacro",decimal maxNum);  %%% define udMacro and udCount
>setglobalcount("udCount",maxNum);
> 
> \stopMPinitializations
> 
> \startuseMPgraphic{foldUD}{num}
>numeric n;
>n := \MPvar{num}-1;
>G := z[n-1];
>grayUD(n);
> \stopuseMPgraphic
> \startuseMPgraphic{dotLines}{num}
>numeric n;
>n := \MPvar{num}-1;
>linesUD(n);
> \stopuseMPgraphic
> 
> \setupinteraction[state=start]
> \usemodule[animation]
> \starttext
> %\startanimation[menu=yes]
> %{
> \dorecurse{\udCount}
>  {\useMPgraphic{foldUD}{num=\recurselevel}}
>  {\useMPgraphic{dotLines}{num=\recurselevel}}
> %}
> %\stopanimation
> \stoptext
> 
> 1. Using “udCount” doesn’t issue error message, but it draws the path p only.
> 2. Using “udMacro” issue the error message.
> 
> Is there anything that I miss?

You need to call the setglobalmacro(...) macro. The code inside 
\startMPinitializations is only executed when you call any MP environment. But 
you are using \udCount before \useMPgraphic. A simple solution is to run dummy 
MP code so that MP initializations are run:

\starttext
\setbox\scratchbox\hbox{\startMPcode draw unitcircle; \stopMPcode}
\dorecurse{\udCount}
 {\useMPgraphic{foldUD}{num=\recurselevel}}
 {\useMPgraphic{dotLines}{num=\recurselevel}}
\stoptext


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

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


Re: [NTG-context] simplifying repeated macro calls in metafun

2021-06-23 Thread Jeong Dal
rt]
\usemodule[animation]
\starttext
\startanimation[menu=yes]
\dorecurse{7}
{
 {\useMPgraphic{foldUD}{num=\recurselevel}}
 {\useMPgraphic{dotLines}{num=\recurselevel}}
}
\stopanimation
\stoptext

Best regards,

Dalyoung

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

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


Re: [NTG-context] 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] new upload

2021-05-05 Thread Hans Hagen

Hi,

I uploaded a new lmtx version. The update mostly concerns part of the 
low level mp-tex interface, a side effect of updating some mechanisms 
(one of which MF currently is extending).


Hopefully it won't break users code that uses low level mp-tex interface 
features but anyway, if needed, adapting is not hard and gives nicer 
code, as in:


  \startuseMPgraphic{foo1}
  fill fullcircle scaled \MPvar{size} withcolor \MPvar{color} ;
  \stopuseMPgraphic

which now becomes:

  \startuseMPgraphic{foo2}
  fill fullcircle scaled mpvard("size") withcolor mpvars "color" ;
  \stopuseMPgraphic

or even can be:

  \startuseMPgraphic{foo3}
  fill fullcircle scaled mpvar "size" withcolor mpvar "color" ;
  \stopuseMPgraphic

where numerics, dimensions and strings are figured out automatically:

  \newdimen\mydimen \mydimen=1cm

  \useMPgraphic{foo1}{size=\mydimen,color=red}

  \useMPgraphic{foo2}{size=2\mydimen,color=green}

  \useMPgraphic{foo3}{size=3cm,color=blue}

So it (still) works (even better) with registers and such.

The fundamental difference is that \MPvar pushes the value of a variable 
from tex to mp (after some analysis) and that mpvar pulls the value from 
the mp end (with some help of the lua interface).


New is that we have inheritance

  \setupMPvariables[foo3][size=1cm,color=yellow]

  \useMPgraphic{foo3}

  \setupMPvariables[foo1][foo3][size=2cm]

  \useMPgraphic{foo1}

Another experiment, already active on my machine for a while, is this:

  \enabledirectives[metapost.text.fasttrack]

which can be a bit more efficient wrt texts.

Another pending change is getting rid of colorhack, which you can try with:

  \enableexperiments[disablecolorhack]

Yet another (already mentioned) experiment users can (should) play with is

  \enableexperiments[simplegroups]

And of course there are:

  \enableexperiments[fonts.compact]

and the less fundamental (and more experimental too):

  \enabledirectives[fonts.injections.method=advance]

At some point compact mode can become the default which then can trigger 
some low level code removal ... of course some sentimental issue because 
throwing away code that has been around for a long time, has evolved to 
be efficient and work well, can hurt but in the end nicer new code wins.


Finally I want to remember overload protection:

  \enabledirectives[overloadmode=warning]

or even

  \enabledirectives[overloadmode=error]

just in case you want to check if your own macros clash or harm the system.

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] 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] Ducks in ConTeXt

2021-01-02 Thread Hans Hagen

On 1/2/2021 7:23 PM, Jairo A. del Rio wrote:



El jue, 31 de dic. de 2020 a la(s) 07:17, Wolfgang Schuster 
(wolfgang.schuster.li...@gmail.com 
<mailto:wolfgang.schuster.li...@gmail.com>) escribió:


Jairo A. del Rio schrieb am 24.12.2020 um 15:18:
 > Hi everyone!
 >
 > I've recently ported TikZducks to ConTeXt and finally removed TIkZ
 > along the way. So a new module was created. The module is called
 > "metaducks" (lol) and it's essentially a \useMPgraphic{...} with
a lot
 > of options, most of them ported from TikZducks. For those not
familiar
 > with the package, it draws customized rubber ducks :) I want to
 > include some more, so I'll gladly read any feedback, recommendations
 > and suggestions. Eventually I want it to be a module on its own. The
 > module is already in the ConTeXt Group:
 >
 >
https://modules.contextgarden.net/cgi-bin/module.cgi/action=details/id=105
<https://modules.contextgarden.net/cgi-bin/module.cgi/action=details/id=105>
 >
 > in case anyone wants to give it a try. Here's a minimal example:
 >
 > \usemodule[metaducks]
 > \starttext
 > \ducks[santa=true,mug=true]
 > \stoptext
 >
 > I wish the best for you all. Happy holidays!

It's nice to see a new third party module for ConTeXt but you have to
make a few changes.

1. You have to put the module and the documentation in the correct doc
and tex folders.


I'm doing it now. Thanks, I'll give my module some more order.

2. You should give your manual a better name, e.g. metaducks-manual.tex 



Agreed. I'll prepare a better manual before updating.

3. You can put your color definitions in the module, there is no need
for a new color file, especially because most of the colors you use are
already predefined.


Oh, colors are a bit different, so I copied RGB definitions from 
xcolor.sty, especially because with ConTeXt colors ducks looked a bit 
"brown" rather than yellow. However, I can merge t-metaducks.mkvi and 
colo-imp-xcolor.mkiv if necessary.

no need to merge ... in lmtx you can play with

withcolor "red"

and such ... best keep colors abstract

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] Ducks in ConTeXt

2021-01-02 Thread Jairo A. del Rio
El jue, 31 de dic. de 2020 a la(s) 07:17, Wolfgang Schuster (
wolfgang.schuster.li...@gmail.com) escribió:

> Jairo A. del Rio schrieb am 24.12.2020 um 15:18:
> > Hi everyone!
> >
> > I've recently ported TikZducks to ConTeXt and finally removed TIkZ
> > along the way. So a new module was created. The module is called
> > "metaducks" (lol) and it's essentially a \useMPgraphic{...} with a lot
> > of options, most of them ported from TikZducks. For those not familiar
> > with the package, it draws customized rubber ducks :) I want to
> > include some more, so I'll gladly read any feedback, recommendations
> > and suggestions. Eventually I want it to be a module on its own. The
> > module is already in the ConTeXt Group:
> >
> >
> https://modules.contextgarden.net/cgi-bin/module.cgi/action=details/id=105
> >
> > in case anyone wants to give it a try. Here's a minimal example:
> >
> > \usemodule[metaducks]
> > \starttext
> > \ducks[santa=true,mug=true]
> > \stoptext
> >
> > I wish the best for you all. Happy holidays!
>
> It's nice to see a new third party module for ConTeXt but you have to
> make a few changes.
>
> 1. You have to put the module and the documentation in the correct doc
> and tex folders.
>

I'm doing it now. Thanks, I'll give my module some more order.


> 2. You should give your manual a better name, e.g. metaducks-manual.tex


Agreed. I'll prepare a better manual before updating.


> 3. You can put your color definitions in the module, there is no need
> for a new color file, especially because most of the colors you use are
> already predefined.
>
>
Oh, colors are a bit different, so I copied RGB definitions from
xcolor.sty, especially because with ConTeXt colors ducks looked a bit
"brown" rather than yellow. However, I can merge t-metaducks.mkvi and
colo-imp-xcolor.mkiv if necessary.

Thank you for your feedback.

Jairo


> 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] Ducks in ConTeXt

2020-12-31 Thread Wolfgang Schuster

Jairo A. del Rio schrieb am 24.12.2020 um 15:18:

Hi everyone!

I've recently ported TikZducks to ConTeXt and finally removed TIkZ 
along the way. So a new module was created. The module is called 
"metaducks" (lol) and it's essentially a \useMPgraphic{...} with a lot 
of options, most of them ported from TikZducks. For those not familiar 
with the package, it draws customized rubber ducks :) I want to 
include some more, so I'll gladly read any feedback, recommendations 
and suggestions. Eventually I want it to be a module on its own. The 
module is already in the ConTeXt Group:


https://modules.contextgarden.net/cgi-bin/module.cgi/action=details/id=105

in case anyone wants to give it a try. Here's a minimal example:

\usemodule[metaducks]
\starttext
\ducks[santa=true,mug=true]
\stoptext

I wish the best for you all. Happy holidays!


It's nice to see a new third party module for ConTeXt but you have to 
make a few changes.


1. You have to put the module and the documentation in the correct doc 
and tex folders.


2. You should give your manual a better name, e.g. metaducks-manual.tex

3. You can put your color definitions in the module, there is no need 
for a new color file, especially because most of the colors you use are 
already predefined.


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] Ducks in ConTeXt

2020-12-24 Thread Jairo A. del Rio
El jue, 24 de dic. de 2020 a la(s) 10:53, Hans Hagen (j.ha...@xs4all.nl)
escribió:

> On 12/24/2020 3:18 PM, Jairo A. del Rio wrote:
> > Hi everyone!
> >
> > I've recently ported TikZducks to ConTeXt and finally removed TIkZ along
> > the way. So a new module was created. The module is called "metaducks"
> > (lol) and it's essentially a \useMPgraphic{...} with a lot of options,
> > most of them ported from TikZducks. For those not familiar with the
> > package, it draws customized rubber ducks :) I want to include some
> > more, so I'll gladly read any feedback, recommendations and suggestions.
> > Eventually I want it to be a module on its own. The module is already in
> > the ConTeXt Group:
> >
> >
> https://modules.contextgarden.net/cgi-bin/module.cgi/action=details/id=105
> > <
> https://modules.contextgarden.net/cgi-bin/module.cgi/action=details/id=105
> >
> >
> > in case anyone wants to give it a try. Here's a minimal example:
> >
> > \usemodule[metaducks]
> > \starttext
> > \ducks[santa=true,mug=true]
> > \stoptext
> >
> > I wish the best for you all. Happy holidays!
> Nice!
>
> You can add, at the end of the module:
>
> \continueifinputfile{t-metaducks.mkvi}
>
> \starttext
>  \dorecurse{100}{
>  \startTEXpage
>  \randomducks % Why plural?
>

Because \duck is already taken by TikZducks :(


>  \stopTEXpage
>  }
> \stoptext
>
> Which means that you run the module directly you get an example.
>
>
Oh, that explains \continueifinputfile in some source files. Nice. I'll add
my test example.


> No need to add \endinput, so just after the \protect (actually in your
> case there is no need for  \unprotect \protect).
>
>
I want to do some additional trickery later, so \unprotect ... \protect are
fine there, I think :)


> Thanks,
>
>
Thanks to you! I enjoy typesetting with ConTeXt and I'm very happy with all
their possibilities.


> Hans
>
> (Who looks out over water where quite often ducks swim.)
>
>
>
Lucky you! We have a nice bay in Callao, but no ducks. I have to visit my
mother's homeland to see them in the wild :D


>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>

Best regards,

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
___


  1   2   3   4   5   6   7   8   9   10   >