Re: [NTG-context] Metapost Animation of Sine

2021-07-21 Thread Otared Kavian
Hi,

Adding to my previous message, if you are looking for an animation of the wave 
equation for a string with fixed endpoints, one has to use something like the 
following:

% begin wave-sine-string.tex
\usemodule[animation]
\setupinteraction[state=start]
\starttext
\startTEXpage[offset=2pt]
\startanimation[menu=yes,framerate=10]
\dorecurse{101}{\expanded
{\startframe
\startMPcode
numeric u, omega, mylength, tt, N ;
u := 2cm ;
omega := 4 ;
mylength := 3.141596 ;
tt := \recurselevel - 1 ;
N := 500 ; % number of steps
path p ;
p := (0u,0u) for i = 1 upto N : 
-- 
(((mylength/N)*i)*u,cos(omega*(mylength/N)*tt)*sin(omega*(mylength/N)*i)*u) 
endfor ;
draw p withpen pencircle scaled .5pt withcolor darkred ;
\stopMPcode
\stopframe}
}
\stopanimation
\stopTEXpage
\stoptext
% end wave-sine-string.tex

Best regards: OK

> On 21 Jul 2021, at 19:44, Jeroen  wrote:
> 
> I am looking for a sine animation as the one file f.pdf on this site
> 
> http://www.12000.org/my_notes/Mathematica_animation_into_PDF_using_latex/index.htm
> 
> Jeroen
> 
> Op wo 21 jul. 2021 om 17:54 schreef Fabrice L :
> Hi,
> 
>> Le 21 juill. 2021 à 10:08, Jeroen  a écrit :
>> 
>> I use this small animation to enlarge a circle
>> 
>> 
>> \usemodule[animation]
>> \setupinteraction[state=start]
>> \starttext
>> \startanimation[menu=yes,framerate=10]
>> \dorecurse{7}{\expanded
>>   {\startframe
>> \startMPcode
>> path p;
>> numeric n, u;
>> u := 1cm;
>> n:=\recurselevel*u;
>> p := fullcircle scaled n;
>> draw p;
>> \stopMPcode
>>   \stopframe}}
>> \stopanimation
>> \stoptext
>> 
>> 
>> This I use to draw a sine
>> 
>> 
>> \starttext
>> \startMPcode
>>   draw(-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
>> (i/360*1.5cm,0.9cm*(sind(i)))endfor;
>> \stopMPcode
>> \stoptext
>> 
>> 
>> When I put it together to animate the sine as following, it does not 
>> entirely create the sine animation I am looking for
>> 
>> 
>> \usemodule[animation]
>> \setupinteraction[state=start]
>> \starttext
>> \startanimation[menu=yes,framerate=10]
>> \dorecurse{7}{\expanded
>>   {\startframe
>> \startMPcode
>> path p;
>> numeric n, u;
>> u := 1cm;
>> n:=\recurselevel*u;
>> p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
>> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
>> draw p;
>> \stopMPcode
>> \stopframe}}
>> \stopanimation
>> \stoptext
>> 
>> 
>> What better way can I create a sine animation with Metapost?
>>  
>> 
> 
> Here is another way to do your animation. This is doing something, but I 
> guess not what you want. Could you describe what do you have in mind ?
> 
> \starttext
> \dorecurse{7}{ % 3180
> \startMPpage
>   myvariable := #1 ;
>   path p;
> numeric n, u;
> u := 1cm;
> n:=myvariable*u;
> p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
> draw p;
> \stopMPpage
> }
> \stoptext
> 
> Fabrice.
> 
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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] Metapost Animation of Sine

2021-07-21 Thread Otared Kavian
Hi, 

I wonder whether something like the following is what you are looking for:

% begin wave-sine.tex
\usemodule[animation]
\setupinteraction[state=start]
\starttext
\startTEXpage[offset=2pt]
\startanimation[menu=yes,framerate=10]
\dorecurse{100}{\expanded
{\startframe
\startMPcode
numeric u, omega, mylength, tt ;
u := 2cm ;
omega := 4 ;
mylength := 3.141596 ;
tt := \recurselevel ;
path p ;
p := (0u,sin(omega*(mylength/100)*tt)*u) for i = 1 upto 
100 : 
.. 
(((mylength/100)*i)*u,sin(omega*(mylength/100)*(i + tt))*u) 
endfor ;
draw p withpen pencircle scaled .5pt withcolor darkred ;
\stopMPcode
\stopframe}
}
\stopanimation
\stopTEXpage
\stoptext
% end wave-sine.tex

