Re: [NTG-context] Wrong MetaPost text output
On Sun, 11 Aug 2019 11:12:55 -0700 Henri Menke wrote: > Thank you for the quick repsonse. This looks good to me. However, > could you tell me a way to get the correct baseline with textext? When > I use > > \startMPpage > draw btex dummy etex shifted (0,0); > draw btex foo etex shifted (1.5cm,0); > \stopMPpage > > the baseline is the one that I would expect from TeX, i.e. at the depth > of the “y” is removed or otherwise correctly accounted for. In contrast > when I use > > \startMPpage > draw textext("dummy") shifted (0,0); > draw textext("foo") shifted (1.5cm,0); > \stopMPpage > > the baseline will be below the depth of the “y” which is sometimes > unwanted. textext() is actually textext@#() so you can use textext.top() for example to put the *bottom* of the text bounding box at y=0. Without any @# suffix, the text bounding box gets centered at y=0. Metafun has a few *new* suffixes defined, so you can use textext.d(), textext.dlft(), textext.drt(), I BELIEVE, to position with respect to the tex baseline. (you need to check this). Alan ___ 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] Convert SVG to MetaPost
Hi, > On 12 Aug 2019, at 12:10, Jon Wong wrote: > > Hi all, > > Is it possible to convert SVG to MetaPost? > > Currently, I have Bash scripts in my workflow to invoke Inkscape (converting > SVG to PDF). I don’t like to allow shell access to TeX. > > If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files > instead of SVG files. That will do away with having to convert SVG into PDF > (via Inkscape). SVG (and Inkscape) can do many graphical things that metapost can not do, so I think that would be a bad idea even if there was a tool that could do the conversion for some subset of SVG. That said, SVG is just an XML format, so it should be possible to process simple SVG using ConTeXt’s built-in xml parser (with suitable processing environments, of course). How much work that would entail and whether it is feasible depends on the actual SVG graphics. Best wishes, Taco ___ 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] Convert SVG to MetaPost
On Mon, Aug 12, 2019 at 12:11 PM Jon Wong wrote: > Hi all, > > Is it possible to convert SVG to MetaPost? > > Currently, I have Bash scripts in my workflow to invoke Inkscape > (converting SVG to PDF). I don’t like to allow shell access to TeX. > > If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files > instead of SVG files. That will do away with having to convert SVG into PDF > (via Inkscape). > > you can check pstoedit http://www.calvina.de/pstoedit/pstoedit.htm it can convert postscript to metapost. So svg->pdf->ps->mp seems to be possible. Of course, I am not sure if it fits in your workflow. -- luigi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Convert SVG to MetaPost
Hi Taco! Very enlightening! I’ll just use both MetaPost and SVG for their intended purposes. (SVG will come from workflow involving GIMP/Inkscape; MetaPost for logical, rather than graphical, figures.) Regards Jon > On Aug 12, 2019, at 7:30 PM, luigi scarso wrote: > > > > On Mon, Aug 12, 2019 at 12:11 PM Jon Wong <mailto:jhannw...@gmail.com>> wrote: > Hi all, > > Is it possible to convert SVG to MetaPost? > > Currently, I have Bash scripts in my workflow to invoke Inkscape (converting > SVG to PDF). I don’t like to allow shell access to TeX. > > If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files > instead of SVG files. That will do away with having to convert SVG into PDF > (via Inkscape). > > > you can check pstoedit > http://www.calvina.de/pstoedit/pstoedit.htm > <http://www.calvina.de/pstoedit/pstoedit.htm> > > it can convert postscript to metapost. > So svg->pdf->ps->mp seems to be possible. > Of course, I am not sure if it fits in your workflow. > > -- > luigi > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ 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] Convert SVG to MetaPost
On 8/12/2019 1:15 PM, Taco Hoekwater wrote: Hi, On 12 Aug 2019, at 12:10, Jon Wong wrote: Hi all, Is it possible to convert SVG to MetaPost? Currently, I have Bash scripts in my workflow to invoke Inkscape (converting SVG to PDF). I don’t like to allow shell access to TeX. If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files instead of SVG files. That will do away with having to convert SVG into PDF (via Inkscape). SVG (and Inkscape) can do many graphical things that metapost can not do, so I think that would be a bad idea even if there was a tool that could do the conversion for some subset of SVG. That said, SVG is just an XML format, so it should be possible to process simple SVG using ConTeXt’s built-in xml parser (with suitable processing environments, of course). How much work that would entail and whether it is feasible depends on the actual SVG graphics. indeed, and i actually did a partial converter a while ago just to see if it could be done but then decided to delay that till i really need it (normally converting a svg to pdf is quite ok) .. i might pick it up on some cold winternight 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] Convert SVG to MetaPost
On 8/12/2019 1:33 PM, Jon Wong wrote: Hi Taco! Very enlightening! I’ll just use both MetaPost and SVG for their intended purposes. (SVG will come from workflow involving GIMP/Inkscape; MetaPost for logical, rather than graphical, figures.) if you have inkscape installed you can do \externalfigure[test.svg][width=10cm] and context will handle the conversion - 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 with Multiple Variable Sections
I have been working with MetaPost as following, which worked fine with one startMPcode section with variables, but with 2 startMPcode Metapost sections, it keeps telling me the numbers dont add up: \definefloat [floatright][figure] \setupfloat [floatright][default={right,none}] \setuplayout [backspace=20mm,width=170mm,topspace=20mm,height=250mm] \starttext \placefloatright{}{ \startMPcode pair a, b; a := (0,0); b := (50,50); draw a -- b; \stopMPcode} \placefloatright{}{ \startMPcode pair a; a := 2cm; draw fullcircle scaled (2*a); \stopMPcode} \stoptext I also have tried with the startbuffer combination as below, but this gave the same error codes. Is there any other way of working with multiple MetaPost sections with variables in a single document? \definefloat [floatright][figure] \setupfloat [floatright][default={right,none}] \setuplayout [backspace=20mm,width=170mm,topspace=20mm,height=250mm] \starttext \startbuffer \startMPcode pair a, b; a := (0,0); b := (50,50); draw a -- b; \stopMPcode \stopbuffer \floatright{}{\getbuffer} \startbuffer \startMPcode pair a; a := 2cm; draw fullcircle scaled (2*a); \stopMPcode \stopbuffer \floatright{}{\getbuffer} \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] A question about whatever (Metapost)
Hi, The point M is such that the line (CM) is perpendicular to the line (NP). I do not understand the error of this code. Thank you Fabrice \usecolors[xwi] \starttext \startMPcode path carre, p; carre = unitsquare scaled 138; pair a, b, c, d, N, P, M; a = point 0 of carre; b = point 1 of carre; c = point 2 of carre; d = point 3 of carre; p = b -- d; N = whatever[a,d]; P = whatever[a,b]; M = whatever[b,d]; (M - c) dotprod (P - N) = 0; draw M -- c; draw p withcolor \MPcolor{navy}; draw carre withcolor \MPcolor{firebrick}; label.lft("$A$", point 0 of carre); label.lrt("$B$", point 1 of carre); label.urt("$C$", point 2 of carre); label.ulft("$D$", point 3 of carre); \stopMPcode \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] METAPOST subpath rounding issue
> On 7 May 2020, at 20:28, Gerben Wierda wrote: > > I have a METAPOST algorithm that splits a path at a certain time in two, does > something with both ends (not the ends where they were split) and then > rejoins them. > > In very rare cases this crashes, because the subpath doesn’t work as expected. > > firstPart := subpath (0,halfWayTime) of workingConn; > secondPart := subpath (halfWayTime,pathTimeLen) of workingConn; > > may sometimes result in something like this: > > metapost log> >> Path at line 0: > metapost log> (273,-427)..controls (259.506666,-427) and > (246.013335,-427) > metapost log > ..(232.520001,-427) > metapost log> > metapost log> >> Path at line 0: > metapost log> (232.519998,-427)..controls > (161.680001,-427) and (90.84000 > metapost log> 03,-427) > metapost log> ..(20,-427) > > As can be seen in these (rare) cases the two calls to subpath result in a > different point resulting from both. so, when I later try to rejoin them with > & it fails: > > metapost log> ! Paths don't touch; '&' will be changed to '..'. > metapost log> > > Which means subpath doesn’t always exactly do what I expect it to do (and > many explanations, but not the official manual) state. Again, this is rare. > > I’ve done this to work around it but I wondered if there was a better > (reliable) solution > > save cutFirstPart; path cutFirstPart; cutFirstPart := firstPart > maxcutbefore fromPicOutline; > save cutSecondPart; path cutSecondPart; cutSecondPart := secondPart > maxcutafter toPicOutline; > if ((xpart point 0 of cutSecondPart) <> (xpart point infinity of > cutFirstPart)) > or ((ypart point 0 of cutSecondPart) <> (ypart point infinity of > cutFirstPart)): > resultConn := cutFirstPart--cutSecondPart; > else: > resultConn := cutFirstPart & cutSecondPart; > fi A crude test of path pb; pb:=(5.5cm,0cm)--(5.5cm,0cm)--(10.5cm,0cm); draw pb; gives no errors so why not just join using -- all the time and save the test? -- Bruce Horrocks Hampshire, UK ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] METAPOST subpath rounding issue
> On 8 May 2020, at 00:46, n...@scorecrow.com wrote: > > > >> On 7 May 2020, at 20:28, Gerben Wierda wrote: >> >> I have a METAPOST algorithm that splits a path at a certain time in two, >> does something with both ends (not the ends where they were split) and then >> rejoins them. >> >> In very rare cases this crashes, because the subpath doesn’t work as >> expected. >> >> firstPart := subpath (0,halfWayTime) of workingConn; >> secondPart := subpath (halfWayTime,pathTimeLen) of workingConn; >> >> may sometimes result in something like this: >> >> metapost log> >> Path at line 0: >> metapost log> (273,-427)..controls (259.50,-427) and >> (246.013335,-427) >> metapost log> ..(232.520001,-427) >> metapost log> >> metapost log> >> Path at line 0: >> metapost log> (232.519998,-427)..controls >> (161.680001,-427) and (90.84000 >> metapost log> 03,-427) >> metapost log> ..(20,-427) >> >> As can be seen in these (rare) cases the two calls to subpath result in a >> different point resulting from both. so, when I later try to rejoin them >> with & it fails: >> >> metapost log> ! Paths don't touch; '&' will be changed to '..'. >> metapost log> >> >> Which means subpath doesn’t always exactly do what I expect it to do (and >> many explanations, but not the official manual) state. Again, this is rare. >> >> I’ve done this to work around it but I wondered if there was a better >> (reliable) solution >> >> save cutFirstPart; path cutFirstPart; cutFirstPart := firstPart >> maxcutbefore fromPicOutline; >> save cutSecondPart; path cutSecondPart; cutSecondPart := secondPart >> maxcutafter toPicOutline; >> if ((xpart point 0 of cutSecondPart) <> (xpart point infinity of >> cutFirstPart)) >>or ((ypart point 0 of cutSecondPart) <> (ypart point infinity of >> cutFirstPart)): >>resultConn := cutFirstPart--cutSecondPart; >> else: >>resultConn := cutFirstPart & cutSecondPart; >> fi > > A crude test of > > path pb; > pb:=(5.5cm,0cm)--(5.5cm,0cm)--(10.5cm,0cm); > draw pb; > > gives no errors so why not just join using -- all the time and save the test? Because the double exact points are also creating (different) problems in my algorithm as they make the path have 'no direction' at that point (direction is (0,0). G > > -- > Bruce Horrocks > Hampshire, UK > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] METAPOST subpath rounding issue
> On 8 May 2020, at 13:58, Gerben Wierda wrote: > >> On 8 May 2020, at 00:46, n...@scorecrow.com wrote: >> >>> On 7 May 2020, at 20:28, Gerben Wierda wrote: >>> >>> I have a METAPOST algorithm that splits a path at a certain time in two, >>> does something with both ends (not the ends where they were split) and then >>> rejoins them. >>> >>> In very rare cases this crashes, because the subpath doesn’t work as >>> expected. >>> >>> firstPart := subpath (0,halfWayTime) of workingConn; >>> secondPart := subpath (halfWayTime,pathTimeLen) of workingConn; >>> >>> may sometimes result in something like this: >>> >>> metapost log> >> Path at line 0: >>> metapost log > (273,-427)..controls (259.506666,-427) and >>> (246.013335,-427) >>> metapost log> ..(232.520001,-427) >>> metapost log> >>> metapost log> >> Path at line 0: >>> metapost log> (232.519998,-427)..controls >>> (161.680001,-427) and (90.84000 >>> metapost log> 03,-427) >>> metapost log> ..(20,-427) >>> >>> As can be seen in these (rare) cases the two calls to subpath result in a >>> different point resulting from both. so, when I later try to rejoin them >>> with & it fails: >>> >>> metapost log> ! Paths don't touch; '&' will be changed to '..'. >>> metapost log> >>> >>> Which means subpath doesn’t always exactly do what I expect it to do (and >>> many explanations, but not the official manual) state. Again, this is rare. >>> >>> I’ve done this to work around it but I wondered if there was a better >>> (reliable) solution >>> >>> save cutFirstPart; path cutFirstPart; cutFirstPart := firstPart >>> maxcutbefore fromPicOutline; >>> save cutSecondPart; path cutSecondPart; cutSecondPart := secondPart >>> maxcutafter toPicOutline; >>> if ((xpart point 0 of cutSecondPart) <> (xpart point infinity of >>> cutFirstPart)) >>>or ((ypart point 0 of cutSecondPart) <> (ypart point infinity of >>> cutFirstPart)): >>>resultConn := cutFirstPart--cutSecondPart; >>> else: >>>resultConn := cutFirstPart & cutSecondPart; >>> fi >> >> A crude test of >> >> path pb; >> pb:=(5.5cm,0cm)--(5.5cm,0cm)--(10.5cm,0cm); >> draw pb; >> >> gives no errors so why not just join using -- all the time and save the test? > > Because the double exact points are also creating (different) problems in my > algorithm as they make the path have 'no direction' at that point (direction > is (0,0). You can save extracting the xparts and yparts by using direct subtraction of pairs and comparing with (0,0) like this: \starttext \startMPcode path cutFirstPart,cutSecondPart; cutFirstPart := (0,0) -- (232.520001,-427); cutSecondPart := (232.519998,-427) -- (999,-427); %cutFirstPart := (0,0) -- (232.520001,-427); %cutSecondPart := (232.520001,-427) -- (999,-427); if (point infinity of cutFirstPart) - (point 0 of cutSecondPart) = (0,0) : label("same", (1cm,1cm)) else : label("different", (1cm,1cm)) fi; \stopMPcode \stoptext *Except* that the example doesn't work with floats that are so close. Changing 232.52_etc to 332.52_etc works as expected. I'm hoping that this is a "feature" of the parser reading in the example at a lower precision than the number of decimals provided. For your code, where the different values are created by calculation, the two pairs should be recognised as different. -- Bruce Horrocks Hampshire, UK ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] METAPOST subpath rounding issue
> You can save extracting the xparts and yparts by using direct subtraction of > pairs and comparing with (0,0) like this: Aaaargh, no, ignore that, it's nonsense. It's amazing how you can stare at something for minutes but only see the flaw the moment you press send. Sorry for the noise. -- Bruce Horrocks Hampshire, UK ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] METAPOST subpath rounding issue
> On 10 May 2020, at 00:01, Bruce Horrocks wrote: > >> You can save extracting the xparts and yparts by using direct subtraction of >> pairs and comparing with (0,0) like this: > > Aaaargh, no, ignore that, it's nonsense. It's amazing how you can stare at > something for minutes but only see the flaw the moment you press send. Sorry > for the noise. Instead, I would like to thank you for thinking about it and trying to help. Wrestling with it (and making mistakes) is part of all that (I’ve probably made more than most). G ___ 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] 'debug' version of METAPOST draw?
I would like to be able (during development) to draw paths where the points of the path (and maybe thing slike directions) are visualised. E.g. a path where each pair in teh path is also drawn as a dot and maybe teh directions drawn as small arrows. Does someone have such a beast lying around? G ___ 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] mtxrun --script metapost and fonts?
Hallo. I've got a problem with metapost -> pdf translation. Since mptopdf is still broken in the last ConTeXt beta in the minimal distribution, I use "mtxrun --script metapost --split". It works well, only it ignores font setting. My code is like this: verbatimtex \definetypeface [times] [rm] [serif] [times] [default] [encoding=ec] \definetypeface [times] [mm] [math] [times] [default] [encoding=ec] \setupbodyfont [times,10pt] etex; beginfig(1); label(btex A $a_i$ etex,origin); endfig; end. I believe that the code in the verbatimtex ... etex environment should switch the major font to Times (it works with "texexec --mptex"). However, it is ignored by the "mtxrun --script metapost --split" script---Computer Modern in 12pt is used instead of Times in 10pt. Is there any way around this problem? Many thanks for your help. Best wishes, Michal Kvasnicka ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] MetaPost visibly drawing at 0pt
I used to put an invisible frame around figures in MetaPost by setting a pen scaled at 0pt. That left no trace, but defined the area. However I (now) see a thin line drawn by code: pickup pencircle scaled 0pt; draw origin--(w,h); Did I always mis this or has something changed? For example a roundoff away from zero in MetaPost? By the way I am typesetting through ConTeXT with \startMPpage … \stopMPpage. Hans van der Meer ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost not adding picture
Am 09.10.2011 22:01, schrieb Meer, H. van der: > I have this question on the implementation of metapost. > The following program ends in an error: > > \startMPpage > picture v; > draw origin--(1cm,1cm); > v = currentpicture; > clearit; > draw (1cm,0)--(0,1cm); > currentpicture := currentpicture + v; use addto currentpicture also v; > \stopMPpage > > The error is: ! Not implemented: (picture)+(picture). > Yet Knuth's metafont book in Chapter 13 tells me, quote: "Pictures can be > added or subtracted;" > Is the current metafont implementation lacking this feature? Will it be > implemented in the near future? > Just another notation, that's all. Best wishes, Peter ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] macro string in metapost
On 1-11-2011 23:21, Meer, H. van der wrote: The goal is to make the following string in metapost: string s; where s must become "\MPcolor{Blue}". and ultimately execute this at the right moment with: scantokens s; The following makes s = "MPcolor{Blue}": s := "MPcolor"& char oct"134"& char oct"173"& "Blue"& char oct"134"& char oct"175"; But I seem unable to add a \ in front of it without expanding the string by TeX. Thus it does not work to put: s := char oct"134"& "MPcolor"& char oct"134"& char oct"173"& "Blue"& char oct"134"& char oct"175"; Placing a \noexpand in front does not help. \MPcolor is expanded when the code is passed to mp so delaying is not possible and once mp runs it already sees the colors what you want is something fill fullcircle scaled 10cm withcolor .5 * namedcolor("gray") ; fill fullcircle scaled 5cm withcolor namedcolor("red") ; fill fullcircle scaled 5cm withcolor namedcolor("green") ; fill fullcircle scaled 5cm withcolor namedcolor("blue") ; (I have that as experimental code but will move it to the regular code) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Arrows and boxes in metapost.
Hello, I need a simple graphic that shows some boxes (frames) with text in it and has some arrows pointing to and from these boxes. (examples 267 and 268 on this page [1]) I was hoping to do this in MetaPost. Earlier this year this question went un-answered on this list: "How to use boxit MetaPost macros with ConTeXt minimals?" So, is there a solution or do I have to use label.rt(btex \framed[width=3cm,align=middle]{Text} etex, (1u,1.5u)); Which really feels uncomfortable in this case. Best regards Christian [1] http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Commands with arguments with MetaPost
I would like to be able to do something like this \def\foo#1{ \startMPcode fill (0,0)--(598,0)--(598,50)--(0,50)--cycle withcolor green; label.rt(btex #1 etex),(50,25); \stopMPcode } and then use this in my ConTeXt document by \foo{Some text} However, my syntax seems to be incorrect, and I would appreciate any help in fixing it. Thanks, Troy Henderson ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On Thu, 3 May 2012, Marco wrote: The wiki claims setting up an MPenvironment is enough to change the font in MetaPost graphics: \startMPenvironment%[global] \switchtobodyfont [sans] \stopMPenvironment \starttext This should be serif. \startMPcode draw textext("This should be in sans."); \stopMPcode \stoptext However, this has no effect. All text is in default serif font. If [global] is provided, all text is in sans font. I am aware of a similar issue in a thread last year¹, but the solution didn't really address the problem. textext("\sans This should be sans.") works here, but the point is that the MPenvironment fails. Why is that? Metapost now runs as a library. All the text is first typeset by ConTeXt and metapost only knows the bounding box of the labels. You can try (untested): \starttext This is serif \switchtobodyfont[sans] \startMPcode draw textext("This should be sans"); \stopMPcode \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 2012-05-02 Aditya Mahajan wrote: > Metapost now runs as a library. All the text is first typeset by ConTeXt > and metapost only knows the bounding box of the labels. > > You can try (untested): > > \starttext > > This is serif > > \switchtobodyfont[sans] > \startMPcode > draw textext("This should be sans"); > \stopMPcode > > \stoptext This works, of course. However it continues with sans font even after \stopMPcode. This is better (but clumsy): \start \switchtobodyfont[sans] \startMPcode draw textext("This should be sans"); \stopMPcode \stop Here serif again. The text in Metapost adapts to the text set in ConTeXt. But the font setup should *only* be set for MetaPost, not regular text. Does that mean, that MPenvironment is deprecated and does not work at all? Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On Thu, May 3, 2012 at 3:13 AM, Marco wrote: > > The text in Metapost adapts to the text set in ConTeXt. But the font > setup should *only* be set for MetaPost, not regular text. > > Does that mean, that MPenvironment is deprecated and does not work > at all? Please don't rely on my answer since I haven't been following the development as closely as I used to in past. But my guess is that the argument goes into the opposite way. I past (and still in MKII) one *had to* set up fonts twice - once for the main document and once for MetaPost since MetaPost did its own processing of labels and MetaPost didn't see the ConTeXt font setups. So it was "difficult" to convince MetaPost to use the same font. Now (as Aditya explained) metapost automatically inherits font setups from the main document and it might be that nobody ever thought of / requested / needed to have a special setup for using different font for MetaPost labels. I can think of many workarounds to this, but I agree that there is a valid reason why \startMPenvironment (or some other command) should be able to change the font inside metapost labels only. Mojca ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On Fri, 4 May 2012, Mojca Miklavec wrote: I can think of many workarounds to this, but I agree that there is a valid reason why \startMPenvironment (or some other command) should be able to change the font inside metapost labels only. A better alternative would to define \setupMPtext [ style=..., color=..., setups=..., ] that can be used to set the style for metapost text. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 2012-05-04 Aditya Mahajan wrote: > On Fri, 4 May 2012, Mojca Miklavec wrote: > > But my guess is that the argument goes into the opposite way. I > > past (and still in MKII) one *had to* set up fonts twice - once > > for the main document and once for MetaPost since MetaPost did > > its own processing of labels and MetaPost didn't see the ConTeXt > > font setups. So it was "difficult" to convince MetaPost to use > > the same font. I agree, it's a big step forward towards usability and consistency to have MetaPost automatically inherit ConTeXts settings. However, it went out-of-control now. > A better alternative would to define > > \setupMPtext > [ > style=..., > color=..., > setups=..., > ] > > that can be used to set the style for metapost text. +1 Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 4-5-2012 13:09, Marco wrote: On 2012-05-04 Aditya Mahajan wrote: On Fri, 4 May 2012, Mojca Miklavec wrote: But my guess is that the argument goes into the opposite way. I past (and still in MKII) one *had to* set up fonts twice - once for the main document and once for MetaPost since MetaPost did its own processing of labels and MetaPost didn't see the ConTeXt font setups. So it was "difficult" to convince MetaPost to use the same font. I agree, it's a big step forward towards usability and consistency to have MetaPost automatically inherit ConTeXts settings. However, it went out-of-control now. well, you still get text and not something random, so out-of-control is a bit too strong anyhow, we can do \newconditional\MPLIBtextgetdone \def\MPLIBsettext#1% #2% {\ifconditional\MPLIBtextgetdone \else \cldcontext{metapost.tex.get()}% \settrue\MPLIBtextgetdone % no \global needed \fi \dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox} \def\MPLIBresettexts {\ctxlua{metapost.resettextexts()}%$ \setfalse\MPLIBtextgetdone} \starttext Serif \startMPcode draw textext("\ss Sans") ; \stopMPcode Serif \startMPenvironment \ss \stopMPenvironment \startMPcode draw textext("Sans") ; \stopMPcode Serif \stoptext A better alternative would to define \setupMPtext [ style=..., color=..., setups=..., ] that can be used to set the style for metapost text. this is ok for me, but then we mighe as well drop \startMPenviroment (and someone has to wikify that then) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 4-5-2012 09:13, Aditya Mahajan wrote: On Fri, 4 May 2012, Mojca Miklavec wrote: I can think of many workarounds to this, but I agree that there is a valid reason why \startMPenvironment (or some other command) should be able to change the font inside metapost labels only. A better alternative would to define \setupMPtext [ style=..., color=..., setups=..., ] that can be used to set the style for metapost text. As we already have instances, I've extended that mechanism, so one can say: \startsetups mp:instance:one indeed:\space \stopsetups \setupMPinstance [metafun] [textstyle=bold, textcolor=darkgreen, setups=mp:instance:one] \defineMPinstance [mympinstance] [metafun] [textcolor=red] \starttext \startMPcode draw textext("some text") ; \stopMPcode \startMPcode{mympinstance} draw textext("some text") ; \stopMPcode \stoptext > +1 > > Marco So .. we know who is going to wikify this ... Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 2012-05-05 Hans Hagen wrote: That means, MPenvironment will be dropped, right? But what is the new interface, \setupMPtext or MPinstance? > > +1 > > > > Marco > > So .. we know who is going to wikify this ... You're welcome :) Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On Sat, 5 May 2012, Marco wrote: On 2012-05-05 Hans Hagen wrote: That means, MPenvironment will be dropped, right? But what is the new interface, \setupMPtext or MPinstance? \setupMPinstance The advantage is that you can have multiple instances in parallel. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 2012-05-05 Hans Hagen wrote: This code fails: \defineMPinstance [mympinstance] [metafun] [textcolor=red] \starttext \startMPcode draw textext("some text") ; \stopMPcode \startMPcode{mympinstance} draw textext("some text") ; \stopMPcode \stoptext Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 8-5-2012 19:01, Marco wrote: On 2012-05-05 Hans Hagen wrote: Did I? This code fails: \defineMPinstance [mympinstance] [metafun] [textcolor=red] \starttext \startMPcode draw textext("some text") ; \stopMPcode \startMPcode{mympinstance} draw textext("some text") ; \stopMPcode \stoptext Marco It works here. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 2012-05-08 Hans Hagen wrote: > On 8-5-2012 19:01, Marco wrote: > > On 2012-05-05 Hans Hagen wrote: > > Did I? My bad ;) > > This code fails: > > > > \defineMPinstance [mympinstance] [metafun] [textcolor=red] > > > > \starttext > > > > \startMPcode > > draw textext("some text") ; > > \stopMPcode > > > > \startMPcode{mympinstance} > > draw textext("some text") ; > > \stopMPcode > > > > \stoptext > > > > Marco > > It works here. Fails here, source and log are attached. current version: 2012.05.08 13:45 Marco \defineMPinstance [mympinstance] [metafun] [textcolor=red] \starttext \startMPcode draw textext("some text") ; \stopMPcode \startMPcode{mympinstance} draw textext("some text") ; \stopMPcode \stoptext (g.tex ConTeXt ver: 2012.05.08 13:45 MKIV fmt: 2012.5.8 int: english/english system > cont-new.mkiv loaded (/home/zewz/context/tex/texmf-context/tex/context/base/cont-new.mkiv system > beware: some patches loaded from cont-new.mkiv ) system > g.top loaded system > options > start used options used options> % runtime options files (command line driven) used options> \unprotect used options> % feedback and basic job control used options> % handy for special styles used options> \startluacode used options> document = document or { } used options> document.arguments={ used options> ["once"]=true, used options> } used options> document.files={ used options> "g", used options> } used options> \stopluacode used options> % process info used options> \setupsystem[inputfile=g] used options> \setupsystem[\c!n=3,\c!m=1] used options> \enabledirectives[system.runonce] used options> % modes used options> % options (not that important) used options> \startsetups *runtime:options used options> \stopsetups used options> % styles and modules used options> \startsetups *runtime:modules used options> \stopsetups used options> % done used options> \protect \endinput system > options > stop used options (g.top) fonts > latin modern fonts are not preloaded languages > language en is active {/home/zewz/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map} fonts > preloading latin modern fonts (second stage) fonts > typescripts > unknown: library 'loc' {/home/zewz/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{/home/zewz/context/tex/texmf/fonts/map/dvips/lm/lm-rm.map} fonts > virtual math > unable to resolve name mapsfromchar fonts > fallback modern rm 12pt is loaded metapost> initializing instance 'metafun' using format 'metafun' metapost> loading 'metafun': /home/zewz/context/tex/texmf-context/metapost/context/base/metafun.mpiv metapost> initializing instance 'mympinstance' using format 'metafun' metapost> loading 'metafun': /home/zewz/context/tex/texmf-context/metapost/context/base/metafun.mpiv ! terminal: >> OverlayLineColor >> (0,0,0) ! Equation cannot be performed (numeric=color). ; <*> ...ineWidth:=0pt ; OverlayLineColor:=(0,0,0); OverlayColor:=(0,0,0); Ba... >> OverlayColor >> (0,0,0) ! Equation cannot be performed (numeric=color). ; <*> ...yLineColor:=(0,0,0); OverlayColor:=(0,0,0); BaseLineSkip:=14.4816pt; ... . system > tex > error on line 11 in file g.tex: terminal: >> OverlayLineColor >> (0,0,0) ! Equation cannot be performed (numeric=color). ; <*> ...ineWidth:=0pt ; OverlayLineColor:=(0,0,0); OverlayColor:=(0,0,0); Ba... >> OverlayColor >> (0,0,0) ! Equation cannot be performed (numeric=color). ; <*> ...yLineColor:=(0,0,0); OverlayColor:=(0,0,0); BaseLineSkip:=14.4816pt; ... ... 1 \defineMPinstance [mympinstance] [metafun] [textcolor=red] 2 3 \starttext 4 5 \startMPcode 6 draw textext("some text") ; 7 \stopMPcode 8 9 \startMPcode{mympinstance} 10 draw textext("some text") ; 11 >> \stopMPcode 12 13 \stoptext 14 ...0;;]===], [===[;;]===], false)} \meta_process_graphic ...!!es , \MPaskedfigure )}}
Re: [NTG-context] Font for MetaPost graphics
On 8-5-2012 19:19, Marco wrote: On 2012-05-08 Hans Hagen wrote: On 8-5-2012 19:01, Marco wrote: On 2012-05-05 Hans Hagen wrote: Did I? My bad ;) This code fails: \defineMPinstance [mympinstance] [metafun] [textcolor=red] \starttext \startMPcode draw textext("some text") ; \stopMPcode \startMPcode{mympinstance} draw textext("some text") ; \stopMPcode \stoptext Marco It works here. Fails here, source and log are attached. ok, can you add this to cont-new.mkiv (after \unprotect): \def\m_meta_colo_initializations{% vardef OverlayLineColor=\MPcolor{\overlaylinecolor} enddef; vardef OverlayColor=\MPcolor{\overlaycolor} enddef; } I have that in my local experimental code. It has to do with the fact that mp's color spaces are not compatible with each other. As I've used that patch for quite a while now I could probably move it to the core. Maybe more users can test this. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 2012-05-08 Hans Hagen wrote: > ok, can you add this to cont-new.mkiv (after \unprotect): > > \def\m_meta_colo_initializations{% > vardef OverlayLineColor=\MPcolor{\overlaylinecolor} enddef; > vardef OverlayColor=\MPcolor{\overlaycolor} enddef; > } That works. > As I've used that patch for quite a while now I could probably > move it to the core. Since you use it for a while it seems to work ⇒ into the core Thanks a lot Hans for implementing this. Wikified: http://wiki.contextgarden.net/Command/defineMPinstance http://wiki.contextgarden.net/Command/setupMPinstance Best wishes Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
Hello, many thanks Marco for wikifying. On Tue, 08 May 2012 21:57:04 +0200, Marco wrote: Thanks a lot Hans for implementing this. Wikified: http://wiki.contextgarden.net/Command/defineMPinstance http://wiki.contextgarden.net/Command/setupMPinstance Best wishes Marco With the permission, I tried to replace the tag with to get source and result. ... Unfortunately, the result doesn't appear. So, what to do to make the example work? Will it work automatically once the Ctx/MP engine updates on wiki? Best regards, Lukas -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Font for MetaPost graphics
On 2012-05-10 Procházka Lukáš Ing. - Pontex s. r. o. wrote: > With the permission, I tried to replace the tag with to > get source and result. > > > ... > > > Unfortunately, the result doesn't appear. The code is MkIV only and the wiki uses MkII. > So, what to do to make the example work? Find someone who has time to implement and administrate a working MkIV wiki solution. > Will it work automatically once the Ctx/MP engine updates on wiki? *If* the engine gets updated someday, it will probably work, yes. Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Import a metapost extension
Hi, I think you need this: \startMPinclusions input mp-scratch; \stopMPinclusions \startMPcode Scratchversion:=3; …. If that also doesn’t work, perhaps attach the log file / terminal output to a new message. Best wishes, Taco > On 1 Sep 2020, at 13:07, Fabrice Couvreur wrote: > > Hello > Is it possible to import a metapost extension into a file compiled with the > lmtx engine ? > I tried unsuccessfully with this example : > > begin test.tex > > \starttext > \startMPcode > input mp-scratch; > > Scratchversion:=3; > > draw Drapeau; > draw Repeter("4"); > draw Avancer("50"); > draw Tournerd("90"); > draw FinBlocRepeter; > > \stopMPcode > \stoptext > > end test.tex > > Thanks > 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 > ___ Taco Hoekwater Elvenkind BV ___ 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] Import a metapost extension
Hi Taco, Thank you for your help. I specify that this extension works perfectly by compiling the following file. input mp-scratch; Scratchversion:=3; beginfig(1); draw Drapeau; draw Repeter("4"); draw Avancer("100"); draw Tournerd("90"); draw FinBlocRepeter; endfig; end But what you are proposing unfortunately does not work. Fabrice Le mar. 1 sept. 2020 à 14:25, Taco Hoekwater a écrit : > Hi, > > I think you need this: > > \startMPinclusions > input mp-scratch; > \stopMPinclusions > > \startMPcode > Scratchversion:=3; > …. > > If that also doesn’t work, perhaps attach the log file / terminal output > to a new message. > > Best wishes, > Taco > > > On 1 Sep 2020, at 13:07, Fabrice Couvreur > wrote: > > > > Hello > > Is it possible to import a metapost extension into a file compiled with > the lmtx engine ? > > I tried unsuccessfully with this example : > > > > begin test.tex > > > > \starttext > > \startMPcode > > input mp-scratch; > > > > Scratchversion:=3; > > > > draw Drapeau; > > draw Repeter("4"); > > draw Avancer("50"); > > draw Tournerd("90"); > > draw FinBlocRepeter; > > > > \stopMPcode > > \stoptext > > > > end test.tex > > > > Thanks > > 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 > > > ___ > > Taco Hoekwater > Elvenkind BV > > > > > > ___ > 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 > > ___ > This is MetaPost, version 2.00 (TeX Live 2020) (kpathsea version 6.3.2) 1 SEP 2020 15:01 **scratch-1.mp (/home/viserion/texlive/2020/texmf-dist/metapost/base/mpost.mp (/home/viserion/texlive/2020/texmf-dist/metapost/base/plain.mp Preloading the plain mem file, version 1.005) ) (./scratch-1.mp (/home/viserion/texmf/metapost/mp-scratch.mp (/home/viserion/texmf/metapost/LATEXScratch.mp) (/home/viserion/texmf/metapost/Mouvement.mp) (/home/viserion/texmf/metapost/Apparence.mp) (/home/viserion/texmf/metapost/Sons.mp) (/home/viserion/texmf/metapost/Stylo.mp ) (/home/viserion/texmf/metapost/Controle.mp) (/home/viserion/texmf/metapost/Evenements.mp) (/home/viserion/texmf/metapost/Bloc.mp) (/home/viserion/texmf/metapost/Divers.mp) (/home/viserion/texmf/metapost/Capteurs.mp) (/home/viserion/texmf/metapost/Variable.mp)) (./mptextmp.mp) (./mptextmp.mp) >> 34.55159 >> 55.29037 (./mptextmp.mp) (./mptextmp.mp) >> 105.50436 (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) >> 39.74248 >> 63.32898 (./mptextmp.mp) (./mptextmp.mp) >> 84.05197 (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) >> 56.92798 >> 92.35968 (./mptextmp.mp) (./mptextmp.mp) >> 112.43477 (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) >> 97.13678 >> 127.64769 (./mptextmp.mp) (./mptextmp.mp) >> 171.08908 (./mptextmp.mp) [1{psfonts.map}{crlt_csjzgd.enc}] ) 1 output file written: scratch-1.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] Import a metapost extension
On 9/1/2020 3:04 PM, Fabrice Couvreur wrote: Hi Taco, Thank you for your help. I specify that this extension works perfectly by compiling the following file. input mp-scratch; Scratchversion:=3; beginfig(1); draw Drapeau; draw Repeter("4"); draw Avancer("100"); draw Tournerd("90"); draw FinBlocRepeter; endfig; end But what you are proposing unfortunately does not work. what if you add a suffix: input "mp-scratch.mp" ; maybe the path you look for is not part of the search path either mtxrun --expand-path MPINPUTS 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] Import a metapost extension
Hi, > On 1 Sep 2020, at 16:46, Hans Hagen wrote: > > On 9/1/2020 3:04 PM, Fabrice Couvreur wrote: >> Hi Taco, >> Thank you for your help. I specify that this extension works perfectly by >> compiling the following file. A logfile of a failed run would have been more helpful in trying to track down the problem. But I did notice that there is a LaTeX file loaded in your succesful run. So perhaps the extension depends on LaTeX? > > input "mp-scratch.mp" ; > > maybe the path you look for is not part of the search path either > > mtxrun --expand-path MPINPUTS > > Hans > > - > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > - > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Import a metapost extension
Taco Hoekwater schrieb am 01.09.2020 um 19:12: Hi, On 1 Sep 2020, at 16:46, Hans Hagen wrote: On 9/1/2020 3:04 PM, Fabrice Couvreur wrote: Hi Taco, Thank you for your help. I specify that this extension works perfectly by compiling the following file. A logfile of a failed run would have been more helpful in trying to track down the problem. But I did notice that there is a LaTeX file loaded in your succesful run. So perhaps the extension depends on LaTeX I looked for the file online [1] and it uses LaTeX commands (even begin/end blocks) for all text boxes. [1] https://melusine.eu.org/syracuse/poulecl/mp-scratch/ 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] Import a metapost extension
Hello, That's okay, I'll compile the files with mpost and do an image insert. Thanks for your help. Fabrice Le mar. 1 sept. 2020 à 19:32, Wolfgang Schuster < wolfgang.schuster.li...@gmail.com> a écrit : > Taco Hoekwater schrieb am 01.09.2020 um 19:12: > > Hi, > > > On 1 Sep 2020, at 16:46, Hans Hagen > wrote: > > On 9/1/2020 3:04 PM, Fabrice Couvreur wrote: > > Hi Taco, > Thank you for your help. I specify that this extension works perfectly by > compiling the following file. > > A logfile of a failed run would have been more helpful in trying to track > down the problem. But I did notice that there is a LaTeX file loaded in your > succesful run. So perhaps the extension depends on LaTeX > > > I looked for the file online [1] and it uses LaTeX commands (even > begin/end blocks) for all text boxes. > > [1] https://melusine.eu.org/syracuse/poulecl/mp-scratch/ > > 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 > > ___ > ___ 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] embed metapost figure into document
Dear List, I'm trying to embed a metapost image into the document. According the MetaFun manual <http://www.pragma-ade.com/general/manuals/metafun-p.pdf>, "embedding such a graphic is done by: \externalfigure[graphic.123][width=4cm]", but the following example produces an empty page: % test.mkxl \starttext \externalfigure[test.123][width=4cm] \stoptext % test.123 draw fullcircle scaled cm withcolor black; Does anyone know how to properly embed a metapost image into a context document? Thanks! Best, Sylvain ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] drop shadows with metapost/ metafun
Which process would you advice to add « drop shadows » to any kind of metafun / metapost figures like: picture p; p := textext("MetaPost is fun!") shifted (10cm,10cm); My current understanding of the required steps : 1- fill p with the shadow color 2- write it to an external metapost file (with savebuffer ?) ready for png export (outputformat := "png »;) 3- with lua, os.execute, and imagemagick prepare the shadow - extent the png file with a transparent background, to have room for blurring - blur it 4- import this png in context / Metapost (externalfigure), and center it with p figure 5- shift it according to the desired shadows distance and angle 6- apply the initial bounding box of p to the shadow, draw the shadow, draw the p picture Actually, all this seems long and tedious, and contrasts with the already existing links between MetaPost / MetaFun and cairo + libpng. Thanks again for your help.___ 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 graph and ConTeXt LMTX
Dear List, I have used TikZ and pgfplots for a few years and I am considering switching to metapost/metafun which appears more efficient with LMTX. I have already designed several figures with metapost/metafun and some with the help of metaobj and I am fully satisfied with the result. I am now trying to draw graphs with the metapost graph module, but I haven't been integrated to my ConTeXt LMTX document. The following example works perfectly well when compiled directly with metapost (from TeXlive 2020). = mpost example = beginfig(1) input graph draw begingraph(150mm, 100mm); gdraw "test-mpgraph.txt"; endgraph; endfig; end = Here is my demo data file test-mpgraph.txt 0 0 1 1 2 2 3 1 4 3 5 2 6 1 == I tried the following to draw directly from a ConTeXt document LMTX example = \starttext \startMPcode troffmode:=0; prologues:=0; input graph draw begingraph(150mm, 100mm); gdraw "test-mpgraph.txt"; endgraph; \stopMPcode \stoptext === I had to define troffmode and prologues, otherwise I get error messages about undecidable expressions and now I get an error that I don't understand (see attached log file). I also tried \usemodule[graph] as documented on the wiki (https://wiki.contextgarden.net/MPgraph) but without success. I guess I am doing something wrong. Could someone help me see my error? Thanks, -- Jean-Philippe Rey jean-philippe@centralesupelec.fr 91192 Gif-sur-Yvette Cedex - France Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51 test-mpgraph.log Description: Binary data ___ 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] About baseline alignment in metapost
Dear list, Consider the following example: \definepapersize [custom] [width=20cm, height=15cm] \setuppapersize [custom] \setuplayout [ width=fit, rightmargin=0cm, leftmargin=0cm, leftmargindistance=0pt, rightmargindistance=0pt, height=fit, header=0pt, footer=0pt, topspace=0cm, backspace=0cm, bottomspace=0cm, bottom=0pt, location=singlesided] \setuppagenumbering[location=] \startMPpage StartPage ; width := PaperWidth ; height := PaperHeight ; unit := cm ; drawoptions(withpen pencircle scaled .2pt withcolor .8white) ; draw vlingrid(0, width /unit, 1/10, width, height) ; draw hlingrid(0, height/unit, 1/10, height, width ) ; drawoptions(withpen pencircle scaled .5pt withcolor .4white) ; draw vlingrid(0, width /unit, 1, width, height) ; draw hlingrid(0, height/unit, 1, height, width ) ; draw thetextext.origin("Hello, World!", (1cm, 5cm)) ; StopPage ; \stopMPpage I want to position the text "Hello, World!" such that the vertical coordinate of the text origin is at the baseline, but the output seems to be the same even if I use "thetextext.raw" (note how the output changes if I remove the comma from the text). Also, how would I go about setting the origin on the right side? Kind regards, Stefan ___ 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] About baseline alignment in metapost
To align with the baseline : thetextext.drt("Hello, World!", (1cm, 5cm)) ; Also existing : thetextext.d (center) thetextext.dlft (left) ___ 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: directionpoint gives unexpected point(?)
Hi, I get sometimes the wrong directionpoint. In the example below it works for all values of direx except between 0 and 90. If I put direx to something in this interval, it seems that the point between cs and cl are chosen. Is there a better way to construct the paths not to get this problem? Or some other way out? /Mikael \starttext \startMPpage[offset=3bp] u:=1cm; path cl,cs,rl,p[]; z0 = (0,6/sqrt(3)*u); z1 = z0 rotated 120; cs := (fullcircle scaled 16u) shifted z1; cs := cs cutafter point 1/6 along cs; cl := (fullcircle scaled 4u) shifted z0; cl := cl cutbefore point 1/6 along cl cutafter point 2/6 along cl; p[0] = cs .. cl .. (cs rotated 120) .. (cl rotated 120) .. (cs rotated 240) .. (cl rotated 240) .. cycle; draw p[0]; drawarrow cs withcolor darkblue; drawarrow cl withcolor darkred; direx=300; z11=directionpoint dir(direx) of p[0]; drawarrow ((-u,0)--(u,0)) rotated direx shifted z11; \stopMPpage \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Parenthesis error in metapost
On 4/7/2021 10:14 AM, Mikael Sundqvist wrote: Hi, the following code has been working before: \starttext \startMPpage[instance=decimalfun] draw function(1,"x","x*sin(x)",0.5,1,1/100) scaled 1in; \stopMPpage \stoptext Now (with an updated ConTeXt) I get an error: metapost> loading 'metafun' as 'metafun.mpxl' using method 'decimal' metapost> initializing number mode 'decimal' metafun > log > metafun > log > error: Missing ')' has been inserted metafun > log > metapost> log > metapost> log > ( metapost> log > x*sin( metapost> log >x) metapost> log > metapost> log >) Maybe I have done something wrong earlier, but I cannot see any unmatched parenthesis now. sin is just not defined in decimal mode (in scaled and double they use the math library) .. so i'll fix that 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] Hand Style Sketching in Metapost
I have the following working example with hatching. This works fine, but when I uncomment the sketching commands, no figure is rendered. Is the mp-sketch macro still working? \starttext \startMPcode input hatching; %input mp-sketch; %sketchypaths; %sketch_amount := 2bp; u := 1cm; path circle; circle = fullcircle scaled 4u; hatchfill circle withcolor (45, 5mm, -.5bp); draw circle; \stopMPcode \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] Metapost Animation of Sine
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] Metapost Animation of Sine
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] Metapost Animation of Sine
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] Metapost Animation of Sine
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
Hi, both solutions are great! This is what I had in mind, a rolling sine. Is there a way to get the same result with the Tikz module? \usemodule[animation] \setupinteraction[state=start] \starttext \input tufte \framed{ \startanimation[menu=yes,framerate=40] \dorecurse{50}{\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 } \stoptext Op wo 21 jul. 2021 om 23:26 schreef 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. > > > > >
Re: [NTG-context] Metapost Animation of Sine
Hi Jeroen, Unfortunately I am not familiar with Tikz, since all my documents use what is built-in ConTeXt and Metapost… That being said I am sure someone on the list can help you with Tikz module. Best regards: Otared > On 22 Jul 2021, at 14:28, Jeroen wrote: > > Hi, both solutions are great! This is what I had in mind, a rolling sine. Is > there a way to get the same result with the Tikz module? > > \usemodule[animation] > \setupinteraction[state=start] > > \starttext > > \input tufte > > \framed{ > \startanimation[menu=yes,framerate=40] > \dorecurse{50}{\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 > } > > \stoptext > > Op wo 21 jul. 2021 om 23:26 schreef Otared Kavian <mailto:ota...@gmail.com>>: > 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 > <mailto:context...@gmail.com>> 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 > > > > <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 > <mailto:fabrice.al...@gmail.com>>: > > Hi, > > > >> Le 21 juill. 2021 à 10:08, Jeroen >> <mailto:context...@gmail.com>> 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
[NTG-context] Use MetaPost to distort images?
Hi, is it possible to apply geometric transformations to images using MetaPost? This is again way over my head, but I’m still trying different methods to let a ConTeXt document look more “hand-made”. In my example*, I added frame and shadow to a photo and _distorted_ it slightly to have it look like a postcard was glued on the page (with a piece of tape). I’d like to automate and randomize that process. I guess I could achieve something similar with ImageMagick (not with GraphicsMagick), but if it would be possible inside LMTX that would be great. Hraban *) not small enough for the mailing list; see https://sedna.fiee.net/f/fb532dc85c784147a149/ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] positioning of metapost figure
On 9/12/2021 6:54 PM, Sylvain Hubert via ntg-context wrote: Dear List, The following code draws a circle at the center of the page, ignoring the "shifted" part. \startuniqueMPgraphic{concept} draw fullcircle scaled 1cm shifted (10cm,10cm); \stopuniqueMPgraphic \defineoverlay[concept][\uniqueMPgraphic{concept}] \setupbackgrounds[page][background=concept] \starttext . \stoptext How should the metapost background figure be positioned correctly? \startuniqueMPgraphic{concept} StartPage; draw fullcircle scaled 1cm shifted (10cm,10cm); draw Page withpen pencircle scaled 5mm; StopPage; \stopuniqueMPgraphic - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] positioning of metapost figure
Thanks Hans! On Sun, 12 Sept 2021 at 19:02, Hans Hagen wrote: > On 9/12/2021 6:54 PM, Sylvain Hubert via ntg-context wrote: > > Dear List, > > > > The following code draws a circle at the center of the page, ignoring > > the "shifted" part. > > > > \startuniqueMPgraphic{concept} > > draw fullcircle scaled 1cm shifted (10cm,10cm); > > \stopuniqueMPgraphic > > \defineoverlay[concept][\uniqueMPgraphic{concept}] > > \setupbackgrounds[page][background=concept] > > \starttext > > . > > \stoptext > > > > How should the metapost background figure be positioned correctly? > > \startuniqueMPgraphic{concept} > StartPage; > draw fullcircle scaled 1cm shifted (10cm,10cm); > draw Page withpen pencircle scaled 5mm; > StopPage; > \stopuniqueMPgraphic > > - >Hans Hagen | PRAGMA ADE >Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > - > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Standalone MetaPost Graphics from ConTeXt
Is there a way to output several MetaPost PDF graphics from a single ConTeXt source file. For example, \startMPpage draw fullcircle scaled 72; \stopMPpage \startMPpage draw unitsquare scaled 72; \stopMPpage and have a separate output PDF generated for each MPpage? It seems that this ConTeXt code generates a single PDF which contains only the first graphic. I would like to have either 1) two separate PDF's with each containing their own graphic 2) a single two page PDF where each page corresponds to the appropriate graphic. Of course, the "holy grail" would be to be able to "compile" a MetaPost source file with ConTeXt. Troy Henderson ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
On Sun, 9 Sep 2012, Troy Henderson wrote: When I create animations using MetaPost, I typically do something like for n=1 upto N: beginfig(n); endfig; endfor; and a sequence of figures are created. How can I do this in ConTeXt using \startMPpage ... \stopMPpage? (untested) \dorecurse{10} {\startMPpage label(btex On step \recurselevel etex, origin); \stopMPpage} (There is also \dostepwiserecurse if you need more control). 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
That works great. Now I have defined a global numeric N:=8; in \startMPinclusions ... \stopMPinclusions at the be beginning of my document. All of my \startMPpage ... \stopMPpage environments understand this N, but how do I reference this value as the start value for \dostepwiserecurse? That is, I would like to do something like \dostepwiserecurse{N}{0}{-1}{ ... ... } Troy ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
That works great. Now I have defined a global numeric N:=8; in \startMPinclusions ... \stopMPinclusions at the be beginning of my document. All of my \startMPpage ... \stopMPpage environments understand this N, but how do I reference this value as the start value for \dostepwiserecurse? That is, I would like to do something like \dostepwiserecurse{N}{0}{-1}{ ... ... } For that, you'll need to work on the TeX end. \edef\STEPS{8} \dorecurse\STEPS{} You can either use \STEPS instead of N everywhere in your code (and be careful on how TeX code is parsed, i.e., `a := \STEPS 0` will evaluate to `a := 80`), or use `N := \STEPS;` somewhere in the beginning of each `\MPpage` (the `N :\ \STEPS` can be hidden behind a macro like `\initializeAnimation`). 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
That works great too. One more question now. I would like a particular MetaPost label to contain the value of a variable, say n. I don't want to use label(decimal(n),origin); because I want the label to be a TeX picture instead of a string. That is, I would like to have label(btex n etex,origin); where n is the VALUE of n and not the letter n. Thanks, Troy ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
> > label(decimal(n),origin); > Sorry. I found the answer by wrapping the decimal() inside textext(). That is, label(textext(decimal(n)),origin); does what I want. Troy ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] [NTG-Context] MetaPost capacity exceeded.
! MetaPost capacity exceeded, sorry [expansion depth=1]. I have come across this error previously with run-away \dorecurse loops I now have this message with a document that makes VERY heavy use of MetaPost; I just have too many figures. Is there some way to "flush" the running instance of MetaPost, that is to force MPlib to respawn or something like that? (Of course, I would then have to be careful not to rely on the reuse of any previous MP instances...) Alan ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
Am 25.11.2012 um 18:11 schrieb Marco Patzer : > Hi, > > in one of the last few betas the MetaPost instance > mechanism broke. > > \defineMPinstance > [myinstance] > [metafun] > > \startuseMPgraphic{mympgraphic} > fill fullsquare scaled 1cm withcolor blue; > \stopuseMPgraphic > > \starttext\null > \useMPgraphic{myinstance::mympgraphic} > \stoptext The problem lies in the \uniqueMPgraphic and \useMPgrpahic commands. There is a commented line in each command which is the correct setting and the next line is wrong. \def\meta_unique_page_graphic#1#2% {\meta_begin_graphic_group{#1}% \let\overlaystamp\overlaypagestamp \setupMPvariables[\m_meta_page_prefix:\currentMPgraphicname][#2]% prefix is new here %\getvalue{\??mpgraphic\m_meta_page_prefix:\currentMPgraphicname}{}% \getvalue{\??mpgraphic\m_meta_page_prefix:#1}{}% \meta_end_graphic_group} \def\meta_use_graphic#1#2% {\meta_begin_graphic_group{#1}% \doifsomething{#2}{\setupMPvariables[\currentMPgraphicname][#2]}% %\getvalue{\??mpgraphic\currentMPgraphicname}\empty \getvalue{\??mpgraphic#1}\empty \meta_end_graphic_group} 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
On Sun, 25 Nov 2012, Marco Patzer wrote: Hi, in one of the last few betas the MetaPost instance mechanism broke. \defineMPinstance [myinstance] [metafun] \startuseMPgraphic{mympgraphic} fill fullsquare scaled 1cm withcolor blue; \stopuseMPgraphic \starttext\null \useMPgraphic{myinstance::mympgraphic} \stoptext I am still using the old 2012.11.16 version, but now you have to specify the instance in the \startuseMPgraphic as well (Hans had announced this on the mailing list a few weeks ago): \startuseMPgraphic{instance::mygraphic} ... \stopuseMPgraphic 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
2012-11-25 Aditya Mahajan: > I am still using the old 2012.11.16 version, but now you have to specify > the instance in the \startuseMPgraphic as well (Hans had announced this > on the mailing list a few weeks ago): I missed that. > \startuseMPgraphic{instance::mygraphic} > ... > \stopuseMPgraphic This works. Thanks to both of you, Wolfgang and Aditya. Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
Aditya wrote: > I am still using the old 2012.11.16 version, but now you have to specify > the instance in the \startuseMPgraphic as well (Hans had announced this > on the mailing list a few weeks ago): > \startuseMPgraphic{instance::mygraphic} > ... > \stopuseMPgraphic Since I don't use MetaPost, I don't think I'm the best person to document this. But I took this as an opportunity to create the command reference pages for a bunch of the \...MP... commands; perhaps one of you could add this info to the proper page(s)? E.g. at http://wiki.contextgarden.net/Command/startuseMPgraphic There is an overview of the new stubs at http://wiki.contextgarden.net/Template:MetaPost_see_also Also: a question about \startuseMPgraphic and \startuniqueMPgraphic. Both are supposed to be recompiled at every usage, so how are they different? Actually trying it out suggests that useMPgraphic is the only one of the two that re-evaluates its code every time; compare the examples at * http://wiki.contextgarden.net/Command/startuseMPgraphic and * http://wiki.contextgarden.net/Command/startuniqueMPgraphic But then \startuniqueMPgraphic would be the same as \startreuseMPgraphic, so I think I'm still missing something. Cheers, Sietse ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
2012-11-26 Sietse Brouwer: > Since I don't use MetaPost, I don't think I'm the best person to > document this. But I took this as an opportunity to create the command > reference pages for a bunch of the \...MP... commands; perhaps one of > you could add this info to the proper page(s)? Thanks. I added some info about the change mentioned in this thread. > Also: a question about > \startuseMPgraphic and > \startuniqueMPgraphic. > Both are supposed to be recompiled at every usage, so how are they > different? Actually trying it out suggests that useMPgraphic is the > only one of the two that re-evaluates its code every time; compare the > examples at AFAIK useMPgraphic is always recalculated, reusableMPgraphic never is. uniqueMPgraphic takes the size into account and recalculates if the graphic dimensions change. If I recall correctly this is mentioned somewhere in the MetaFun manual. But I agree, all these commands for including MP graphics are confusing, given the fact that one can survive pretty well with only useMPgraphic. I attached a small example to show the difference. Marco \startuseMPgraphic{alpha} fill unitsquare xyscaled (\overlaywidth, \overlayheight) withcolor (uniformdeviate 1, uniformdeviate 1, uniformdeviate 1); \stopuseMPgraphic \defineoverlay [alpha] [\useMPgraphic{alpha}] \startreusableMPgraphic{beta} fill unitsquare xyscaled (\overlaywidth, \overlayheight) withcolor (uniformdeviate 1, uniformdeviate 1, uniformdeviate 1); \stopreusableMPgraphic \defineoverlay [beta] [\reuseMPgraphic{beta}] \startuniqueMPgraphic{gamma} fill unitsquare xyscaled (\overlaywidth, \overlayheight) withcolor (uniformdeviate 1, uniformdeviate 1, uniformdeviate 1); \stopuniqueMPgraphic \defineoverlay [gamma] [\uniqueMPgraphic{gamma}] \starttext \dontleavehmode \framed[background=alpha]{foo} \framed[background=alpha]{foo} \framed[background=alpha]{foobar} \dontleavehmode \framed[background=beta]{foo} \framed[background=beta]{foo} \framed[background=beta]{foobar} \dontleavehmode \framed[background=gamma]{foo} \framed[background=gamma]{foo} \framed[background=gamma]{foobar} \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
On Mon, 26 Nov 2012, Marco Patzer wrote: 2012-11-26 Sietse Brouwer: Since I don't use MetaPost, I don't think I'm the best person to document this. But I took this as an opportunity to create the command reference pages for a bunch of the \...MP... commands; perhaps one of you could add this info to the proper page(s)? Thanks. I added some info about the change mentioned in this thread. Also: a question about \startuseMPgraphic and \startuniqueMPgraphic. Both are supposed to be recompiled at every usage, so how are they different? Actually trying it out suggests that useMPgraphic is the only one of the two that re-evaluates its code every time; compare the examples at AFAIK useMPgraphic is always recalculated, reusableMPgraphic never is. uniqueMPgraphic takes the size into account and recalculates if the graphic dimensions change. If I recall correctly this is mentioned somewhere in the MetaFun manual. But I agree, all these commands for including MP graphics are confusing, given the fact that one can survive pretty well with only useMPgraphic. I attached a small example to show the difference. The distinction was more important in MkII when extra runs for different MP graphics could take a lot of time. But it MkIV, the difference in performance is, I believe, inconsequential. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
On 11/26/2012 5:10 PM, Marco Patzer wrote: 2012-11-26 Sietse Brouwer: Since I don't use MetaPost, I don't think I'm the best person to document this. But I took this as an opportunity to create the command reference pages for a bunch of the \...MP... commands; perhaps one of you could add this info to the proper page(s)? Thanks. I added some info about the change mentioned in this thread. Also: a question about \startuseMPgraphic and \startuniqueMPgraphic. Both are supposed to be recompiled at every usage, so how are they different? Actually trying it out suggests that useMPgraphic is the only one of the two that re-evaluates its code every time; compare the examples at AFAIK useMPgraphic is always recalculated, reusableMPgraphic never is. uniqueMPgraphic takes the size into account and recalculates if the graphic dimensions change. If I recall correctly this is Can be more than dimensions. This is the default hash: \def\overlaystamp {\overlaywidth :% \overlayheight:% \overlaydepth :% \MPcolor\overlaycolor:% \MPcolor\overlaylinecolor} so: width, height, depth, background color, line color but is one says \startuniqueMPgraphic{mygraphic}{linewidth,.} given that linewidth is set, those values are also taken into account mentioned somewhere in the MetaFun manual. But I agree, all these commands for including MP graphics are confusing, given the fact that one can survive pretty well with only useMPgraphic. I attached a small example to show the difference. It does make a difference when you have documents with thousands of graphics (mkiv is much faster btw) and the pdf file is also smaller when reuse is applied Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
On 2012–11–25 Marco Patzer wrote: > in one of the last few betas the MetaPost instance > mechanism broke. Did the interface change again? The following does not work on today's beta, only “alpha” and “gamma” are printed. \defineMPinstance [myinstance] [metafun] \startuseMPgraphic{alpha} draw textext("alpha") ; \stopuseMPgraphic \startuseMPgraphic{myinstance::beta} draw textext("beta") ; \stopuseMPgraphic \starttext \useMPgraphic{alpha} \useMPgraphic{myinstance::beta} \startMPcode{myinstance} draw textext("gamma") ; \stopMPcode \stoptext Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost instance mechanism broken
On 12/6/2012 8:10 PM, Marco Patzer wrote: On 2012–11–25 Marco Patzer wrote: in one of the last few betas the MetaPost instance mechanism broke. Did the interface change again? The following does not work on today's beta, only “alpha” and “gamma” are printed. \defineMPinstance [myinstance] [metafun] \startuseMPgraphic{alpha} draw textext("alpha") ; \stopuseMPgraphic \startuseMPgraphic{myinstance::beta} draw textext("beta") ; \stopuseMPgraphic \starttext \useMPgraphic{alpha} \useMPgraphic{myinstance::beta} \startMPcode{myinstance} draw textext("gamma") ; \stopMPcode \stoptext sure, we have a different interface on odd days Currently instances are played with a bit (as Alan and I want the chemical module to run in its own but also want it to be public). Anyhow, one complication is in the related variables. I now have a version that supports this: \defineMPinstance [myinstance] [metafun] \startuseMPgraphic{alpha} draw textext("alpha") ; \stopuseMPgraphic \startuseMPgraphic{myinstance::beta} draw textext("beta") ; \stopuseMPgraphic \startuniqueMPgraphic{myinstance::beta}{width} draw textext("beta") xsized \MPvar{width} ; \stopuniqueMPgraphic \startuseMPgraphic{myinstance::epsilon}{width,height} draw textext("epsilon") xysized (\MPvar{width},\MPvar{height}) ; \stopuseMPgraphic \setMPvariables [myinstance::beta] [width=5cm] \setMPvariables [epsilon] [width=5cm, height=5cm] \starttext one : \useMPgraphic{alpha} \blank two : \useMPgraphic{myinstance::beta} \blank three : \startMPcode{myinstance} draw textext("gamma") ; \stopMPcode \blank four : \reuseMPgraphic{myinstance::beta}{width=2cm} \blank five : \startMPcode{myinstance} draw textext("delta") ; \stopMPcode \blank six : \reuseMPgraphic{myinstance::epsilon}{height=2cm} \blank seven : \reuseMPgraphic{myinstance::epsilon} \blank \stoptext Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] fontsize drawing in metapost
On 2013–05–06 Meer, H. van der wrote: > What is the simplest way to change the size of fonts in labels drawn in > MetaPost? Probably a font switch directly in the label: label("\small foobar", origin); > \switchtobodyfont[size] can be done in \startMPenvironment and inside each > label. Better use setupMPinstance: \setupMPinstance [metafun] [textstyle=\small] Marco signature.asc Description: Digital signature ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] fontsize drawing in metapost
This is but a partial solution in my case, for two reasons: 1. \textstyle=\small gives few control, I tried textstyle=5pt without result 2. the setup cannot be placed inside \startuseMPgraphic, where I need it most. I skimmed through meta-ini.mkiv, but did not find a solution. It is however quite possible things cannot be done other than by putting a fontchange inside each label. Hans van der Meer On 6 May 2013, at 6:04 PM, Marco Patzer wrote: > On 2013–05–06 Meer, H. van der wrote: > >> What is the simplest way to change the size of fonts in labels drawn in >> MetaPost? > > Probably a font switch directly in the label: > > label("\small foobar", origin); > >> \switchtobodyfont[size] can be done in \startMPenvironment and inside each >> label. > > Better use setupMPinstance: > > \setupMPinstance >[metafun] >[textstyle=\small] > > Marco > __ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] fontsize drawing in metapost
I did some further experimentation, hoping using dimexp calculations would help. But either I am doing somthing wrong or I do not understand the innards of bodyfont switching well enough. The example program seems to have accessed a 30 pt font (see the log file) but did not typeset in it, the dimexpr does evaluates to 30 pt. Where am I at fault? Hans van der Meer \setuppapersize[A6][A6] \setupbodyfont[10pt] \starttext 10pt\ \begingroup\switchtobodyfont[20pt]20pt\endgroup\ 10pt\par \writestatus{==}{} 10pt\ \begingroup\switchtobodyfont[\the\dimexpr(3\bodyfontsize)] times 3\endgroup\ 10pt\par dimexpr=\the\dimexpr(3\bodyfontsize)\par \stoptext fonts > 'fallback modern rm 10pt' is loaded fonts > bodyfont '20pt' is defined (can better be done global) fonts > bodyfont '24pt' is defined (can better be done global) fonts > bodyfont '16pt' is defined (can better be done global) == > fonts > bodyfont '30.0pt' is defined (can better be done global) fonts > bodyfont '36pt' is defined (can better be done global) fonts > bodyfont '24pt' is defined (can better be done global) fonts > bodyfont '30.0pt' is defined (can better be done global) fonts > bodyfont '30.0pt' is not defined On 6 May 2013, at 8:57 PM, "Meer, H. van der" mailto:h.vanderm...@uva.nl>> wrote: This is but a partial solution in my case, for two reasons: 1. \textstyle=\small gives few control, I tried textstyle=5pt without result 2. the setup cannot be placed inside \startuseMPgraphic, where I need it most. I skimmed through meta-ini.mkiv, but did not find a solution. It is however quite possible things cannot be done other than by putting a fontchange inside each label. Hans van der Meer On 6 May 2013, at 6:04 PM, Marco Patzer mailto:home...@lavabit.com>> wrote: On 2013–05–06 Meer, H. van der wrote: What is the simplest way to change the size of fonts in labels drawn in MetaPost? Probably a font switch directly in the label: label("\small foobar", origin); \switchtobodyfont[size] can be done in \startMPenvironment and inside each label. Better use setupMPinstance: \setupMPinstance [metafun] [textstyle=\small] Marco _ dimexpr.pdf Description: dimexpr.pdf ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] fontsize drawing in metapost
The reason behind starting this thread was the fact that I want my \useMPgraphic's arbitrarily (and perfectly) scaled. In Metapost/Metafun that is easily done through a \MPvar{scale} variable, applied to the main dimensions on which all measures in my figures depend. But for the fontsizes this turned out to be not so easy. Understandable, because text is typeset at the TeX-end not inside the Metapost. Perhaps a better and possibly more elegant way seems the following route. When I turn Metapost figures into external pdf-files, these can be placed with \useexternalfigure and the scaled as a whole, drawing and text alike. My question is: can this be done without resorting to an external pdf? That is, can I pick up the result of \useMPgraphic somewhere, then put this in \useexternalfigure and apply everything possible there to the figure. Does someone know how to? Hans van der Meer ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] fontsize drawing in metapost
On 2013–05–07 Meer, H. van der wrote: > Perhaps a better and possibly more elegant way seems the following > route. When I turn Metapost figures into external pdf-files, these > can be placed with \useexternalfigure and the scaled as a whole, > drawing and text alike. My question is: can this be done without > resorting to an external pdf? That is, can I pick up the result of > \useMPgraphic somewhere, then put this in \useexternalfigure and > apply everything possible there to the figure. You could use \scale : \startuseMPgraphic{foo} fill unitcircle scaled 1cm; label("Foo", origin); \stopuseMPgraphic \starttext \useMPgraphic{foo} \scale[width=3cm]{\useMPgraphic{foo}} \scale[width=3cm,height=5cm] {\useMPgraphic{foo}} \scale[scale=2500] {\useMPgraphic{foo}} \stoptext Marco signature.asc Description: Digital signature ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] fontsize drawing in metapost
Thanks. This is exactly what is needed. I feel myself somewhat silly, because I did try \scale, but with the wrong parameter setup; nothing happened then, of course. Now I know to do it right! Hans van der Meer On 7 May 2013, at 9:35 AM, Marco Patzer wrote: > On 2013–05–07 Meer, H. van der wrote: > >> Perhaps a better and possibly more elegant way seems the following >> route. When I turn Metapost figures into external pdf-files, these >> can be placed with \useexternalfigure and the scaled as a whole, >> drawing and text alike. My question is: can this be done without >> resorting to an external pdf? That is, can I pick up the result of >> \useMPgraphic somewhere, then put this in \useexternalfigure and >> apply everything possible there to the figure. > > You could use \scale : > > \startuseMPgraphic{foo} > fill unitcircle scaled 1cm; > label("Foo", origin); > \stopuseMPgraphic > > \starttext >\useMPgraphic{foo} > \scale[width=3cm]{\useMPgraphic{foo}} > \scale[width=3cm,height=5cm] {\useMPgraphic{foo}} > \scale[scale=2500] {\useMPgraphic{foo}} > \stoptext > > Marco > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost label direction prefix
On 8/23/2013 11:42 AM, Marco Patzer wrote: Hi, what is the reason the label direction prefix variables (rt, bot, llft, etc.) are prefixed with mpfun_ in MkIV (mp-mlib.mpiv)? When new directional prefixes are being defined it fails when mplib is used unless the mpfun_ prefix is added. And likewise, code using the mpfun_ prefix fails on traditional MetaPost. So is anyone using mkiv still using MkII? Is this prefix required? It breaks old code and required a branch in every new project. And I don't really see a reason for this incompatibility. Here is an example defining a new direction “foo”: The MpIV code has namespace protection. Why run traditional in MkIV? \starttext \startMPcode label("first", origin); %% MkIV %% pair mfun_laboff.foo ; mfun_laboff.foo := (.5,-1) ; %% mfun_labxf.foo := mfun_labyf.foo := 1 ; %% MkII pair laboff.foo ; laboff.foo := (.5,-1) ; labxf.foo := labyf.foo := 1 ; label.foo("second", origin); \stopMPcode \stoptext I wasn't aware of users defining extra ones. I'll add this: \starttext \startMPcode label("first", origin); if known mfun_laboff : vardef installlabel@\# (expr type, x, y, offset) = numeric mfun_labtype @\# ; mfun_labtype @\# := type ; pairmfun_laboff @\# ; mfun_laboff @\# := offset ; numeric mfun_labxf @\# ; mfun_labxf @\# := x ; numeric mfun_labyf @\# ; mfun_labyf @\# := y ; enddef ; else : vardef installlabel@\# (expr type, x, y, offset) = numeric labtype @\# ; labtype @\# := type ; pairlaboff @\# ; laboff @\# := offset ; numeric labxf @\# ; labxf @\# := x ; numeric labyf @\# ; labyf @\# := y ; enddef ; fi ; installlabel.foo ( 0, 1, 1, (.5,-1) ) ; label.foo("second", origin); \stopMPcode \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost label direction prefix
On 2013–08–23 Hans Hagen wrote: > >Is this prefix required? It breaks old code and required a branch in > >every new project. And I don't really see a reason for this > >incompatibility. Here is an example defining a new direction “foo”: > > The MpIV code has namespace protection. Why run traditional in MkIV? > > > >\starttext > > \startMPcode > > label("first", origin); > > > > %% MkIV > > %% pair mfun_laboff.foo ; mfun_laboff.foo := (.5,-1) ; > > %% mfun_labxf.foo := mfun_labyf.foo := 1 ; > > > > %% MkII > > pair laboff.foo ; laboff.foo := (.5,-1) ; > > labxf.foo := labyf.foo := 1 ; > > > > label.foo("second", origin); > > \stopMPcode > >\stoptext > > I wasn't aware of users defining extra ones. I'll add this: Probably not many users will tinker with custom label directions, but MetaPost package authors do. Some packages like piechartmp¹ internally use laboff.foo and the mpfun_ prefix breaks those packages. They work in traditional MetaPost, plain TeX, LaTeX and ConTeXt MkII, but since mplib uses the mpfun_ prefix, those packages are broken in MkIV. > […] > installlabel.foo ( 0, 1, 1, (.5,-1) ) ; This does not fix the problem since it only *defines* the correct variant, it doesn't help *using* those values. If the label values are being changed in the package one still has to branch out to support both variants. And even if there was an abstraction assisting to *use* the laboff values, all MetaPost packages tinkering with laboff would need to be adjusted. I can't imagine that to happen. Here's what the piechartmp package is doing, for instance: if laboff.@# = (-3,-3): % auto justification […] laboff.auto := ((cosd l),(sind l)) ; labxf.auto := ((cosd l) - 1) / -2 ; labyf.auto := ((sind l) - 1) / -2 ; […] This code is being executed every time a label is typeset. Marco ¹ http://mirrors.ctan.org/graphics/metapost/contrib/macros/piechartmp/piechartmp.mp signature.asc Description: Digital signature ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost label direction prefix
On 8/23/2013 3:14 PM, Marco Patzer wrote: On 2013–08–23 Hans Hagen wrote: Is this prefix required? It breaks old code and required a branch in every new project. And I don't really see a reason for this incompatibility. Here is an example defining a new direction “foo”: The MpIV code has namespace protection. Why run traditional in MkIV? \starttext \startMPcode label("first", origin); %% MkIV %% pair mfun_laboff.foo ; mfun_laboff.foo := (.5,-1) ; %% mfun_labxf.foo := mfun_labyf.foo := 1 ; %% MkII pair laboff.foo ; laboff.foo := (.5,-1) ; labxf.foo := labyf.foo := 1 ; label.foo("second", origin); \stopMPcode \stoptext I wasn't aware of users defining extra ones. I'll add this: Probably not many users will tinker with custom label directions, but MetaPost package authors do. Some packages like piechartmp¹ internally use laboff.foo and the mpfun_ prefix breaks those packages. They work in traditional MetaPost, plain TeX, LaTeX and ConTeXt MkII, but since mplib uses the mpfun_ prefix, those packages are broken in MkIV. that kind of tinkering can also result in overloading context 'extensions' […] installlabel.foo ( 0, 1, 1, (.5,-1) ) ; This does not fix the problem since it only *defines* the correct variant, it doesn't help *using* those values. If the label values are being changed in the package one still has to branch out to support both variants. And even if there was an abstraction assisting to *use* the laboff values, all MetaPost packages tinkering with laboff would need to be adjusted. I can't imagine that to happen. Here's what the piechartmp package is doing, for instance: I'll provide: \starttext \startMPcode startplaincompatibity ; label("first", origin); pair laboff.foo ; laboff.foo := (.5,-1) ; labxf.foo := labyf.foo := 1 ; label.foo("second", origin); stopplaincompatibity ; \stopMPcode \stoptext As I wouldn't be surprised if there were more differences we need to handle. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost label direction prefix
On 2013–08–24 Hans Hagen wrote: > startplaincompatibity ; > > label("first", origin); > > pair laboff.foo ; laboff.foo := (.5,-1) ; > labxf.foo := labyf.foo := 1 ; > > label.foo("second", origin); > > stopplaincompatibity ; Brilliant! Thanks a lot. A few things: 1) Can you replace def useplainlabels = let label= plain_label ; let thelabel = plain_thelabel ; enddef ; with def useplainlabels = def label= plain_labelenddef ; def thelabel = plain_thelabel enddef ; enddef ; The minimal example works with your version, but the old MetaPost code does not. The def variant works fine with both. 2) Replace startplaincompatibity → startplaincompatibility stopplaincompatibity → stopplaincompatibility 3) This one is truly optional and just a suggestion for a better interface. Although it's nice to have the grouping in start-stopplaincompatibility, it's not required here, since the entire MetaPost instance runs in plain compatibility mode. It would be nice to either have a non-grouped command: def plaincompatibility = scantokens plain_compatibity_data ; enddef ; Or maybe even a higher-level switch: \defineMPinstance [fun-with-old-MP] [metafun] [compatibility=plain] %% default* | plain > As I wouldn't be surprised if there were more differences we need > to handle. We will find out if things break. Marco signature.asc Description: Digital signature ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost label direction prefix
On 8/24/2013 2:31 PM, Marco Patzer wrote: On 2013–08–24 Hans Hagen wrote: startplaincompatibity ; label("first", origin); pair laboff.foo ; laboff.foo := (.5,-1) ; labxf.foo := labyf.foo := 1 ; label.foo("second", origin); stopplaincompatibity ; Brilliant! Thanks a lot. A few things: 1) Can you replace def useplainlabels = let label= plain_label ; let thelabel = plain_thelabel ; enddef ; with def useplainlabels = def label= plain_labelenddef ; def thelabel = plain_thelabel enddef ; enddef ; The minimal example works with your version, but the old MetaPost code does not. The def variant works fine with both. ok 2) Replace startplaincompatibity → startplaincompatibility stopplaincompatibity → stopplaincompatibility ok, best check the next beta well (i might have missed some) 3) This one is truly optional and just a suggestion for a better interface. Although it's nice to have the grouping in start-stopplaincompatibility, it's not required here, since the entire MetaPost instance runs in plain compatibility mode. It would be nice to either have a non-grouped command: def plaincompatibility = scantokens plain_compatibity_data ; enddef ; due to the way grouping works in mp it doesn't hurt to have it and by using it we can avoid a push/pop stack after all in the end we want to go back to the metafun labels Or maybe even a higher-level switch: \defineMPinstance [fun-with-old-MP] [metafun] [compatibility=plain] %% default* | plain As I wouldn't be surprised if there were more differences we need to handle. maybe later We will find out if things break. indeed Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] functions and paths in metapost
Hello all, Is it possible to define a path in metapost-metafun using "function"? In the metafun manual (chapter on Functions) the examples shown are all of the type "draw function ...". I wonder if it is possible to define a path with a function ("picture" after draw doesn't allow that afaik)? tia, (mkiv) -- Jean ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Multi-line labels in MetaPost
Hello, Is it possible to generate multi-line labels in MetaPost? I have naively tried the following hoping to get a line feed between the two words, but it doesn't work! label.rt( btex One \crlf Two etex, (0,0)); Thanks, Richard Converteam UK Ltd. Registration Number: 5571739 and Converteam Ltd. Registration Number: 2416188 Registered in England and Wales. Registered office: Boughton Road, Rugby, Warwickshire, CV21 1BU. CONFIDENTIALITY : This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium. Please consider the environment before printing this e-mail ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Using MetaPost to create fonts
Hi! I have the impression that I did see that MetaPost can be used to create full fonts and not only pictures. (In fact to keep the potential of METAFONT, but extending it to OpenType /PostScript/TrueType (??) fonts.) I even think there was mention about Perl in this respect. Did I dream or not (yes I start to dream about ConTeXt and MetaPost !!!). Could you point me to the right direction and provide links and/or email address of the persons who are involved? Thanks, -- Alain ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost+mpgraph and mkiv
Alan BRASLAU wrote: mpgraph does not appear to work properly under mkiv. The reason why is explained here: http://wiki.contextgarden.net/MkIV_Differences#Metapost Best wishes, Taco ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost+mpgraph and mkiv
On Saturday 07 November 2009 17:21:04 Taco Hoekwater wrote: > > 1. You should load the MP packages you need in \startMPinclusions (this > is where the code really belongs, even in mkii) instead of inside each > separate graphic. > > 2. You have to make sure that you do not re-state equations that were > already solved in a previous graphic. > > These are in fact the excact same rules that you have to adhere to in > mkii if \runMPgraphicsfalse is active. So, for the mailing list, here is a working solution (mkii & mkiv): %% minimal example %% \starttext \startMPinclusions input graph \stopMPinclusions \startuseMPgraphic{test} draw begingraph(16cm,12cm); setrange(whatever,whatever,whatever,whatever); gdraw (0,0) -- (1,1) ; endgraph; \stopuseMPgraphic \startTEXpage \useMPgraphic{test} \stopTEXpage \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost+mpgraph and mkiv
Am 07.11.2009 um 18:58 schrieb Alan BRASLAU: So, for the mailing list, here is a working solution (mkii & mkiv): %% minimal example %% \starttext \startMPinclusions input graph \stopMPinclusions \usemodule[graph] 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost+mpgraph and mkiv
On Saturday 07 November 2009 19:00:13 Wolfgang Schuster wrote: > > \usemodule[graph] > Thanks! This works in mkiv (but appears to be broken in mkii). Alan ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost integration: default parameters
On Fri, Nov 13, 2009 at 17:53, Oliver Buerschaper wrote: > > Also, is there a way to directly get the glyph outlines of, say, > $\bigotimes$ in MetaPost code and use it to derive some length unit from it? Yes, but this only works for Type1 fonts, not for OpenType. The example below is a literal copy from metapost manual (created by Taco). You first search in the source for that glyph: \definemathsymbol [bigotimes] [op] [ex] ["4E] % this equals 78 in decimal notation and then you need either name or number of glyph + name of font. fontmapfile "=lm-math.map"; beginfig(1); picture q; path p; interim ahlength := 12bp; interim ahangle := 25; q := glyph 78 of "lmex10" scaled .2; % q := glyph "circlemultiplytext" of "lmex10" scaled .2; % cheat by looking at lm-mathex.enc for item within q: p := pathpart item; drawarrow p withcolor (.6,.9,.6) withpen pencircle scaled 1.5; for j=0 upto length p: pickup pencircle scaled .7; draw (point j of p -- precontrol j of p) dashed evenly withcolor blue; draw (point j of p -- postcontrol j of p) dashed evenly withcolor blue; pickup pencircle scaled 3; draw precontrol j of p withcolor red; draw postcontrol j of p withcolor red; pickup pencircle scaled 2; draw point j of p withcolor black; endfor endfor endfig; end. Mojca ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost integration: default parameters
Hi Mojca, >> Also, is there a way to directly get the glyph outlines of, say, >> $\bigotimes$ in MetaPost code and use it to derive some length unit from it? > > Yes, but this only works for Type1 fonts, not for OpenType. > > The example below is a literal copy from metapost manual (created by Taco). This is quite impressive! This will make it much easier for me to obtain the right dimensions… Now if only this worked with OpenType as well (or any other font format ConTeXt understands natively)… and it would be really great if direct access to outlines extended to arbitrary typeset material beyond single glyphs. I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does this still work with MkIV? Oliver ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost integration: default parameters
On Sun, Nov 22, 2009 at 16:53, Oliver Buerschaper wrote: > > I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does > this still work with MkIV? If you manage to extend dvips to handle OpenType fonts then maybe ... Mojca ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost integration: default parameters
>> I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does >> this still work with MkIV? > > If you manage to extend dvips to handle OpenType fonts then maybe ... So does this mean that outline fonts in MetaPost are currently dead with MkIV? Oliver ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost integration: default parameters
On Sun, Nov 22, 2009 at 8:16 PM, Oliver Buerschaper wrote: >>> I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does >>> this still work with MkIV? >> >> If you manage to extend dvips to handle OpenType fonts then maybe ... > > So does this mean that outline fonts in MetaPost are currently dead with MkIV? %%test-outlined.tex \starttext \startTEXpage \startuseMPgraphic{a} graphictext "\bf Fun" scaled 4 zscaled (1,1.5) withdrawcolor blue withfillcolor .5white withpen pencircle scaled 5pt \stopuseMPgraphic \useMPgraphic{a} \stopTEXpage \stoptext #context test-outlined works ok here -- luigi <>___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost integration: default parameters
Am 22.11.2009 um 21:15 schrieb luigi scarso: > %%test-outlined.tex > \starttext > \startTEXpage > \startuseMPgraphic{a} > graphictext "\bf Fun" scaled 4 zscaled (1,1.5) > withdrawcolor blue > withfillcolor .5white > withpen pencircle scaled 5pt > \stopuseMPgraphic > \useMPgraphic{a} > \stopTEXpage > \stoptext \starttext {\blue\tfd Fun\llap{\red\property[outer]{\tfd Fun}}} \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost integration: default parameters
On Sun, Nov 22, 2009 at 9:33 PM, Wolfgang Schuster wrote: > > Am 22.11.2009 um 21:15 schrieb luigi scarso: > >> %%test-outlined.tex >> \starttext >> \startTEXpage >> \startuseMPgraphic{a} >> graphictext "\bf Fun" scaled 4 zscaled (1,1.5) >> withdrawcolor blue >> withfillcolor .5white >> withpen pencircle scaled 5pt >> \stopuseMPgraphic >> \useMPgraphic{a} >> \stopTEXpage >> \stoptext > > \starttext > {\blue\tfd Fun\llap{\red\property[outer]{\tfd Fun}}} > \stoptext Also from metapost manual \starttext \startTEXpage \startuseMPgraphic{a} fontmapfile "=lm-ec.map"; picture q; path p; interim ahlength := 12bp; interim ahangle := 25; q := glyph "Dcaron" of "ec-lmr10" scaled .2; for item within q: p := pathpart item; drawarrow p withcolor (.6,.9,.6) withpen pencircle scaled 1.5; for j=0 upto length p: pickup pencircle scaled .7; draw (point j of p -- precontrol j of p) dashed evenly withcolor blue; draw (point j of p -- postcontrol j of p) dashed evenly withcolor blue; pickup pencircle scaled 3; draw precontrol j of p withcolor red; draw postcontrol j of p withcolor red; pickup pencircle scaled 2; draw point j of p withcolor black; endfor endfor \stopuseMPgraphic \useMPgraphic{a} \stopTEXpage \stoptext -- luigi <>___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___