[NTG-context] Re: [ constructing poly lines in metafun using lua ]

2025-08-10 Thread Hans Hagen via ntg-context
ectly in MP but easily run out of memory tokens when the drawing is complex enough. is there a way to define a function to draw a particular line passing its coords and pen and color? do_line(path, pen, color) where path is a list of x,y points? 8<--- \usecolors[crayola] \startMPpag

[NTG-context] [ constructing poly lines in metafun using lua ]

2025-08-09 Thread vm via ntg-context
when the drawing is complex enough. is there a way to define a function to draw a particular line passing its coords and pen and color? do_line(path, pen, color) where path is a list of x,y points? 8<--- \usecolors[crayola] \startMPpage[offset=5mm] path p; pen q[]; q[1] := pencircle

[NTG-context] How to pass \MPcolor{aColour} to a lua function

2025-07-25 Thread Keith McKay
nepalet[MyColors][1=SkyBlue,2=Orange,3=PigPink,4=BananaMania,5=BrilliantRose] \setuppalet[MyColors] \starttext \startMPpage%[Page 7] numeric p; p := 4; lua.MP.MakeByteMap(p); fill unitsquare xyscaled (999,999) withbytemap p; \stopMPpage \stoptext ___

[NTG-context] Re: Can Bytemaps be overwritten?

2025-06-16 Thread Hans Hagen
t i guess: \startMPpage %page 1 color newColor; newbytemap 1 of (250,250,3); numeric p ; p := 0; numeric i ; i := 1; for x := 0 upto 249: for y := 0 upto 249: if i = 1: newColor := \MPcolor{red}; i := 2; elseif i = 2: newColor := \MPcolor{blue};

[NTG-context] Can Bytemaps be overwritten?

2025-06-15 Thread Keith McKay
green. To get what I expected I rewrote the code as in MPpage page 2, but to get the desired outcome I had to create 3 bytemaps. So, does this mean that bytemaps can't be overwritten, or am I missing something? Best Wishes Keith \starttext \startMPpage %page 1 color newColor; newby

[NTG-context] Re: bytemap problem

2025-05-11 Thread Keith McKay
the large bytemap. > > I've made a MWE below > > > > %% > > \startMPpage > > i := 1; > > for x = 1 upto 5: > > for y := 1 upto 5: > > newbytemap i of (250,250,3); > > setbytemap i to (floor(uniformdeviate(255) + > > 1),f

[NTG-context] Re: bytemap problem

2025-05-11 Thread Hans Hagen
emaps with the data from the large bytemap. I've made a MWE below %%  \startMPpage i := 1; for x = 1 upto 5:  for y := 1 upto 5:     newbytemap i of (250,250,3);     setbytemap i to (floor(uniformdeviate(255) + 1),floor(uniformdeviate(255)

[NTG-context] bytemap problem

2025-05-11 Thread Keith McKay
temap. I've made a MWE below %%%%%%  \startMPpage i := 1; for x = 1 upto 5:  for y := 1 upto 5:     newbytemap i of (250,250,3);     setbytemap i to (floor(uniformdeviate(255) + 1),floor(uniformdeviate(255) + 1),floor(uniformdeviate(255) + 1));     fill    

[NTG-context] Re: Rotating and scaling images to fit a page

2025-04-24 Thread Fabrice L
s width and height to discern whether it's wide, > tall, or square. This works, but I feel I'm reinventing the wheel. Is there a > more straightforward way to implement this? Any suggestions would be much > appreciated. Here is a suggestion : \starttext \startMPpage

[NTG-context] Re: outlinetext, fractions, and square roots

2025-02-20 Thread Florent Michel
ith outlinetext, I found it generally works well for > > both text and equations but seems to fail for fractions or square roots. > > The code below demonstrates the issue: > > ____ > > \startMPpage > > draw outline

[NTG-context] Re: outlinetext, fractions, and square roots

2025-02-20 Thread Hans Hagen
On 2/19/2025 10:23 PM, Florent Michel wrote: Hi, When experimenting with outlinetext, I found it generally works well for both text and equations but seems to fail for fractions or square roots. The code below demonstrates the issue: \startMPpage draw outlinetext

[NTG-context] outlinetext, fractions, and square roots

2025-02-19 Thread Florent Michel
Hi, When experimenting with outlinetext, I found it generally works well for both text and equations but seems to fail for fractions or square roots. The code below demonstrates the issue: \startMPpage draw outlinetext("$\frac{1}{\sqrt{2}}$"); \

[NTG-context] Re: [ drawing lines with metafun ]