Best regards: OK

> On 21 Jul 2021, at 19:44, Jeroen  wrote:
> 
> I am looking for a sine animation as the one file f.pdf on this site
> 
> http://www.12000.org/my_notes/Mathematica_animation_into_PDF_using_latex/index.htm
> 
> Jeroen
> 
> Op wo 21 jul. 2021 om 17:54 schreef Fabrice L :
> Hi,
> 
>> Le 21 juill. 2021 à 10:08, Jeroen  a écrit :
>> 
>> I use this small animation to enlarge a circle
>> 
>> 
>> \usemodule[animation]
>> \setupinteraction[state=start]
>> \starttext
>> \startanimation[menu=yes,framerate=10]
>> \dorecurse{7}{\expanded
>>   {\startframe
>> \startMPcode
>> path p;
>> numeric n, u;
>> u := 1cm;
>> n:=\recurselevel*u;
>> p := fullcircle scaled n;
>> draw p;
>> \stopMPcode
>>   \stopframe}}
>> \stopanimation
>> \stoptext
>> 
>> 
>> This I use to draw a sine
>> 
>> 
>> \starttext
>> \startMPcode
>>   draw(-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
>> (i/360*1.5cm,0.9cm*(sind(i)))endfor;
>> \stopMPcode
>> \stoptext
>> 
>> 
>> When I put it together to animate the sine as following, it does not 
>> entirely create the sine animation I am looking for
>> 
>> 
>> \usemodule[animation]
>> \setupinteraction[state=start]
>> \starttext
>> \startanimation[menu=yes,framerate=10]
>> \dorecurse{7}{\expanded
>>   {\startframe
>> \startMPcode
>> path p;
>> numeric n, u;
>> u := 1cm;
>> n:=\recurselevel*u;
>> p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
>> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
>> draw p;
>> \stopMPcode
>> \stopframe}}
>> \stopanimation
>> \stoptext
>> 
>> 
>> What better way can I create a sine animation with Metapost?
>>  
>> 
> 
> Here is another way to do your animation. This is doing something, but I 
> guess not what you want. Could you describe what do you have in mind ?
> 
> \starttext
> \dorecurse{7}{ % 3180
> \startMPpage
>   myvariable := #1 ;
>   path p;
> numeric n, u;
> u := 1cm;
> n:=myvariable*u;
> p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
> draw p;
> \stopMPpage
> }
> \stoptext
> 
> Fabrice.
> 
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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] Use of lettrine module in LMTX

2021-07-21 Thread Wolfgang Schuster

Gerben Wierda schrieb am 21.07.2021 um 12:00:
On 19 Jul 2021, at 09:56, Nicola > wrote:


On 2021-07-18, Gerben Wierda > wrote:

PS. switching \kap and \bf has an interesting result, the first
character of the words is not in bold. This did not happen with
lettrine in mkii


I do not have an answer to your question, but I'd like to point out that
you can keep using lettrine with ConTeXt LMTX, if you wish. You just
need to add the modules manually, currently:

https://wiki.contextgarden.net/Modules#ConTeXt_LMTX


I’ve tried this. Installed the modules and then I get with

[...]


Short version:

You get an error message for the \!!dimena command which is used by
the module but doesn't exist anymore.


Long version:

Hans started a few years ago to replace many of the old cryptic names
(e.g. \@EAEA) with sometimes longer but more readable names
(e.g. \doubleexpandafter). A short while ago he removed a few of these
old commands (in this case a length register) in LMTX because they
aren't used anymore in the core.

The lettrine module is very old and never got a proper MkIV/LMTX
version and the use of one of these old commands results in an error.

While it's easy to fix the problem you're going to find the next problem
because LMTX has a new mechanism which is related to paragraph
related settings like indentation. As a result of this new mechanism
\lettrine places the initial to the left of the paragraph without
reserving space to indent the first few lines.

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] Use of lettrine module in LMTX