2025-02-12 Thread Hans Hagen
? it probably is possible, yet how? Any hints? AFAIK it’s not possible to change the pen during the path. At least that was true a few years ago. Here's the logo of the CMS: \startMPpage path p ; p := fullcircle xyscaled (100,70) ; path s ; s := nepstroke (1000) (.25 + uniformdevi

[NTG-context] Re: Functional shading with MetaPost / MetaFun

2025-01-09 Thread Florent Michel
> data cs=polar, > > ] > > coordinates { > > (90,4) [color=red] > > (210,4) [color=green] > > (-30,4) [color=blue] > > }; > > \stopaxis > > \stoptikzpicture > > \stopTEXpage > > \stoptext &g

[NTG-context] Re: Functional shading with MetaPost / MetaFun

2025-01-09 Thread Hans Hagen
draw a sequence of triangles, each with a linear gradient: \startMPpage   def LinearIntTriangle(expr pa, pb, pc, cola, colb, colc, n_iter) =     for i = n_iter step -1 until 1 :       path p;       x := i / n_iter;       y := (i

[NTG-context] Fwd: Touch my cow: Overlaying a picture with links to text

2025-01-09 Thread Hans Hagen
awarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep) withpen pencircle scaled .5mm withcolor mycolor; enddef ; % touchtolink def touchtolink (expr a, b) (text t) = label ("\framed[background=color,backgroundcolor=transparentwhite,align=normal,corner=00,frame=no]{" & t &a

[NTG-context] Functional shading with MetaPost / MetaFun

2025-01-09 Thread Florent Michel
: \startMPpage def LinearIntTriangle(expr pa, pb, pc, cola, colb, colc, n_iter) = for i = n_iter step -1 until 1 : path p; x := i / n_iter; y := (i - 0.5) / n_iter; p := pa -- (pa + x * (pb - pa)) -- (pa + x * (pc - pa

[NTG-context] Touch my cow: Overlaying a picture with links to text

2025-01-09 Thread Axel Kielhorn
ink def touchtolink (expr a, b) (text t) = label ("\framed[background=color,backgroundcolor=transparentwhite,align=normal,corner=00,frame=no]{" & t &"}", (a * xstep, b * ystep)); enddef ; \stopMPinclusions \startMPpage % Picture draw e

[NTG-context] Re: Clip an image with a svg

2025-01-03 Thread Wolfgang Schuster
image shows only the bottom left corner (the part where the red circle and yellow square overlap). To get the center of the picture you can either ship fullcircle by .5 in the x and y direction or use unitcircle. begin example \startMPpage[offset=1cm] fill unitsquare scaled 5cm withcolor

[NTG-context] Re: [ scaling colors ]

2025-01-01 Thread vm via ntg-context
On 01/01/2025 22:25, Hans Hagen wrote: define more colors anyway, you can try to comment line 1543 in mlib-pps.lmt and then, after making a new format file, see if \startMPpage     definecolor [ name = "MyColor", r = .5, g = .25, b = .25 ] ;     fill fullsquare xyscaled (

[NTG-context] Re: [ scaling colors ]

2025-01-01 Thread Hans Hagen
and then, after making a new format file, see if \startMPpage definecolor [ name = "MyColor", r = .5, g = .25, b = .25 ] ; fill fullsquare xyscaled (40mm, 15mm) withcolor "MyColor" ; fill fullsquare xyscaled (40mm, 15mm) shifted (42mm, 0mm) withcolor .5 * namedcol

[NTG-context] Re: Rounded pens with Metapost

2024-12-07 Thread Mikael Sundqvist
make variants of it). Example: \startMPpage[offset=1dk] fill function(2,"x","sin(x)",0,epsed(6*pi),0.1) scaled 20 penstroked function(2,"x","1+7*(sin(x)^2)",0,epsed(pi),0.001) withcolor "orange" ; \stopMPpage /Mikael On Fri, Dec 6

[NTG-context] Re: Rounded pens with Metapost

2024-12-07 Thread Keith McKay
shifted (12,12)withcolor red; draw ((0,0)-- (1,0))scaled 10 withpen TcirclePen rotated 180 shifted (12,12)withcolor red; On 06/12/2024 19:16, Wolfgang Schuster wrote: Hi, are there now better ways to create rounded pens without adding many support points? \starttext \startMPpage[offset=1dk

[NTG-context] Rounded pens with Metapost

2024-12-06 Thread Wolfgang Schuster
Hi, are there now better ways to create rounded pens without adding many support points? \starttext \startMPpage[offset=1dk] path Halfcircle ; Halfcircle = (1,0){up} for i = 1 upto 180 : .. ((1,0) rotated i) endfor -- cycle ; draw Halfcircle scaled 10 shifted (0,12) ; pen HalfcirclePen

[NTG-context] Re: Hiding a part of a path

2024-12-02 Thread Gavin via ntg-context
ides part of the path. Mikael’s solution is neat because he doesn’t just hide part of the path, he makes a new path with that part completely removed. If you name that path, you can do whatever you want with it — draw it, scale it, put it in an image() command, etc. \startMPpage[offset=1DK]

[NTG-context] Re: Hiding a part of a path

2024-12-02 Thread Jeong Dal via ntg-context
-(2u,0)--(3u,u)--(3u,0)--(4u,0); >> q := (3u,u)--(3u,0); >> pic := image(draw p; draw q withcolor white;); >> >> draw pic; >> \stopMPcode > > It is not clear how general you want this to be. For your example you > can draw only the parts of p you need. >

[NTG-context] Re: Hiding a part of a path

2024-12-02 Thread Mikael Sundqvist
; \stopMPcode It is not clear how general you want this to be. For your example you can draw only the parts of p you need. \startMPpage[offset=1DK] path p,q; picture pic; numeric u; u:= 1cm; p := origin--(2u,0)--(3u,u)--(3u,0)--(4u,0); q := (3u,u)--(3u,0); % pic := image(draw p; draw q withc

[NTG-context] Re: Metapost lines with fancy line endings and connections

2024-12-01 Thread Wolfgang Schuster
riation or passing the shape as argument). BTW: Use && to connect the parts of the line to avoid graphical errors in your pdf viewer. \startMPpage[offset=1pt] pickup pensquare scaled 1 ; draw (0,0) ; draw (1,0) ; draw (0,2) && (1,2

[NTG-context] Re: On the use of btx datasets to manage images and plots

2024-11-25 Thread Hans Hagen
essed automatically when it changes). 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 -----\startMP

[NTG-context] Metafun : reuse a static picture

2024-11-24 Thread Fabrice L
ber := uniformdeviate(1); draw textext(decimal(arandomnumber)) scaled 0.5; ); \stopMPinclusions \startMPpage draw AnImage ; draw AnotherImage ; \stopMPpage \startMPpage draw AnImage ; draw AnotherImage ; \stopMPpage \stoptext

[NTG-context] Re: Envelopes and shaded paths

2024-09-22 Thread Keith McKay
uming there is no other misunderstanding from me) is: \startMPpage pair A,B; path p, psubPath, asPathEnvelope; A = (0cm,0cm);B = (5cm,0cm); p = A{dir 60} .. B; fill fullsquare scaled 12cm withcolor 0.5[blue,white]; for i = 0 step 5 until 355:   psubPath := (subpath((0.1 * length p), (1 * length p) )

[NTG-context] Re: Envelopes and shaded paths

2024-09-21 Thread Florent Michel
Apologies for the double email. Seems I slightly misunderstood what you aimed for - the corrected (assuming there is no other misunderstanding from me) is: \startMPpage pair A,B; path p, psubPath, asPathEnvelope; A = (0cm,0cm);B = (5cm,0cm); p = A{dir 60} .. B; fill fullsquare scaled 12cm

[NTG-context] Re: Envelopes and shaded paths

2024-09-21 Thread Florent Michel
Hi, It's probably not the best solution as it uses the ‘old’ shading method, but seems to give the result you were expecting: \startMPpage pair A,B; path p, psubPath, asPathEnvelope; A = (0cm,0cm);B = (5cm,0cm); p = A{dir 60} .. B; fill fullsquare scaled 12cm withcolor 0.5[blue,white]; for

[NTG-context] Envelopes and shaded paths

2024-09-21 Thread Keith McKay
spiral. Here is the code: \startMPpage pair A,B; path p, psubPath, asPathEnvelope; A = (0cm,0cm);B = (5cm,0cm); p = A{dir 60}.. B; fill fullsquare scaled 12cm withcolor 0.5[blue,white]; for i = 0 step 5 until 355: psubPath := (subpath((0.1 * length p), (1 * length p))of p)rotated i

[NTG-context] Re: Is there a way to apply withpattern to text, like fillcolor in lmt_outline[].

2024-08-28 Thread Hans Hagen via ntg-context
\starttext \startMPpage path tt ; tt := lmt_outline [ kind = "outline", text = "\definedfont[name:texgyrepagellabold*default]foo f o o", ] xsized 12cm ; % fill tt % withshademethod "linear" % withshadedirection down % wit

[NTG-context] Re: Problem with Cambria

2024-08-16 Thread Lutz Haseloff
ia. >> >> My file is: >> >> \setupbodyfont[cambria] >> \definefont[symbola][file:symbola*default at 10pt] >> \starttext >> \startMPpage[offset=1dk] >> draw textext("AC{\symbola ⚡}DC"); >> \stopMPpage >> \stoptext > >Which result (YE

[NTG-context] Re: Problem with Cambria

2024-08-16 Thread Wolfgang Schuster
Lutz Haseloff schrieb am 16.08.2024 um 09:47: Hi Hans, hi all, the latest ConTeXt lmtx seems to have a problem with MS Cambria. My file is: \setupbodyfont[cambria] \definefont[symbola][file:symbola*default at 10pt] \starttext \startMPpage[offset=1dk] draw textext("AC{\symbola

[NTG-context] Problem with Cambria

2024-08-16 Thread Lutz Haseloff
Hi Hans, hi all, the latest ConTeXt lmtx seems to have a problem with MS Cambria. My file is: \setupbodyfont[cambria] \definefont[symbola][file:symbola*default at 10pt] \starttext \startMPpage[offset=1dk] draw textext("AC{\symbola ⚡}DC"); \stopMPpage \stoptext mtxrun find

[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Mikael Sundqvist
0.3 local ymin = 0.4 local function f(x,y) local x = xstep*x - xmin local y = ystep*y - ymin local z = x + exp(-60*x) - y if z > 0 then return '1' else return '0' end end potrace.setbitmap("mybitmap", potrace.contourp

[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Fabrice Couvreur
erstand. > > Thanks > > Fabrice > > > > \startMPpage[offset=1DK] > > > >numeric u; > >u = 6cm; > > > >interim linejoin := mitered; > >interim ahangle := 30; > > > >path xx,

[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Hans Hagen
On 5/12/2024 3:57 PM, Fabrice Couvreur wrote: Hi, When I want to draw the curve which corresponds to n=60 (blue curve), it doesn't seem possible: I don't understand. Thanks Fabrice  \startMPpage[offset=1DK]           numeric u;           u = 6cm;           interim linejoin

[NTG-context] Metapost limitation ?

2024-05-12 Thread Fabrice Couvreur
Hi, When I want to draw the curve which corresponds to n=60 (blue curve), it doesn't seem possible: I don't understand. Thanks Fabrice \startMPpage[offset=1DK] numeric u; u = 6cm; interim linejoin := mitered; interim ahangle := 30; p

[NTG-context] Re: outlinetext broken?

2024-05-11 Thread Hans Hagen
od.nl - outlines-003.pdf Description: Adobe PDF document \continuewhenlmtxmode \starttext \startMPpage[offset=10pt] draw lmt_outline [ text = "\mathematics{\sqrt{2}-1}" ] ; draw lmt_outline [ text = "\mathe

[NTG-context] Re: outlinetext broken?

2024-05-11 Thread Jairo A. del Rio
As for the current ConTeXt, the example above still produces the wrong output. Can anyone reproduce this case? Thank you in advance. Jairo El sáb, 4 may 2024 a la(s) 7:23 p.m., Jairo A. del Rio ( jairoadelr...@gmail.com) escribió: > Hi, list > > \startMPpage > draw outlinetext.d(&

[NTG-context] outlinetext broken?

2024-05-04 Thread Jairo A. del Rio
Hi, list \startMPpage draw outlinetext.d("\mathematics{\sqrt{2}-1}")(withcolor black withpen currentpen) scaled 1; \stopMPpage fails (radicals are not drawn at all). As for context --version, mtx-context | ConTeXt Process Management 1.06 mtx-context | mtx-context | ma

[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Fabrice Couvreur
isible in the >> component chapter-14 : >> >> It is probably not related to the figure itself. Something may be >> different in this component compared to the other ones. I cannot really >> say, of course. Still, using external image instead of inline metapost may >> b

[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Fabrice Couvreur
ly not related to the figure itself. Something may be > different in this component compared to the other ones. I cannot really > say, of course. Still, using external image instead of inline metapost may > be fix it. Not elegant, but if it works it works! > > Good luck, > Taco > >

[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Taco Hoekwater
e itself. Something may be different in this component compared to the other ones. I cannot really say, of course. Still, using external image instead of inline metapost may be fix it. Not elegant, but if it works it works! Good luck, Taco > > \startcomponent[chapter-14] > \startMPpage &

[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Hans Hagen
On 4/25/2024 4:08 PM, Fabrice Couvreur wrote: Hi Taco, I knew I wouldn't be able to explain what was happening. The code works perfectly and the figure is clearly visible in the component chapter-14 : \startcomponent[chapter-14] \startMPpage ... \stopMPpage \stopcomponent But if I compi

[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Fabrice Couvreur
Hi Taco, I knew I wouldn't be able to explain what was happening. The code works perfectly and the figure is clearly visible in the component chapter-14 : \startcomponent[chapter-14] \startMPpage ... \stopMPpage \stopcomponent But if I compile my project, it disappears !! \startpr

[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Taco Hoekwater
H Fabrice, You did not provide a good minimum test because the graph by itself renders fine: fabr.pdf Description: Adobe PDF document Best wishes, Taco (if all else fails, you can replace \startMPcode with \startMPpage and generate a standalone graph that way) > On 25 Apr 2024, at 12

[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-09 Thread Hans Hagen
all.nl>> wrote: On 4/8/2024 8:22 AM, seyal zavira wrote: > thank you Harban and Keith McKay. > >     \startMPpage >            picture tt ; tt := lmt_outline [ >                kind = "path", >                text =

[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-09 Thread seyal zavira
ed the codes and pdf results. On Mon, Apr 8, 2024 at 4:37 AM Hans Hagen wrote: > On 4/8/2024 8:22 AM, seyal zavira wrote: > > thank you Harban and Keith McKay. > > > > \startMPpage > >picture tt ; tt := lmt_outline [ > >k

[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-08 Thread Hans Hagen
On 4/8/2024 8:22 AM, seyal zavira wrote: thank you Harban and Keith McKay. \startMPpage       picture tt ; tt := lmt_outline [           kind = "path",           text = "\definedfont[name:texgyrepagellabold*default]foo f o o",      

[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-07 Thread seyal zavira
thank you Harban and Keith McKay. \startMPpage > picture tt ; tt := lmt_outline [ > kind = "path", > text = "\definedfont[name:texgyrepagellabold*default]foo f o o", > ] ; > > fill > for

[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-07 Thread Hans Hagen
On 4/7/2024 7:42 PM, Henning Hraban Ramm wrote: Am 07.04.24 um 19:05 schrieb Hans Hagen: \startMPpage picture tt ; tt := lmt_outline [ kind = "fillup", text = "\definedfont[name:texgyrepagellabold*default]foo f o o", ] xsized 12cm ; path bb

[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-07 Thread Keith McKay
Hagen: \startMPpage picture tt ; tt := lmt_outline [ kind = "fillup", text = "\definedfont[name:texgyrepagellabold*default]foo f o o", ] xsized 12cm ; path bb ; bb := boundingbox tt ; path pp ; pp := bb enlarged 2cm ; fill pp    

[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-07 Thread Henning Hraban Ramm
Am 07.04.24 um 19:05 schrieb Hans Hagen: \startMPpage     picture tt ; tt := lmt_outline [     kind = "fillup",     text = "\definedfont[name:texgyrepagellabold*default]foo f o o",     ] xsized 12cm ;     path bb ; bb := boundingbox tt ;     path pp ; p

[NTG-context] Fwd: Re: how to apply gradient color to a piece of text?

2024-04-07 Thread Hans Hagen
look back in my files. \startMPpage picture tt ; tt := lmt_outline [ kind = "fillup", text = "\definedfont[name:texgyrepagellabold*default]foo f o o", ] xsized 12cm ; path bb ; bb := boundingbox tt ; path pp ; pp := bb enlarged 2cm ; fill p

[NTG-context] Re: how to apply gradient color to a piece of text?

2024-04-07 Thread Keith McKay
mples that can apply gradient colors to metapost paths. how i can apply this cool feature to a piece of text? i tried the code below but it does not produce any result. \definecolor[Gleft] [h=9f9393] \definecolor[Gright] [h=ff1aa4] \startMPpage picture Mytext; Mytext := btex hello etex; draw

[NTG-context] how to apply gradient color to a piece of text?

2024-04-07 Thread seyal . zavira
=ff1aa4] \startMPpage picture Mytext; Mytext := btex hello etex; draw lmt_shade [ picture="Mytext", direction = "right", domain= { 0, 2 }, colors= { "headerGleft", "headerGright" }, ] ; \stopMPpage

[NTG-context] Re: how to include an an svg file?

2024-03-16 Thread Jean-Pierre Delange
Dear CTX wizards, The commands given by Hans don't work properly in my case (with CTX on Windows 11). I am probably ignorant of how to implement \startMPpage. I'm not a "MetaPost lover", but I'd like to understand something; especially as I know how to make simple fr

[NTG-context] Re: how to include an an svg file?

2024-03-15 Thread seyal zavira
ut format one has to specify every character with > possible abuse of a substitution feature that accesses it. So that is no > longer a real interesting option, unless of course one exports all text > as curves, just to be sure. > > (I will extend general text suport but it will alw

[NTG-context] Re: how to include an an svg file?

2024-03-15 Thread Hans Hagen via ntg-context
t to do some cleanup, ps. For metapost lovers, here is some of the trickery used: \startMPpage[offset=1ts] draw image ( fill (unitsquare xscaled 10cm yscaled 4cm) withcolor svgcolor(0.5,0,0) ; registerluminositygroup ("test") ( fill (

[NTG-context] Re: lmt_shade fails

2024-02-19 Thread Keith McKay
ycle'. So I'll not change* > *anything just now.* > The MWE I used is as follows: > \starttext > \startMPpage > definecolor [ name = "MyColor3", r = uniformdeviate(1), g = > uniformdeviate(1), b = uniformdeviate(1) ] ; > definecolor [ name = "MyColor4",

[NTG-context] Re: lmt_shade fails

2024-02-19 Thread Fabrice L
then: > > metafun > log > That contour should have ended with '.. cycle' or '& > cycle'. So I'll not change > anything just now. > > The MWE I used is as follows: > > \starttext > \startMPpage > definecolor [ name = "MyC

[NTG-context] lmt_shade fails

2024-02-18 Thread Keith McKay
So I'll not change/ /anything just now./ // The MWE I used is as follows: \starttext \startMPpage definecolor [ name = "MyColor3", r = uniformdeviate(1), g = uniformdeviate(1), b = uniformdeviate(1) ] ; definecolor [ name = "MyColor4", r = uniformdeviate(1), g = unifor

[NTG-context] Re: Problem with wiki example

2024-02-17 Thread Shiv Shankar Dayal
Never mind it was my idiocy. On Sun, Feb 18, 2024 at 3:29 AM Shiv Shankar Dayal < shivshankar.da...@gmail.com> wrote: > I found following on Wiki to produce PDF out of standalone type( > https://wiki.contextgarden.net/Sharing_graphics): > > \starttext > \startMPpage >

[NTG-context] Problem with wiki example

2024-02-17 Thread Shiv Shankar Dayal
I found following on Wiki to produce PDF out of standalone type( https://wiki.contextgarden.net/Sharing_graphics): \starttext \startMPpage draw fullcircle scaled 10cm ; \stopMPPage \stoptext It generates a PDF but when I open it with Evince, Evince complains that no page was found and does

[NTG-context] Re: Metapost docs

2024-01-11 Thread Shiv Shankar Dayal
specific > documentation on things like chemical structures is a little hit-or-miss, > but often quite useful. > -The mailing list. I have the most luck with very specific questions that > include a minimal working example. It should include the appropriate > \starttext…\stoptext or \star

[NTG-context] Re: Metapost docs

2024-01-11 Thread Gavin via ntg-context
…\stoptext or \startMPpage…\stopMPpage, so that it can be typeset as-is. If you want to do 3D, you may want to get Lua involved for calculations. I use - Programming in LuaTeX page on the wiki (https://wiki.contextgarden.net/Programming_in_LuaTeX) - Programming in Lua, 4th ed. by Roberto Ierusalimschy

[NTG-context] Lua and inject.path to make a disconnected MetaPost path?

2024-01-08 Thread Gavin via ntg-context
] = {{0,0}, {-1,-1}, {-1,0}, cycle = true } continents[2] = {{0,1}, {1,0}, {1,-1}, cycle = true } function mp.getglobepath(continentnum) mp.inject.path(continents[continentnum]) end \stopluacode \startMPpage path p[], q ; p1 = (lua.mp.getglobepath(1) scaled 1cm) ; p2

[NTG-context] Re: multipage metapost output from ConTeXt

2024-01-06 Thread Emanuel Han via ntg-context
h TheFrame ; TheFrame := fullsquare scaled 5in ; z1 = (60,40); z2 = (40,90); z3 = (10,70); p1:=image( label("Word 1", z1); ); p2:=image( label("Mot 2", z2); ); p3:=image( label("Parola 3", z3); ); \stopuseMPgraphic \starttext \dorecurse{3}{ % Frame \startMPpage

[NTG-context] Re: MetaFun path joiners && and &&&& do not like single point paths

2023-12-31 Thread Hans Hagen via ntg-context
On 12/31/2023 8:06 AM, Mikael Sundqvist wrote: \startMPpage path p[], q ; p1 = fullcircle scaled 3cm ; p2 = fullcircle scaled 2cm shifted (3cm,0) ; p3 = (3cm,2cm) ; p4 = fullcircle ; q = p[1] for i = 2 upto 3: if (length(p[i]) == 0): &&& else: && fi p[i] endfor && cy

[NTG-context] Re: MetaFun path joiners && and &&&& do not like single point paths

2023-12-30 Thread Mikael Sundqvist
a > very specific orientation of the globe. I guessed that this orientation had > an island right on the horizon, so that only one boundary point was visible, > creating a singe point path for that island. I should probably fix my module > so it doesn’t do that. However, it might be ni

[NTG-context] MetaFun path joiners && and &&&& do not like single point paths

2023-12-30 Thread Gavin via ntg-context
at only one boundary point was visible, creating a singe point path for that island. I should probably fix my module so it doesn’t do that. However, it might be nice to have && and &&&& deal with this situation gracefully. Gavin \startMPpage path p[], q ; p1 = fullci

[NTG-context] Re: Seeking advice for module that draws globes

2023-12-17 Thread Hans Hagen via ntg-context
)) &&&& endfor cycle enddef ; and then: \startMPpage GlobeDiameter = 10cm ; fill fullcircle scaled GlobeDiameter withcolor .9white ; path p ; p := theglobe(23, 0) scaled .5GlobeDiameter ; draw p withpen pencircle scaled .2mm

[NTG-context] Re: Seeking advice for module that draws globes

2023-12-17 Thread Hans Hagen via ntg-context
On 12/17/2023 11:22 PM, Gavin via ntg-context wrote: 1. How do I avoid redrawing diagrams with every typeset? The globe above takes about 0.7s, which is not bad, but it adds up in a book with many diagrams. \startbuffer[demo] \usemodule [luageo] \startMPpage GlobeDiameter = 10cm

[NTG-context] Seeking advice for module that draws globes

2023-12-17 Thread Gavin via ntg-context
, which draws the globe. Below is an example document with the output. (I attached a small .png of the output for the mailing list. The output PDF has excessive detail.) The module (code and data) is on GitHub at https://github.com/GavinPolhemus/luageo. \usemodule [luageo] \startMPpage

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-04 Thread Fabrice L
= (10,70); > > p1:=image( > label(textext("Word 1"), z1); > ); > > p2:=image( > label(textext("Mot 2"), z2); > ); > > p3:=image( > label(textext("Parola 3"), z3); > ); > > \stopMPinclusions > > \starttext >

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
Thank you Mikael, this works! Emanuel On Dez. 2 2023, at 7:46 pm, Mikael Sundqvist wrote: > Hi, > > I don't know if \startMPinclusions \stopMPinclusions shall work with > \startMPpage and \stopMPpage. In this case, one can use a separate > graphics: > > \startuseM

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Mikael Sundqvist
Hi, I don't know if \startMPinclusions \stopMPinclusions shall work with \startMPpage and \stopMPpage. In this case, one can use a separate graphics: \startuseMPgraphic{base} picture p[]; path TheFrame ; TheFrame := fullsquare scaled 5in ; z1 = (60,40); z2 = (40,90); z3 = (10,70); p1:=

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
lusions picture p[]; path TheFrame ; TheFrame := fullsquare scaled 5in ; z1 = (60,40); z2 = (40,90); z3 = (10,70); p1:=image( label(textext("Word 1"), z1); ); p2:=image( label(textext("Mot 2"), z2); ); p3:=image( label(textext("Parola 3"), z3); ); \stopMPin

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Mikael Sundqvist
..z1..z2..z3..z4 ; >> pair AStartPoint; AStartPoint = point 0 of A; >> pair AEndPoint; AEndPoint = point 4 of A; >> path B; B = z5..z6; >> pair BStartPoint; BStartPoint = point 0 of B; >> pair BEndPoint; BEndPoint = point 1 of B; >> path C; C = AStartPoint..AEndPoin

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread fv leung
; draw A withcolor red; > ); > > p2:=image(draw A; label(lmt_outline [ > text = "\JapaneseFont 日本語" > ], AEndPoint);); > > p3:=image( > label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, > BStartPoint); > ); > > p4:=ima

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
t 日本語" > ], AEndPoint);); > > p3:=image( > label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, BStartPoint); > ); > > p4:=image(draw A; label(lmt_outline [ > text = "\KoreanFont 한국어" > ], AStartPoint);); > > p5:=image( > label

[NTG-context] Re: multipage metapost output from ConTeXt

2023-11-29 Thread Emanuel Han via ntg-context
ot;) scaled 1.2, BStartPoint); ); p4:=image(draw A; label(lmt_outline [ text = "\KoreanFont 한국어" ], AStartPoint);); p5:=image( label(textext("bāng"), BEndPoint); draw C withcolor green; ); p6:=image( draw B withcolor blue; ); \stopMPinclusions \starttext \dorecurse{6}{ %

[NTG-context] Re: multipage metapost output from ConTeXt

2023-11-27 Thread Aditya Mahajan
On Mon, 27 Nov 2023, Fabrice L wrote: > Hi, > > It is fun fact very easy to do. You just use \startMPpage (…) \stopMPpage > multiple times. Here is an example which build an animation of a particle > moving according to a Brownian motion. A very similar option is to pass

[NTG-context] Re: multipage metapost output from ConTeXt

2023-11-27 Thread Fabrice L
Hi, It is fun fact very easy to do. You just use \startMPpage (…) \stopMPpage multiple times. Here is an example which build an animation of a particle moving according to a Brownian motion. Fabrice. % 8< --- \usecolors[crayola] \setupMPinsta

[NTG-context] Re: Wiki problem - labels missing from the main diagram on the Page Layout page

2023-11-08 Thread Henning Hraban Ramm
. Fixed. Any suggestions as to what needs to be changed to get the diagram to display correctly? I saved it again and now it seems to work. Thank you! BTW, for my book I made a new one in MetaPost, see attachment. \startMPpage input layout.mp; draw Layout; \stopMPpage Hraban % Diagram of layout

[NTG-context] Re: [ metapost -> svg ]

2023-11-07 Thread Lutz Haseloff
Hi Floris, directly generating SVG with ConTeXt LMTX is not possible. But, using LMTX to generate SVGs has some advantages over MPOST. You can use ConTeXt's advanced color management (transparency and more) and you can use the very nice font management. So my "metapost" file is

[NTG-context] MP: problems with dashed lines

2023-10-22 Thread Henning Hraban Ramm
Hi, I wanted to use dashed lines as folding marks, but apparently they only work with pencircle, or at least not with pensquare. The Metafun manual (Reference, C5) also shows a problem with "dashed oddly", that I can’t reproduce in this MWE: \startMPpage draw (0,0)--(100,10

[NTG-context] Re: [ export to svg ]

2023-08-19 Thread Hans Hagen via ntg-context
On 8/19/2023 1:12 PM, vm via ntg-context wrote: Is there a (simple) way to export the results of a \startMPpage ... \stopMPpage directly to a svg file? My current route is to import the pdf into inkscape, group path objects by stroke color, then save the result as svg and translate that into a

[NTG-context] [ export to svg ]

2023-08-19 Thread vm via ntg-context
Is there a (simple) way to export the results of a \startMPpage ... \stopMPpage directly to a svg file? My current route is to import the pdf into inkscape, group path objects by stroke color, then save the result as svg and translate that into a hpgl format for the pen plotter. I guess/hope

[NTG-context] Re: text width shadow background

2023-07-09 Thread Keith McKay
Well this is fun.  Getting the right patterns could make some interesting with fonts. Thanks for the tip Hans! Best Wishes Keith McKay % \startMPpage vardef tst (expr x, y, i, n) = definecolor [ name = "MyColor1", r = uniformdeviate(1), g = uniformdeviate(1), b = unif

[NTG-context] Re: text width shadow background

2023-07-09 Thread Hans Hagen via ntg-context
laced the text by \TeX and published it here: https://fosstodon.org/@context/110684919994406565 But is it possible to fill a path (e.g. an lmt_outline) with a lmt_poisson pattern? Here's something to get you and Keith starting: \startMPpage picture p ; p := lmt_outline [ text =

[NTG-context] SVG converter bugs

2023-07-06 Thread Max Chernoff
http://www.w3.org/2000/svg";> \stopbuffer \starttext \startTEXpage \includesvgbuffer[gradient] \stopTEXpage \startMPpage fill unitsquare xyscaled (200,100) withshademethod "linear&qu

Re: [NTG-context] Feynman Diagrams

2023-04-12 Thread Aditya Mahajan via ntg-context
vconnect ("photon", __v1, __v2); vfreeze; vdraw; endsubgraph; endchar; % the end. end. endinput; So, I created a context file: \startMPinclusions input feynmp; require_RCS_revision "1.30"; \stopMPinclusions \starttext \sta

Re: [NTG-context] Meta(post)/(fun) macro with label position

2023-01-19 Thread Jeong Dal via ntg-context
Dear Alex, I don’t know what you want exactly. I hope that it may help. \startMPpage def myLabel(expr xpos, ypos)(text t) = dotlabel.top(textext(t),(xpos,ypos)); enddef; myLabel(1cm, 1cm, "Position"); \stoppage Good luck. Be

Re: [NTG-context] atan2 function

2022-10-14 Thread Hans Hagen via ntg-context
ult in radians. This demo: \startMPpage vardef atantwo( expr dy, dx ) = save theta; numeric theta; theta := 0; if (dx > 0): theta := atan( dy / dx ); elseif (dx < 0) and (dy >= 0):

  1   2   3   4   5   6   7   8   9   >