2021-07-21 Thread Nicola
On 2021-07-21, Gerben Wierda  wrote:
>> On 19 Jul 2021, at 09:56, Nicola  wrote:
>>
>> On 2021-07-18, Gerben Wierda  wrote:
>>> PS. switching \kap and \bf has an interesting result, the first
>>> character of the words is not in bold. This did not happen with
>>> lettrine in mkii
>>
>> I do not have an answer to your question, but I'd like to point out that
>> you can keep using lettrine with ConTeXt LMTX, if you wish. You just
>> need to add the modules manually, currently:
>>
>>https://wiki.contextgarden.net/Modules#ConTeXt_LMTX
>
> I’ve tried this. Installed the modules and then I get with

I was sure that I had used lettrine with MKIV in a document of mine, but
after your reply I double checked that and, in fact, I was using
lettrine only with MKII. On the plus side, I have recovered my settings
for MKIV (which work with LMTX as well).

I think that the `distance` parameter of \setupinitials does what you
want. Besides, if your font provides real small capitals, you may use
\definefirstline.

This is how I set up things in one of my documents:


\definefontfeature[default][default][protrusion=quality,expansion=quality,onum=no,lnum=yes]

% \definefirstline below requires a font that implements small capitals as
% a feature (Latin Modern does not). I have used this:
% \definefontfamily[mainfont][serif][Sorts Mill Goudy] [
%   tf=name:Sorts Mill Goudy Regular,
%   it=name:Sorts Mill Goudy Italic,
% ]
% If you don't have the font above, try this:
\setupbodyfont[heros]

\setupbodyfont[mainfont,11pt]

\definemeasure[CAindent][12pt]
\setupindenting[yes,\measure{CAindent}]

% Every chapter body text starts with a drop cap:
\defineinitial[normal][
  n=3,
  m=1,
  distance=18pt, % <== Add this 
  state=start
]

% Special case: drop cap starting with a quote
\defineinitial[quote][
  n=3,
  m=2,
  distance=13pt,
  hoffset=5pt, % Move drop cap a bit to the left
  method=none
]

% Some initials may need special adjustments, depending on the font
\defineinitial[Q][
  voffset=2\lineheight,
  n=3,
  m=1,
  distance=18pt,
  state=start
]

% Full first line in small caps
\definefirstline[smallcapsfirstline][
  alternative=line,
  style=smallcaps,
]

% First n words in small caps (three in this case)
\definefirstline[smallcapsfirstlinethree][
  alternative=word,
  n=3,
  style=smallcaps,
]

\starttext
\setfirstline[smallcapsfirstlinethree]
\setinitial[normal] Suppose we have a system for the approval of
loans. \input knuth
\blank[2*big]

\setfirstline[smallcapsfirstline]
\setinitial[quote] “Suppose we have a system for the approval of
loans.” \input knuth
\blank[2*big]

\setfirstline[smallcapsfirstline]
\setinitial[Q] Quo usque tandem abutere, Catilina, patientia nostra? quam diu
etiam furor iste tuus nos1 eludet? quem ad finem sese effrenata iactabit
audacia?

\stoptext


I hope this will give you some ideas!

References:

https://wiki.contextgarden.net/Command/setupinitial
https://wiki.contextgarden.net/Command/definefirstline
https://www.fontsquirrel.com/fonts/Sorts-Mill-Goudy

Nicola




___
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] Metapost Animation of Sine

2021-07-21 Thread Jeroen
I am looking for a sine animation as the one file f.pdf on this site

http://www.12000.org/my_notes/Mathematica_animation_into_PDF_using_latex/index.htm

Jeroen

Op wo 21 jul. 2021 om 17:54 schreef Fabrice L :

> Hi,
>
> Le 21 juill. 2021 à 10:08, Jeroen  a écrit :
>
> I use this small animation to enlarge a circle
>
>
> \usemodule[animation]
> \setupinteraction[state=start]
> \starttext
> \startanimation[menu=yes,framerate=10]
> \dorecurse{7}{\expanded
>   {\startframe
> \startMPcode
> path p;
> numeric n, u;
> u := 1cm;
> n:=\recurselevel*u;
> p := fullcircle scaled n;
> draw p;
> \stopMPcode
>   \stopframe}}
> \stopanimation
> \stoptext
>
>
> This I use to draw a sine
>
>
> \starttext
> \startMPcode
>   draw(-90/360*1.5cm,-0.9cm) for i = -90 upto 630: ..
> (i/360*1.5cm,0.9cm*(sind(i)))endfor;
> \stopMPcode
> \stoptext
>
>
> When I put it together to animate the sine as following, it does not
> entirely create the sine animation I am looking for
>
>
> \usemodule[animation]
> \setupinteraction[state=start]
> \starttext
> \startanimation[menu=yes,framerate=10]
> \dorecurse{7}{\expanded
>   {\startframe
> \startMPcode
> path p;
> numeric n, u;
> u := 1cm;
> n:=\recurselevel*u;
> p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: ..
> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
> draw p;
> \stopMPcode
> \stopframe}}
> \stopanimation
> \stoptext
>
>
> What better way can I create a sine animation with Metapost?
>
>
>
>
> Here is another way to do your animation. This is doing something, but I
> guess not what you want. Could you describe what do you have in mind ?
>
> \starttext
> \dorecurse{7}{ % 3180
> \startMPpage
> myvariable := #1 ;
> path p;
> numeric n, u;
> u := 1cm;
> n:=myvariable*u;
> p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: ..
> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
> draw p;
> \stopMPpage
> }
> \stoptext
>
> Fabrice.
>
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] MP keyword function: string parameters no longer accept string variables directly

2021-07-21 Thread Hans Hagen

On 7/21/2021 6:51 PM, Rudd, Kevin wrote:

Hi---

Here's another apparent change on the MP side---for keyword functions, 
string parameters no longer accept string variables directly. They do 
seem to register them (hasparameter => true) but don't capture the value 
(getparameter => 0). Thus:
fixed in next upload (the build bot is in maintainance mode so maybe not 
for all platforms)


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] Layers – when do they repeat?

2021-07-21 Thread Henning Hraban Ramm
Hi, this is still unresolved.
I worked around the unwanted repeating layer by resetting them explicitely 
after the first page, but that should not be necessary.
Hraban

> Am 01.07.2021 um 17:38 schrieb Henning Hraban Ramm :
> 
> Hi,
> I’m struggling with layers again.
> 
> According to https://wiki.contextgarden.net/Layers and my previous 
> experience, what you typeset on layers appears only once, while you don’t set 
> repeat=yes.
> 
> But in my example (derived from a magazine layout where I use this margin 
> layer for subtitles) the margin text is repeated on every page. Same behavior 
> in current LMTX and MkIV.
> 
> What did I wrong? Or is it a bug? (The same setup didn’t cause repeats in 
> 2019.)
> 
> Hraban
> 
> 
> 
> \usemodule[visual]
> 
> \setuplayout[
>backspace=82mm,
>width=118mm,
>leftmargindistance=4mm,
>leftmargin=57mm,
> ]
> 
> \definelayer[leftmargin][
>x=0mm,y=3mm,
>width=\leftmarginwidth,
>height=\textheight
> ]
> 
> \setupbackgrounds[text][leftmargin][background=leftmargin,state=start]
> 
> \starttext
> 
> \setlayerframed[leftmargin][
>  frame=off,
>  offset=overlay,
>  width=\leftmarginwidth,
>  align={flushleft,verytolerant},
> ]{Why is this repeated on every page? It should not.}%
> 
> \dorecurse{20}{
> \fakewords{20}{100}\par
> }
> 
> \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] MP keyword function: string parameters no longer accept string variables directly

2021-07-21 Thread Rudd, Kevin
Hi---

Here's another apparent change on the MP side---for keyword functions, string 
parameters no longer accept string variables directly. They do seem to register 
them (hasparameter => true) but don't capture the value (getparameter => 0). 
Thus:

system  > ConTeXt  ver: 2021.07.16 22:03 LMTX  fmt: 2021.7.21  int: 
english/english

metapost> trace > This is MPLIB for LuaMetaTeX, version 3.11, running 
in scaled mode.
metapost> trace >
metapost> trace > loading metafun for lmtx, including the plain 1.004 
base definitions
metapost> trace >
metapost> trace > >> "string constant fuschia ..."
metapost> trace > >> true
metapost> trace > >> "fuschia"
metapost> trace > >> "string variable fuschia = fuschia ..."
metapost> trace > >> true
metapost> trace > >> 0
metapost> trace > >> "expression containing string variable fuschia = 
fuschia ..."
metapost> trace > >> true
metapost> trace > >> "fuschia"

String constant: succeeds
String variable: fails
String expression with string variable: succeeds

Here's the MWE:



% system  > ConTeXt  ver: 2021.07.16 22:03 LMTX  fmt: 2021.7.21  int: 
english/english

\startMPdefinitions

presetparameters "parameters_Test"
[
]

def Test =
applyparameters "parameters_Test" "do_Test"
enddef;

def do_Test =
pushparameters "parameters_Test";
show hasparameter "color";
show getparameter "color";
enddef;

\stopMPdefinitions

\starttext

hello

\startalignment[center]
\startplacefigure
\startMPcode
string fuschia; fuschia = "fuschia";

show "string constant fuschia ...";
Test [ color = "fuschia" ];

show "string variable fuschia = " & fuschia & " ...";
Test [ color =  fuschia  ];

show "expression containing string variable fuschia = " & fuschia & 
" ...";
Test [ color =  "" & fuschia  ];

\stopMPcode
\stopplacefigure
\stopalignment

goodbye

\stoptext




Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)

Computer Architecture & Computer Engineering
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)

443-654-7878
ke...@lps.umd.edu

Visiting Research Professor
United States Naval Academy

r...@usna.edu


___
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] Metapost Animation of Sine

2021-07-21 Thread Fabrice L
Hi,

> Le 21 juill. 2021 à 10:08, Jeroen  a écrit :
> 
> I use this small animation to enlarge a circle
> 
> 
> \usemodule[animation]
> \setupinteraction[state=start]
> \starttext
> \startanimation[menu=yes,framerate=10]
> \dorecurse{7}{\expanded
>   {\startframe
> \startMPcode
> path p;
> numeric n, u;
> u := 1cm;
> n:=\recurselevel*u;
> p := fullcircle scaled n;
> draw p;
> \stopMPcode
>   \stopframe}}
> \stopanimation
> \stoptext
> 
> 
> This I use to draw a sine
> 
> 
> \starttext
> \startMPcode
>   draw(-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
> (i/360*1.5cm,0.9cm*(sind(i)))endfor;
> \stopMPcode
> \stoptext
> 
> 
> When I put it together to animate the sine as following, it does not entirely 
> create the sine animation I am looking for
> 
> 
> \usemodule[animation]
> \setupinteraction[state=start]
> \starttext
> \startanimation[menu=yes,framerate=10]
> \dorecurse{7}{\expanded
>   {\startframe
> \startMPcode
> path p;
> numeric n, u;
> u := 1cm;
> n:=\recurselevel*u;
> p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
> draw p;
> \stopMPcode
> \stopframe}}
> \stopanimation
> \stoptext
> 
> 
> What better way can I create a sine animation with Metapost?
>  
> 

Here is another way to do your animation. This is doing something, but I guess 
not what you want. Could you describe what do you have in mind ?

\starttext
\dorecurse{7}{ % 3180
\startMPpage
myvariable := #1 ;
path p;
numeric n, u;
u := 1cm;
n:=myvariable*u;
p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
(i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
draw p;
\stopMPpage
}
\stoptext

Fabrice.


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

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


Re: [NTG-context] MP boxes: boxjoin not recognized?

2021-07-21 Thread Hans Hagen

On 7/21/2021 12:29 PM, Rudd, Kevin wrote:

Hi---

All of my figures that use MP boxes are now failing. It looks like 
"boxjoin" (from the MP "boxes" macros) is not being recognized. Also, 
apparently unrelated, I wonder if the comparison in "boxes.mp" is 
correct as it appears that lmtx loads "mp-xbox.mpiv" instead of 
"mp-xbox.mpxl". Here is some log output and a (mostly) MWE.


Indeed, I made that one an mp-* because it removes a dependency. The 
only real depency left now in a context install is a bunch of fonts.



Thanks for any suggestions,


i'll add

def boxjoin(text t) =
def boxes_prevbox = _ enddef;
def boxes_dojoin(suffix a,b) = t enddef;
enddef;

for now you can just add it


                 % boxes.mp: scantokens("input mp-xbox.mp" & (if 
metapostversion > 2 : "xl" else : "iv" fi)) ;
                 %           => loads mp-xbox.mpiv in lmtx rather than 
mp-xbox.mpxl as i would have expected


hm, indeed, fixed; thanks for noticing,

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] Metapost Animation of Sine

2021-07-21 Thread Jeroen
I use this small animation to enlarge a circle


\usemodule[animation]
\setupinteraction[state=start]
\starttext
\startanimation[menu=yes,framerate=10]
\dorecurse{7}{\expanded
  {\startframe
\startMPcode
path p;
numeric n, u;
u := 1cm;
n:=\recurselevel*u;
p := fullcircle scaled n;
draw p;
\stopMPcode
  \stopframe}}
\stopanimation
\stoptext


This I use to draw a sine


\starttext
\startMPcode
  draw(-90/360*1.5cm,-0.9cm) for i = -90 upto 630: ..
(i/360*1.5cm,0.9cm*(sind(i)))endfor;
\stopMPcode
\stoptext


When I put it together to animate the sine as following, it does not
entirely create the sine animation I am looking for


\usemodule[animation]
\setupinteraction[state=start]
\starttext
\startanimation[menu=yes,framerate=10]
\dorecurse{7}{\expanded
  {\startframe
\startMPcode
path p;
numeric n, u;
u := 1cm;
n:=\recurselevel*u;
p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: ..
(i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
draw p;
\stopMPcode
\stopframe}}
\stopanimation
\stoptext


What better way can I create a sine animation with Metapost?
___
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] MP boxes: boxjoin not recognized?

2021-07-21 Thread Rudd, Kevin
Hi---

All of my figures that use MP boxes are now failing. It looks like "boxjoin" 
(from the MP "boxes" macros) is not being recognized. Also, apparently 
unrelated, I wonder if the comparison in "boxes.mp" is correct as it appears 
that lmtx loads "mp-xbox.mpiv" instead of "mp-xbox.mpxl". Here is some log 
output and a (mostly) MWE.

Thanks for any suggestions,
 ---K

% system  > ConTeXt  ver: 2021.07.16 22:03 LMTX  fmt: 2021.7.21  int: 
english/english

% metapost> initializing instance 'metafun:1' using format 'metafun' 
and method 'default'
% metapost> loading 'metafun' as 'metafun.mpxl' using method 'default'
% metapost> initializing number mode 'scaled'
% metapost> trace > This is MPLIB for LuaMetaTeX, version 3.11, running 
in scaled mode.
% metapost> trace >
% metapost> trace > loading metafun for lmtx, including the plain 1.004 
base definitions
% metapost> trace >
% metapost> trace > >> 2
% metafun > log >
% metafun > log > error: Isolated expression
% metafun > log >
% metapost> trace > >> boxjoin
% metapost> trace > 
% metapost> trace > <*> show metapostversion; boxjoin(
% metafun > log >
% metafun > log > I couldn't find an '=' or ':=' after the expression 
that is shown above this
% error message, so I guess I'll just ignore it and carry on.
% metafun > log >
% metapost> trace >); boxit.a("a"); 
boxit.bb("bb"); boxit.ccc("ccc"); drawboxed(a,bb,ccc); ;
% metapost> trace >



\startMPdefinitions
input boxes
\stopMPdefinitions

\starttext

hello

\startalignment[center]
\startplacefigure
\startMPcode%{aaa}
show metapostversion;
% boxes.mp: scantokens("input mp-xbox.mp" & (if metapostversion 
> 2 : "xl" else : "iv" fi)) ;
%   => loads mp-xbox.mpiv in lmtx rather than 
mp-xbox.mpxl as i would have expected
boxjoin();
% boxjoin(a.se=b.sw; a.ne=b.nw);
boxit.a("a");
boxit.bb("bb");
boxit.ccc("ccc");
drawboxed(a,bb,ccc);
\stopMPcode
\stopplacefigure
\stopalignment

goodbye

\stoptext



Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)

Computer Architecture & Computer Engineering
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)

443-654-7878
ke...@lps.umd.edu

Visiting Research Professor
United States Naval Academy

r...@usna.edu


___
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] ntg-context Digest, Vol 205, Issue 1 // log: use \thinspace instead of \,

2021-07-21 Thread Rudd, Kevin
Argh; mea culpa. Thanks for the very quick reply, Hans. It does work "as 
expected" (albeit deprecated)---Tracking down errors, I was misled by an error 
immediately following the deprecation warning and associated it with the 
warning, not the subsequent text.

Thanks,
 ---K

Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)

Computer Architecture & Computer Engineering
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)

443-654-7878
ke...@lps.umd.edu

Visiting Research Professor
United States Naval Academy

r...@usna.edu


On Jul 21, 2021, at 05:48, Hans Hagen 
mailto:j.ha...@xs4all.nl>> wrote:

On 7/21/2021 11:04 AM, Rudd, Kevin wrote:
Revisiting this one---as noted in the thread \, used to work in text mode;
according to the logs it was deprecated and now produces an error
preventing most of my documents from compiling.
Is there solution that restores \, (and friends) for abbreviated spacing in 
text mode
that doesn't require bulk changes to all of my documents
(and making the source documents hard to type/read)?
I appreciate using the more verbose \thinspace in macros
but the abbreviations have real value in bulk text,
especially when heavily used.
I have many uses throughout my documents where I need a thin space
(such as working with SI units) where it would be very awkward
to use \thinspace everywhere in the source text.
for example, consider a simple example that used to work but no longer does
with the alternatives that I'm aware of:
32\,MiB--64\,MiB
32$\,$MiB--64$\,$MiB
32\thinspace MiB--64\thinspace MiB
The difference in both writeability and readability for these cases is 
significant
afaikt

\starttext
   test\,test
\stoptext

just works (\unit {32 mebibyte}--\unit {64 mebibyte} also works)

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] Use of lettrine module in LMTX

2021-07-21 Thread Gerben Wierda
> On 19 Jul 2021, at 09:56, Nicola  wrote:
> 
> On 2021-07-18, Gerben Wierda  wrote:
>> PS. switching \kap and \bf has an interesting result, the first
>> character of the words is not in bold. This did not happen with
>> lettrine in mkii
> 
> I do not have an answer to your question, but I'd like to point out that
> you can keep using lettrine with ConTeXt LMTX, if you wish. You just
> need to add the modules manually, currently:
> 
>https://wiki.contextgarden.net/Modules#ConTeXt_LMTX

I’ve tried this. Installed the modules and then I get with

\definemeasure[CAindent][12pt]
\setupindenting[yes,\measure{CAindent}]
% Every chapter body text starts with a drop cap:

\usemodule[lettrine]
\setuplettrine[Lines=3,
   Hang=.5,
   Oversize=0,
   Raise=0,
   Findent=0pt,
   Nindent=0em,
   Slope=0em,
   Ante=,
   FontHook=,
   TextFont=\sc,
   Image=no]

\starttext
\lettrine{S}{\kap{\bf uppose we}} have a system for the approval of
loans. \input knuth
\stoptext

Result:

tex error   > tex error on line 19 in file ./test.tex: Undefined control 
sequence

 \m_syst_parameter_n ... \the \LettrineHeight ] X}}\scratchcounter = 
\numexpr (100*\LettrineHeight )/(\ht \Lettrinetbox /100) - \relax \ifnum 
\scratchcounter >0 \def \tempa {1.\the \scratchcounter }\else \def \tempa 
{1}\fi \LettrineFontHook \!!dimena 
= \tempa \Let...
 \dolettrine ...\Lettrinefindent =\LettrineFindent \relax \Lettrinelines 
=\LettrineLines \relax \setbox \Lettrinelbox \hbox {{\ifx \LettrineImage \v!yes 
\doLettrineEPS {#2}\else \ifx \LettrineImage \v!true \doLettrineEPS {#2}\else 
\doLettrineFont 
#2\fi \fi }}\...
 \lettrine{S}{\kap{\bf uppose we}}
 have a system for the approval of
 9Raise=0,
10Findent=0pt,
11Nindent=0em,
12Slope=0em,
13Ante=,
14FontHook=,
15TextFont=\sc,
16Image=no]
17 
18 \starttext
19 >>  \lettrine{S}{\kap{\bf uppose we}} have a system for the approval of
20 loans. \input knuth
21 \stoptext
22 
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


Gerben Wierda (LinkedIn )
R Enterprise Architecture  (main site)
Book: Chess and the Art of Enterprise Architecture 
Book: Mastering ArchiMate 

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

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

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


Re: [NTG-context] ntg-context Digest, Vol 205, Issue 1 // log: use \thinspace instead of \,

2021-07-21 Thread Hans Hagen

On 7/21/2021 11:04 AM, Rudd, Kevin wrote:

Revisiting this one---as noted in the thread \, used to work in text mode;
according to the logs it was deprecated and now produces an error
preventing most of my documents from compiling.

Is there solution that restores \, (and friends) for abbreviated spacing 
in text mode

that doesn't require bulk changes to all of my documents
(and making the source documents hard to type/read)?
I appreciate using the more verbose \thinspace in macros
but the abbreviations have real value in bulk text,
especially when heavily used.

I have many uses throughout my documents where I need a thin space
(such as working with SI units) where it would be very awkward
to use \thinspace everywhere in the source text.

for example, consider a simple example that used to work but no longer does
with the alternatives that I'm aware of:

     32\,MiB--64\,MiB

     32$\,$MiB--64$\,$MiB
     32\thinspace MiB--64\thinspace MiB

The difference in both writeability and readability for these cases is 
significant

afaikt

\starttext
test\,test
\stoptext

just works (\unit {32 mebibyte}--\unit {64 mebibyte} also works)

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] ntg-context Digest, Vol 205, Issue 1 // log: use \thinspace instead of \,

2021-07-21 Thread Rudd, Kevin
Revisiting this one---as noted in the thread \, used to work in text mode;
according to the logs it was deprecated and now produces an error
preventing most of my documents from compiling.

Is there solution that restores \, (and friends) for abbreviated spacing in 
text mode
that doesn't require bulk changes to all of my documents
(and making the source documents hard to type/read)?
I appreciate using the more verbose \thinspace in macros
but the abbreviations have real value in bulk text,
especially when heavily used.

I have many uses throughout my documents where I need a thin space
(such as working with SI units) where it would be very awkward
to use \thinspace everywhere in the source text.

for example, consider a simple example that used to work but no longer does
with the alternatives that I'm aware of:

32\,MiB--64\,MiB

32$\,$MiB--64$\,$MiB
32\thinspace MiB--64\thinspace MiB

The difference in both writeability and readability for these cases is 
significant,
especially when there are many uses close together in either text or table.

Thanks,
 ---K

Re: log: use \thinspace instead of \,

On 6/30/2021 10:57 PM, Wolfgang Schuster wrote:
Alan Braslau schrieb am 29.06.2021 um 17:40:
On Tue, 29 Jun 2021 14:06:02 +0200
Henning Hraban Ramm mailto:te...@fiee.net>> wrote:

Maybe, but in running text I use \, all the time e.\,g. in
abbreviations or for numbers (10\,000). At least in German typography
these “spatiums” are necessary.
In French typography as well.

Indeed,
American: 10,000.00
French:   10\,000,00
(and other languages).

This is quite readable, and much preferred to the use of any kind of
macro that might format numbers according to language.

I find that students often need such helpers when deciphering many
digits.

Let's not forget all of these spaces commands are used in math mode.
Sure, and thet adaot to math mode. They will nto dissppear, it's just
that in macros I like more verbose names.

Hans

Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)

Computer Architecture & Computer Engineering
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)

443-654-7878
ke...@lps.umd.edu

Visiting Research Professor
United States Naval Academy

r...@usna.edu
--

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