Re: [NTG-context] MetaPost Question
I guess the code I am looking for is the below to hatch the cut-out section. How can I load the MetaPost hatching package in Context minimals so it understands the hatchfill command? Thanks Jeroen \startMPinclusions input hatching; \stopMPinclusions \starttext \placefigure[here,force][fig:tubing]{Tubular Linear Volumetric Capacity} {\startMPcode % inner circle draw fullcircle xscaled 2.5cm yscaled 0.7cm shifted (1.25cm,0); draw (0,0) -- (0,-5cm) dashed evenly; draw (2.5cm,0) -- (2.5cm,-5cm) dashed evenly; draw fullcircle xscaled 2.5cm yscaled 0.7cm shifted (1.25cm,-5cm) dashed evenly; %outer circle draw fullcircle xscaled 2.9cm yscaled 1cm shifted (1.25cm,0); draw (-.2cm,0) -- (-.2cm,-5cm); draw (2.7cm,0) -- (2.7cm,-5cm); draw halfcircle scaled 2.9cm yscaled 0.012cm shifted (1.25cm,-5cm) dashed evenly; draw halfcircle scaled 2.9cm yscaled 0.012cm rotated 180 shifted (1.25cm,-5cm); %cut-out section hatchfill circle withcolor (45, 5mm, -.5bp); fill fullcircle xscaled 2.5cm yscaled 0.7cm shifted (1.25cm,-2.7cm) withcolor (.6,.6,.6); label.top("tubular",(1.26cm,-1.3cm)); label.top("inside area",(1.28cm,-1.8cm)); label.top("($in^2$)",(1.28cm,-2.4cm)); %arrows and label ID drawarrow (0,-4.1cm) -- (2.5cm,-4.1cm); drawarrow (2.5cm,-4.1cm) -- (0,-4.1cm); label.top("ID ($in$)",(1.26cm,-4.15cm)); %arrows and label tubular length draw (3.25cm,-5cm) -- (3.25cm,0); drawarrow (3.25cm,-5) -- (3.25cm,0); drawarrow (3.25cm,0) -- (3.25cm,-5cm); label.top("tubular length ($in$)",(5.2cm,-2.75cm)); \stopMPcode} \stoptext 2015-12-06 21:54 GMT+01:00 Context NTG: > I am trying to graph a cylinder. Is there a way to draw a more elliptic > top/bottom. This one seems some flattened at the top and bottom. I would > like to hatch the mid elliptic that is collored grey now. Is there a way to > do this. > > Thanks > Jeroen > > > > \placefigure > > [here,force] > > [fig:tubing] > > {Tubular Linear Volumetric Capacity} > > {\startMPcode > > > draw (0,0){up} ... (1.25cm, 2mm) ... (2.5cm,0){down} ... (1.25cm, -2mm) > ... cycle; > > draw (0,0) -- (0,-5cm) dashed evenly; > > draw (2.5cm,0) -- (2.5cm,-5cm) dashed evenly; > > draw (0,-5cm){up} ... (1.25cm, -4.8cm) ... (2.5cm,-5cm){down} ... (1.25cm, > -5.2cm) ... cycle dashed evenly; > > > draw (-.2cm,0){up} ... (1.25cm, 3.5mm) ... (2.7cm,0){down} ... (1.25cm, > -3.5mm) ... cycle; > > draw (-.2cm,0) -- (-.2cm,-5cm); > > draw (2.7cm,0) -- (2.7cm,-5cm); > > draw (-.2cm,-5cm){up} ... (1.25cm, -4.7cm) ... (2.7cm,-5cm){down} dashed > evenly; > > draw (-.2cm,-5cm){down} ... (1.25cm, -5.3cm) ... (2.7cm,-5cm){up}; > > > fill (0,-2.5cm){up} ... (1.25cm, -2.3cm) ... (2.5cm,-2.5cm){down} ... > (1.25cm, -2.7cm) ... cycle withcolor (.6,.6,.6) dashed evenly; > > label.top("tubular",(1.26cm,-1.1cm)); > > label.top("inside area",(1.28cm,-1.6cm)); > > label.top("($in^2$)",(1.28cm,-2.2cm)); > > > draw (3.25cm,-5cm) -- (3.25cm,0); > > drawarrow (3.25cm,-5) -- (3.25cm,0); > > drawarrow (3.25cm,0) -- (3.25cm,-5cm); > > label.top("tubular length ($in$)",(5.2cm,-2.75cm)); > > > \stopMPcode} > ___ 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 Question
I am trying to graph a cylinder. Is there a way to draw a more elliptic top/bottom. This one seems some flattened at the top and bottom. I would like to hatch the mid elliptic that is collored grey now. Is there a way to do this. Thanks Jeroen \placefigure [here,force] [fig:tubing] {Tubular Linear Volumetric Capacity} {\startMPcode draw (0,0){up} ... (1.25cm, 2mm) ... (2.5cm,0){down} ... (1.25cm, -2mm) ... cycle; draw (0,0) -- (0,-5cm) dashed evenly; draw (2.5cm,0) -- (2.5cm,-5cm) dashed evenly; draw (0,-5cm){up} ... (1.25cm, -4.8cm) ... (2.5cm,-5cm){down} ... (1.25cm, -5.2cm) ... cycle dashed evenly; draw (-.2cm,0){up} ... (1.25cm, 3.5mm) ... (2.7cm,0){down} ... (1.25cm, -3.5mm) ... cycle; draw (-.2cm,0) -- (-.2cm,-5cm); draw (2.7cm,0) -- (2.7cm,-5cm); draw (-.2cm,-5cm){up} ... (1.25cm, -4.7cm) ... (2.7cm,-5cm){down} dashed evenly; draw (-.2cm,-5cm){down} ... (1.25cm, -5.3cm) ... (2.7cm,-5cm){up}; fill (0,-2.5cm){up} ... (1.25cm, -2.3cm) ... (2.5cm,-2.5cm){down} ... (1.25cm, -2.7cm) ... cycle withcolor (.6,.6,.6) dashed evenly; label.top("tubular",(1.26cm,-1.1cm)); label.top("inside area",(1.28cm,-1.6cm)); label.top("($in^2$)",(1.28cm,-2.2cm)); draw (3.25cm,-5cm) -- (3.25cm,0); drawarrow (3.25cm,-5) -- (3.25cm,0); drawarrow (3.25cm,0) -- (3.25cm,-5cm); label.top("tubular length ($in$)",(5.2cm,-2.75cm)); \stopMPcode} ___ 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 Question
Please change your mailing name and address. In order to draw 3D perspective diagrams in MetaPost, you will need to transform 3D paths to a 2D projection. There are many methods to accomplish this, and there are several MP modules that have been written to address this issue. One fairly simple and elegant approach is available from Urs Oswald: http://www.ursoswald.ch/metapost/tutorial.html Alan On Sun, 6 Dec 2015 21:54:38 +0100 Context NTGwrote: > I am trying to graph a cylinder. Is there a way to draw a more > elliptic top/bottom. This one seems some flattened at the top and > bottom. I would like to hatch the mid elliptic that is collored grey > now. Is there a way to do this. > > Thanks > Jeroen > > > > \placefigure > > [here,force] > > [fig:tubing] > > {Tubular Linear Volumetric Capacity} > > {\startMPcode > > > draw (0,0){up} ... (1.25cm, 2mm) ... (2.5cm,0){down} ... (1.25cm, > -2mm) ... cycle; > > draw (0,0) -- (0,-5cm) dashed evenly; > > draw (2.5cm,0) -- (2.5cm,-5cm) dashed evenly; > > draw (0,-5cm){up} ... (1.25cm, -4.8cm) ... (2.5cm,-5cm){down} ... > (1.25cm, -5.2cm) ... cycle dashed evenly; > > > draw (-.2cm,0){up} ... (1.25cm, 3.5mm) ... (2.7cm,0){down} ... > (1.25cm, -3.5mm) ... cycle; > > draw (-.2cm,0) -- (-.2cm,-5cm); > > draw (2.7cm,0) -- (2.7cm,-5cm); > > draw (-.2cm,-5cm){up} ... (1.25cm, -4.7cm) ... (2.7cm,-5cm){down} > dashed evenly; > > draw (-.2cm,-5cm){down} ... (1.25cm, -5.3cm) ... (2.7cm,-5cm){up}; > > > fill (0,-2.5cm){up} ... (1.25cm, -2.3cm) ... (2.5cm,-2.5cm){down} ... > (1.25cm, -2.7cm) ... cycle withcolor (.6,.6,.6) dashed evenly; > > label.top("tubular",(1.26cm,-1.1cm)); > > label.top("inside area",(1.28cm,-1.6cm)); > > label.top("($in^2$)",(1.28cm,-2.2cm)); > > > draw (3.25cm,-5cm) -- (3.25cm,0); > > drawarrow (3.25cm,-5) -- (3.25cm,0); > > drawarrow (3.25cm,0) -- (3.25cm,-5cm); > > label.top("tubular length ($in$)",(5.2cm,-2.75cm)); > > > \stopMPcode} -- Alan Braslau CEA DSM-IRAMIS-SPEC CNRS UMR 3680 Orme des Merisiers 91191 Gif-sur-Yvette cedex FRANCE tel: +33 1 69 08 73 15 fax: +33 1 69 08 87 86 mailto:alan.bras...@cea.fr ___ 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 question
In MetaPost: After putting something in a picture, one can draw its boundaries with draw boundingbox thepicture. Is it possible to obtain at that point the dimensions of this boudingbox in order to do some calculations with them? 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 question
Am 01.12.2011 23:25, schrieb Hans van der Meer: In MetaPost: After putting something in a picture, one can draw its boundaries with draw boundingbox thepicture. Is it possible to obtain at that point the dimensions of this boudingbox in order to do some calculations with them? urcorner boundingbox currentpicture should hold the wanted values (untested); maybe you have to take 'llcorner' into account too. Best wishes, Peter 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 ___ ___ 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 question
I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: else: fi enddef; How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text Thanks in advance. 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 question
Am 21.10.2011 15:05, schrieb Hans van der Meer: I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: Have you already tried if modifier = : else: fi enddef; How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text Thanks in advance. 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 ___ ___ 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 question
On 21 okt. 2011, at 17:13, Peter Rolf wrote: Am 21.10.2011 15:05, schrieb Hans van der Meer: I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: Have you already tried if modifier = : else: fi enddef; I tried it now, but it doesn't work. Something like if(TEXT4) =:;fi in the error log. No, Metapost is not happy with this construct. How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text Thanks in advance. 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 question
In article 0e2e620e-1148-41ad-9966-54a594fcc...@xs4all.nl, Hans van der Meer havdm...@xs4all.nl wrote: I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: else: fi enddef; How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. A text argument is a (more or less) arbitrary sequence of tokens—that is, loosely speaking, any “chunk” of MetaPost code. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text This is the best I could think of: vardef emptytext?@# text t = (str @# = empty.sandwich) enddef; def mydef(expr a,b,c) text t = if begingroup emptytext? empty t sandwich endgroup: % t is empty draw unitsquare scaled 1cm; else: % t is not empty fill unitsquare scaled 1cm t ; fi; enddef; The key is the 'emptytext? empty t sandwich;' line: if t is empty, @# matches 'empty.sandwich', otherwise it matches 'empty' possibly followed by something else (depending on what t actually is). The undelimited text parameter of emptytext? is needed to “swallow” whatever tokens are left (possibly none) after matching the implicit suffix parameter. Note that begingroup and endgroup are necessary in the if clause, otherwise emptytext?'s undelimited text parameter will match beyond the colon. In practice, you should rename 'sandwich' to some token that you are pretty sure will never occur as the beginning of the text argument when you invoke mydef. I'd be glad to hear about other solutions: this question has bugged me for some time… Regards, Nicola ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
Peter, Thanks for trying to help. Because I solved the problem in another way you might be interested or even benefit from it. The underlying problem was drawing a border around a picture of given dimensions. The border being either colored or left uncolored. The border color should come from a withcolor modifier, with the uncolored case done simply by leaving this out, for example: borderinsideframe(u,v,2g); and borderinsideframe(u,v,2g) withcolor red; It turns out this can be done with an unfill. I learned that a bare unfill erases, but add a withcolor modifier and the effect is a coloring. Thus the trick is: def bordercolorframe (expr w, h, off, clr) text modifier = unfill (-off,-off)--(w+off,-off)--(w+off,h+off)--(-off,h+off)--cycle modifier; fill (0,0)--(w,0)--(w,h)--(0,h)--cycle withcolor clr enddef; The omission of a semicolon after the last statement of the def allows one to add in a withcolor somecolor without triggering an error. Hope this will be of use to someone. Hans van der Meer On 21 okt. 2011, at 17:13, Peter Rolf wrote: Am 21.10.2011 15:05, schrieb Hans van der Meer: I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: Have you already tried if modifier = : else: fi enddef; How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text Thanks in advance. 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 question (bug?)
Am 21.07.2011 23:21, schrieb Alan Braslau: On Thu, Jul 21, 2011 at 05:39:48PM +0200, Peter Rolf wrote: use p2 := p0 p1; the reason for the 'unexpected' output is, that point 1 and 2 of the path p2 are equal. keep in mind that drawing with an asymmetrical pen has its own (complex) rules. Thank you -- I forgot about the path operator same here (i had to browse the metapost manual for the operator) :-) (Funny thing, though, that the problem shows up with point 0. I would also think that having two consecutive identical points, although poor style, should not cause problems as it does.) i guess it has to do with the fact, that 'drawing' with non circular pens always results in a *filled* path. metapost is calculating new points for the shape, instead of just storing the given path points and the pen size (like in a normal pencircle draw). and if a filled path is intersecting with itself, funny things can happen. well, most times not that funny (because unwanted). probably not the best example (not drawn, no special pen), but it gives a first impression of what is going on. \startTEXpage \startMPcode path p[]; p0 := unitcircle scaled 10cm; p1 := p0 scaled .5; p2 := p0 -- reverse(p1) -- cycle; fill p2; \stopMPcode \stopTEXpage depending on their direction (clockwise or counter clockwise) and location (intersection or not) such path 'cycles' are cleared or filled. with this trick you are able to produce punches as in the glyphs of O or e. if you like and have the time you can debug your example (simply add a loop that draws all points and labels them). you will then see the difference between a drawn (pencircle) and a 'drawn' (non circular pen) path. ;-) And yes, the use of an asymmetrical pen is indeed the whole point of this figure -- I am using metapost to achieve very easily an effect, conceptually very simple, that a colleague has not been able to produce using Adobe Illustrator. Thank you again for helping out. my pleasure. Peter 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 ___ ___ 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 question (bug?)
Hello, I have a question for metapost specialists: I am looking for some sort of effect, built upon a zig-zag line. The first graphic in the minimal example below is as I would expect. The second graphic seems to be drawn without the point at (0,0). (Ignore the asymmetry at the end of the path in the 2nd, this is to be expected in this minimal example.) Is the result correct or is this a bug? Alan \starttext \startTEXpage \startMPcode u := 1mm ; path p[] ; p0 := ((0,0)--(1,0)) rotated 45 scaled 20u ; pickup pensquare scaled 10u rotated 45 ; draw p0 withcolor blue ; pickup pensquare yscaled 2u xscaled 5u rotated 45 ; draw p0 withcolor yellow ; pickup pencircle scaled .1u ; draw p0 ; \stopMPcode \stopTEXpage \startTEXpage \startMPcode p1 := ((0,0)--(sqrt(2),0)) rotated -30 scaled 20u shifted point infinity of p0 ; p2 := p0--p1 ; pickup pensquare scaled 10u rotated 45 ; draw p2 withcolor blue ; pickup pensquare yscaled 2u xscaled 5u rotated 45 ; draw p2 withcolor yellow ; pickup pencircle scaled .1u ; draw p2 ; \stopMPcode \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 question (bug?)
On Thu, Jul 21, 2011 at 4:39 PM, Alan Braslau alan.bras...@cea.fr wrote: Hello, I have a question for metapost specialists: I am looking for some sort of effect, built upon a zig-zag line. The first graphic in the minimal example below is as I would expect. The second graphic seems to be drawn without the point at (0,0). (Ignore the asymmetry at the end of the path in the 2nd, this is to be expected in this minimal example.) Is the result correct or is this a bug? Alan \starttext \startTEXpage \startMPcode u := 1mm ; path p[] ; p0 := ((0,0)--(1,0)) rotated 45 scaled 20u ; pickup pensquare scaled 10u rotated 45 ; draw p0 withcolor blue ; pickup pensquare yscaled 2u xscaled 5u rotated 45 ; draw p0 withcolor yellow ; pickup pencircle scaled .1u ; draw p0 ; \stopMPcode \stopTEXpage \startTEXpage \startMPcode p1 := ((0,0)--(sqrt(2),0)) rotated -30 scaled 20u shifted point infinity of p0 ; p2 := p0--p1 ; pickup pensquare scaled 10u rotated 45 ; draw p2 withcolor blue ; pickup pensquare yscaled 2u xscaled 5u rotated 45 ; draw p2 withcolor yellow ; pickup pencircle scaled .1u ; draw p2 ; \stopMPcode \stopTEXpage \stoptext You are shifting by a certain amount : what is the net effect of shifted point infinity of p0 ? -- 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 question (bug?)
Am 21.07.2011 16:53, schrieb luigi scarso: On Thu, Jul 21, 2011 at 4:39 PM, Alan Braslau alan.bras...@cea.fr wrote: Hello, I have a question for metapost specialists: I am looking for some sort of effect, built upon a zig-zag line. The first graphic in the minimal example below is as I would expect. The second graphic seems to be drawn without the point at (0,0). (Ignore the asymmetry at the end of the path in the 2nd, this is to be expected in this minimal example.) Is the result correct or is this a bug? Alan \starttext \startTEXpage \startMPcode u := 1mm ; path p[] ; p0 := ((0,0)--(1,0)) rotated 45 scaled 20u ; pickup pensquare scaled 10u rotated 45 ; draw p0 withcolor blue ; pickup pensquare yscaled 2u xscaled 5u rotated 45 ; draw p0 withcolor yellow ; pickup pencircle scaled .1u ; draw p0 ; \stopMPcode \stopTEXpage \startTEXpage \startMPcode p1 := ((0,0)--(sqrt(2),0)) rotated -30 scaled 20u shifted point infinity of p0 ; p2 := p0--p1 ; use p2 := p0 p1; the reason for the 'unexpected' output is, that point 1 and 2 of the path p2 are equal. keep in mind that drawing with an asymmetrical pen has its own (complex) rules. pickup pensquare scaled 10u rotated 45 ; draw p2 withcolor blue ; pickup pensquare yscaled 2u xscaled 5u rotated 45 ; draw p2 withcolor yellow ; pickup pencircle scaled .1u ; draw p2 ; \stopMPcode \stopTEXpage \stoptext You are shifting by a certain amount : what is the net effect of shifted point infinity of p0 ? afaik simply the last point of p0. ___ 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 question (bug?)
On Thu, Jul 21, 2011 at 05:39:48PM +0200, Peter Rolf wrote: use p2 := p0 p1; the reason for the 'unexpected' output is, that point 1 and 2 of the path p2 are equal. keep in mind that drawing with an asymmetrical pen has its own (complex) rules. Thank you -- I forgot about the path operator (Funny thing, though, that the problem shows up with point 0. I would also think that having two consecutive identical points, although poor style, should not cause problems as it does.) And yes, the use of an asymmetrical pen is indeed the whole point of this figure -- I am using metapost to achieve very easily an effect, conceptually very simple, that a colleague has not been able to produce using Adobe Illustrator. Thank you again for helping out. 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 question
Jean Magnan de Bornier wrote: Le 12 mai à 17:53:48 Taco Hoekwater t...@elvenkind.com écrit notamment: | I cannot reproduce this problem. To make sure it is not a mem file | version differencne, can you delete and regenerate mpost.mem ? I followed this, nothing better! Then I tried to delete also metafun.mem and that worked! (btw remaking mpost format didn't create metafun.mem again, it doesn't seem to miss...) That doesn't seem to make any sense, but I am glad the problem has gone away. 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Le 13 mai à 08:45:36 Taco Hoekwater t...@elvenkind.com écrit notamment: | That doesn't seem to make any sense, but I am glad the problem has | gone away. Well, after my original post, one of the advices was: | you have to give mpost a mem(ory dump) file. something like | mpost -mem=metafun.mem file.mp I followed it blindly, and the metafun.mem was created, and that seems to have added a problem to the original one... That's no problem, I learned something! cheers, -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Jean Magnan de Bornier wrote: Le 11 mai à 20:02:36 Mojca Miklavec mojca.miklavec.li...@gmail.com écrit notamment: | | Which command does that evil? They both seem to work here ... | | mpost, texexec --mpgraphic, mpost -mem=metafun.mem, all three of them! | I don't understand. Can you please post the whole log. You cannot get | metafun warnings when running just mpost unless something is set up | in some really weird way. I could imagine that there could be some | infinite loop in some metafun macro, but I cannot imagine why mpost | would fall into infinite loop. I have stopped compilation after no more than 30 seconds, the log is 14MB large with many lines: It looks like you should also post ecindf.mp so we can try for ourselves (or did I miss that?). 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Le 12 mai à 09:42:29 Taco Hoekwater t...@elvenkind.com écrit notamment: | Jean Magnan de Bornier wrote: | Le 11 mai à 20:02:36 Mojca Miklavec mojca.miklavec.li...@gmail.com écrit notamment: | | | | Which command does that evil? They both seem to work here ... | | | | mpost, texexec --mpgraphic, mpost -mem=metafun.mem, all three of them! | | I don't understand. Can you please post the whole log. You cannot get | | metafun warnings when running just mpost unless something is set up | | in some really weird way. I could imagine that there could be some | | infinite loop in some metafun macro, but I cannot imagine why mpost | | would fall into infinite loop. | | I have stopped compilation after no more than 30 seconds, the log is 14MB | large with many lines: | It looks like you should also post ecindf.mp so we can try for | ourselves (or did I miss that?). OK, here's a test file that works as expected: ... numeric u; u=.5cm; path AX; AX = drawdblarrow (10u,0) -- (0,0) -- (0,10u); beginfig(1); draw AX; label.lft(btex Coûts, prix etex rotated 90, (-.2u,8u)); label.bot(btex Quantités etex, (8u,0)); for i=0 step u until 9u: draw (i,u/20)--(i,0); draw (u/20,i)--(0,i); endfor; picture ax; ax := currentpicture; endfig; No need for metafun here, but for other pictures I use it; and if I add « input metafun;» at the top I get the unending message! -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
On Tue, 12 May 2009, Jean Magnan de Bornier wrote: Le 12 mai à 09:42:29 Taco Hoekwater t...@elvenkind.com écrit notamment: | Jean Magnan de Bornier wrote: | Le 11 mai à 20:02:36 Mojca Miklavec mojca.miklavec.li...@gmail.com écrit notamment: | | | | Which command does that evil? They both seem to work here ... | | | | mpost, texexec --mpgraphic, mpost -mem=metafun.mem, all three of them! | | I don't understand. Can you please post the whole log. You cannot get | | metafun warnings when running just mpost unless something is set up | | in some really weird way. I could imagine that there could be some | | infinite loop in some metafun macro, but I cannot imagine why mpost | | would fall into infinite loop. | | I have stopped compilation after no more than 30 seconds, the log is 14MB | large with many lines: | It looks like you should also post ecindf.mp so we can try for | ourselves (or did I miss that?). OK, here's a test file that works as expected: Can you post a file that fails at your end? 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Le 12 mai à 16:32:26 Aditya Mahajan adit...@umich.edu écrit notamment: | Can you post a file that fails at your end? here, but it doesn't *fail*, it produces ecindf.1 ok but then shows infinitely this message. ... input metafun; numeric u; u=.5cm; path AX; AX = drawdblarrow (10u,0) -- (0,0) -- (0,10u); beginfig(1); draw AX; label.lft(btex Coûts, prix etex rotated 90, (-.2u,8u)); label.bot(btex Quantités etex, (8u,0)); for i=0 step u until 9u: draw (i,u/20)--(i,0); draw (u/20,i)--(0,i); endfor; picture ax; ax := currentpicture; endfig; end ... -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Jean Magnan de Bornier wrote: Le 12 mai à 16:32:26 Aditya Mahajan adit...@umich.edu écrit notamment: | Can you post a file that fails at your end? here, but it doesn't *fail*, it produces ecindf.1 ok but then shows infinitely this message. I cannot reproduce this problem. To make sure it is not a mem file version differencne, can you delete and regenerate mpost.mem ? 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Le 12 mai à 17:53:48 Taco Hoekwater t...@elvenkind.com écrit notamment: | I cannot reproduce this problem. To make sure it is not a mem file | version differencne, can you delete and regenerate mpost.mem ? I followed this, nothing better! Then I tried to delete also metafun.mem and that worked! (btw remaking mpost format didn't create metafun.mem again, it doesn't seem to miss...) So it all seems ok now Thanks! -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Metapost question
Hi all, Trying to use mpost with (today's) minimals, I get this answer: ... 16:55 j...@boldair /home/jean/graph % mpost ecindf Sorry, I can't find that mem file; will try PLAIN. I can't find the PLAIN mem file! ... Do I have to make formats or something for mpost to work? tia, -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Jean Magnan de Bornier schrieb: Hi all, Trying to use mpost with (today's) minimals, I get this answer: ... 16:55 j...@boldair /home/jean/graph % mpost ecindf Sorry, I can't find that mem file; will try PLAIN. I can't find the PLAIN mem file! ... Do I have to make formats or something for mpost to work? you have to give mpost a mem(ory dump) file. something like mpost -mem=metafun.mem file.mp donno if there are more elegant ways to make it run. hope that helps, Peter tia, ___ 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 question
On Mon, May 11, 2009 at 17:14, Jean Magnan de Bornier wrote: Hi all, Trying to use mpost with (today's) minimals, I get this answer: ... 16:55 j...@boldair /home/jean/graph % mpost ecindf Sorry, I can't find that mem file; will try PLAIN. I can't find the PLAIN mem file! ... Do I have to make formats or something for mpost to work? texexec --make metafun But I should probably check what goes wrong as this format should have been generated automatically. Hans, in the source code there is states.set(formats.cont-en, true) states.set(formats.cont-nl, true) states.set(formats.metafun, true) Maybe mpost should be added there as well (though I didn't test yet if that indeed helps). 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
On Mon, 11 May 2009, Jean Magnan de Bornier wrote: Hi all, Trying to use mpost with (today's) minimals, I get this answer: ... 16:55 j...@boldair /home/jean/graph % mpost ecindf Sorry, I can't find that mem file; will try PLAIN. I can't find the PLAIN mem file! ... Do I have to make formats or something for mpost to work? You can also use the texexec interface (which uses metafun format) texexec --mpgraphic file.mp 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
On Mon, May 11, 2009 at 17:42, Mojca Miklavec wrote: On Mon, May 11, 2009 at 17:14, Jean Magnan de Bornier wrote: Hi all, Trying to use mpost with (today's) minimals, I get this answer: ... 16:55 j...@boldair /home/jean/graph % mpost ecindf Sorry, I can't find that mem file; will try PLAIN. I can't find the PLAIN mem file! ... Do I have to make formats or something for mpost to work? texexec --make metafun Sorry, I meant texexec --make mpost Though it's indeed true that you can use mpost --mem=metafun ecindf or the ConTeXt interface But these formats should be made by default. 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Le 11 mai à 17:34:42 Peter Rolf indi...@gmx.net écrit notamment: | Jean Magnan de Bornier schrieb: | Hi all, | Trying to use mpost with (today's) minimals, I get this answer: | ... | 16:55 j...@boldair /home/jean/graph % mpost ecindf | | Sorry, I can't find that mem file; will try PLAIN. | I can't find the PLAIN mem file! | ... | | Do I have to make formats or something for mpost to work? | | | you have to give mpost a mem(ory dump) file. something like | mpost -mem=metafun.mem file.mp | donno if there are more elegant ways to make it run. | hope that helps, | Peter | tia, | Thanks to all! Peter and Aditya's solutions work, Mokja's doesn't.. Using Aditya's, when everything is fine, it ends up with a (seemingly infinite) series of lines: ... metafun 2009-5-11 18:20 ... Strange and hardly nice, I had to cut it out. Maybe there is a problem here. Anyway why can't we compile with just 'mpost' anymore? Cu, -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Mojca Miklavec wrote: On Mon, May 11, 2009 at 17:14, Jean Magnan de Bornier wrote: Hi all, Trying to use mpost with (today's) minimals, I get this answer: ... 16:55 j...@boldair /home/jean/graph % mpost ecindf Sorry, I can't find that mem file; will try PLAIN. I can't find the PLAIN mem file! ... Do I have to make formats or something for mpost to work? texexec --make metafun But I should probably check what goes wrong as this format should have been generated automatically. Hans, in the source code there is states.set(formats.cont-en, true) states.set(formats.cont-nl, true) states.set(formats.metafun, true) Maybe mpost should be added there as well (though I didn't test yet if that indeed helps). maybe ... if someone is using mp directly in context -) in luatex/mkiv formats are generated on the fly - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
On Mon, May 11, 2009 at 19:33, Jean Magnan de Bornier wrote: Le 11 mai à 18:52:08 Mojca Miklavec écrit notamment: | But then I still have unending the | ... | metafun 2009-5-11 18:30 | metafun 2009-5-11 18:30 | metafun 2009-5-11 18:30 | metafun 2009-5-11 18:30 | metafun 2009-5-11 18:30 | metafun 2009-5-11 18:30 | metafun 2009-5-11 18:30 | metafun 2009-5-11 18:30 | .. | Which command does that evil? They both seem to work here ... mpost, texexec --mpgraphic, mpost -mem=metafun.mem, all three of them! I don't understand. Can you please post the whole log. You cannot get metafun warnings when running just mpost unless something is set up in some really weird way. I could imagine that there could be some infinite loop in some metafun macro, but I cannot imagine why mpost would fall into infinite loop. 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
On Mon, May 11, 2009 at 19:01, Hans Hagen wrote: Mojca Miklavec wrote: states.set(formats.metafun, true) Maybe mpost should be added there as well (though I didn't test yet if that indeed helps). maybe ... if someone is using mp directly in context -) in luatex/mkiv formats are generated on the fly I know, but metapost generates the format on the fly only in TeX Live (with mktexfmt I think), not in minimals, so it would be really nice of us to generate the format during installation already. 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Metapost question
Le 11 mai à 20:02:36 Mojca Miklavec mojca.miklavec.li...@gmail.com écrit notamment: | | Which command does that evil? They both seem to work here ... | | mpost, texexec --mpgraphic, mpost -mem=metafun.mem, all three of them! | I don't understand. Can you please post the whole log. You cannot get | metafun warnings when running just mpost unless something is set up | in some really weird way. I could imagine that there could be some | infinite loop in some metafun macro, but I cannot imagine why mpost | would fall into infinite loop. I have stopped compilation after no more than 30 seconds, the log is 14MB large with many lines: 06:25 j...@boldair /home/jean/graph % wc -l ecindf.log 644385 ecindf.log After eliminating duplicates, here it is: .. This is MetaPost, version 1.200 (kpathsea version 3.5.7dev) (mem=metafun 2009.05.11) 11 MAY 2009 19:56 **cindf (/home/jean/context/tex/texmf-context/metapost/context/base/metafun.mp (/home/jean/context/tex/texmf-context/metapost/context/base/mp-tool.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-spec.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-core.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-page.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-text.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-txts.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-shap.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-butt.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-char.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-step.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-grph.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-figs.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-mlib.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-grid.mp) (/home/jean/context/tex/texmf-context/metapost/context/base/mp-func.mp)) (/home/jean/context/tex/texmf/metapost/base/graph.mp) [1 Warning: cannot open font map file psfonts.map ] [2] [3 Warning: cannot open font map file psfonts.map ] [4] [5] [6] [7 Warning: cannot open font map file psfonts.map ] [8] [9] [10 Warning: cannot open font map file psfonts.map ] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] metafun 2009-5-11 19:56 metafun 2009- I had noticed the warning but have no idea what it leads to... tia -- 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] metapost question
Hi all, probably an easy question: for a presentation, I would like to have an area of my slide highlighted by placing a transparent grey layer on top of the slide and having one area of this layer completely transparent, a bit like this screenshot: http://debaday.debian.net/wp-content/uploads/2007/05/key3.jpg Any suggestions for the easiest way to achieve this effect? Thanks Thomas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
On Wed, Jun 18, 2008 at 1:14 PM, Thomas A. Schmitz [EMAIL PROTECTED] wrote: Hi all, probably an easy question: for a presentation, I would like to have an area of my slide highlighted by placing a transparent grey layer on top of the slide and having one area of this layer completely transparent, a bit like this screenshot: http://debaday.debian.net/wp-content/uploads/2007/05/key3.jpg Any suggestions for the easiest way to achieve this effect? \setupexternalfigures[location={local,global,default}] \definecolor[tgray][r=.8,t=.5,a=1] \startuseMPgraphic{highlighted} path p, q ; p = unitsquare xyscaled(OverlayWidth,OverlayHeight) ; q= fullcircle scaled 3cm shifted (12cm,10cm) ; fill p--reverse q--cycle withcolor \MPcolor{tgray} ; \stopuseMPgraphic \defineoverlay[image][\overlayfigure{hacker}] \defineoverlay[shade][\useMPgraphic{highlighted}] \setupbackgrounds[page][background={image,shade}] \setuppapersize[S6][S6] \starttext \page[empty] \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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
On Jun 18, 2008, at 1:58 PM, Peter Rolf wrote: \startuniqueMPgraphic{dim:and:focus}{fw,fh,fx,fy,c} begingroup save q ; path q; q:= (unitsquare xyscaled(\MPvar{fw},\MPvar{fh}) smoothed 4px) shifted (\MPvar{fx},\MPvar{fy}); fill OverlayBox--reverse q-- cycle withcolor \MPvar{c} ; % draw q withpen pxcpen withcolor darkgray; setbounds currentpicture to OverlayBox ; % just to be safe in case of outside focus rectangle endgroup; \stopuniqueMPgraphic no further explanations :D best wishes, peter Peter, Wolfgang, thanks so much! I had no idea reverse could work like this, wonderful. I will try and build this into my presentation module. Thomas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
Thomas A. Schmitz schrieb: Hi all, probably an easy question: for a presentation, I would like to have an area of my slide highlighted by placing a transparent grey layer on top of the slide and having one area of this layer completely transparent, a bit like this screenshot: http://debaday.debian.net/wp-content/uploads/2007/05/key3.jpg Any suggestions for the easiest way to achieve this effect? Thanks \startuniqueMPgraphic{dim:and:focus}{fw,fh,fx,fy,c} begingroup save q ; path q; q:= (unitsquare xyscaled(\MPvar{fw},\MPvar{fh}) smoothed 4px) shifted (\MPvar{fx},\MPvar{fy}); fill OverlayBox--reverse q-- cycle withcolor \MPvar{c} ; % draw q withpen pxcpen withcolor darkgray; setbounds currentpicture to OverlayBox ; % just to be safe in case of outside focus rectangle endgroup; \stopuniqueMPgraphic no further explanations :D best wishes, peter Thomas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
Just wanted to renew my thanks. I used the code from these pages to produce the slides for my lecture, and I really liked the way the polyhedra came out. I always got an error about a redundant equation when compiling, but the pdf looks fine. So here's the link (the image with the Platonic solids is on p. 35): http://www.uni-bonn.de/www/Philologie/Personal/Schmitz/Dateien/bilder/ 07_10_23.pdf Thanks Thomas On Oct 8, 2007, at 8:10 PM, Jesse Alama wrote: And here's a page dedicated to the MetaPost package that's used for those polyhedra: http://melusine.eu.org/syracuse/poulecl/geometriesyr16/ Download: http://melusine.eu.org/syracuse/poulecl/geometriesyr16/distrib/ geometriesyr16.tgz Jesse Otared Kavian [EMAIL PROTECTED] writes: Hi Thomas, I think you can find what you are looking for at: http://melusine.eu.org/syracuse/poulecl/albums/espace3/ Best regards: OK On 8 oct. 2007, at 15:47, Thomas A. Schmitz wrote: Just because I hope that someone may have done this already: does anyone have metapost code to draw the Platonic solids (I hope the attachment comes through). All best Thomas platonic.png ___ 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 question
Thomas A. Schmitz wrote: Just wanted to renew my thanks. I used the code from these pages to produce the slides for my lecture, and I really liked the way the polyhedra came out. I always got an error about a redundant equation when compiling, but the pdf looks fine. So here's the link (the image use := instead of = then - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
On Oct 23, 2007, at 2:26 PM, Hans Hagen wrote: use := instead of = then Well yes, but this was a pretty intricate package with lots of included files, so I found it difficult to trace down which equation was causing the trouble. However, I found the resilt very nice. Best Thomas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] metapost question
Just because I hope that someone may have done this already: does anyone have metapost code to draw the Platonic solids (I hope the attachment comes through). All best Thomas inline: platonic.png___ 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 question
Hi Thomas, I think you can find what you are looking for at: http://melusine.eu.org/syracuse/poulecl/albums/espace3/ Best regards: OK On 8 oct. 2007, at 15:47, Thomas A. Schmitz wrote: Just because I hope that someone may have done this already: does anyone have metapost code to draw the Platonic solids (I hope the attachment comes through). All best Thomas platonic.png __ _ 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 __ _ ___ 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 question
On Oct 8, 2007, at 6:49 PM, Otared Kavian wrote: Hi Thomas, I think you can find what you are looking for at: http://melusine.eu.org/syracuse/poulecl/albums/espace3/ Best regards: OK Thanks, Otared! It took me a while to find out how to navigate the site, but this really looks like it has exactly what I need! Thanks so much! French matheux simply are the best... All best Thomas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
And here's a page dedicated to the MetaPost package that's used for those polyhedra: http://melusine.eu.org/syracuse/poulecl/geometriesyr16/ Download: http://melusine.eu.org/syracuse/poulecl/geometriesyr16/distrib/geometriesyr16.tgz Jesse Otared Kavian [EMAIL PROTECTED] writes: Hi Thomas, I think you can find what you are looking for at: http://melusine.eu.org/syracuse/poulecl/albums/espace3/ Best regards: OK On 8 oct. 2007, at 15:47, Thomas A. Schmitz wrote: Just because I hope that someone may have done this already: does anyone have metapost code to draw the Platonic solids (I hope the attachment comes through). All best Thomas platonic.png __ _ 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 __ _ ___ 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 ___ -- Jesse Alama ([EMAIL PROTECTED]) ___ 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] MetaPost question
Hello, I try to print a periodic table in MP+TeX, but I get the following error if I uncomment the % lines; I fail to see my error. Is there any trick to debug this? The error is: ! mpx file ended unexpectedly. l.3186 - line number depends on which line is outcommented Thanks, Tobias periodaux.tex Description: TeX document % Run as: TEX='texmfstart texexec --dvi --batch --once' mpost input mp-tool ; % some initializations and auxiliary macros input mp-spec ; verbatimtex \enableregime[utf] etex; verbatimtex \input periodaux etex; def element(expr y, x, Sym, Z, M, name, altname, conf) = draw thelabel.rt (Z, (x-1mm,-y+15mm)); draw thelabel.lft (Sym, (x+14.9mm,-y+15.3mm)); draw thelabel.bot (name, (x+6.75mm,-y+13mm)); draw thelabel.bot (altname, (x+6.75mm,-y+10.9mm)); draw thelabel.bot (M, (x+6.75mm,-y+8.8mm)); draw thelabel.bot (conf, (x+6.75mm,-y+6.7mm)); draw (x+0,-y+0)--(x+15mm,-y+0mm)--(x+15mm,-y+18mm)--(x+0mm,-y+18mm)--cycle; enddef; dx=15mm; dy=18mm; beginfig(1) draw thelabel.bot (btex \tfa Periodic Table etex, (8.5*dx,0*dy)); element(1*dy, 1*dx, (btex \pSym{H} etex), (btex \pZ{1} etex), (btex \pM{1.00794} etex), (btex \pName{Hydrogen} etex), (btex \pAltName{Wasserstoff} etex), (btex \pConf{$1s$} etex)); element(1*dy, 18*dx, (btex \pSym{He} etex), (btex \pZ{2} etex), (btex \pM{4.002602} etex), (btex \pName{Helium} etex), (btex \pAltName{Helium} etex), (btex \pConf{$1s^2$} etex)); element(2*dy, 1*dx, (btex \pSym{Li} etex), (btex \pZ{3} etex), (btex \pM{5.3917} etex), (btex \pName{Lithium} etex), (btex \pAltName{Lithium} etex), (btex \pConf{$1s^22s$} etex)); element(2*dy, 2*dx, (btex \pSym{Be} etex), (btex \pZ{4} etex), (btex \pM{9.3227} etex), (btex \pName{Beryllium} etex), (btex \pAltName{Beryllium} etex), (btex \pConf{$1s^22s^2$} etex)); element(2*dy, 13*dx, (btex \pSym{B} etex), (btex \pZ{5} etex), (btex \pM{10.811} etex), (btex \pName{Boron} etex), (btex \pAltName{Bor} etex), (btex \pConf{$1s^22s^22p$} etex)); element(2*dy, 14*dx, (btex \pSym{C} etex), (btex \pZ{6} etex), (btex \pM{12.0107} etex), (btex \pName{Carbon} etex), (btex \pAltName{Kohlenstoff} etex), (btex \pConf{$1s^22s^22p^2$} etex)); element(2*dy, 15*dx, (btex \pSym{N} etex), (btex \pZ{7} etex), (btex \pM{14.0067} etex), (btex \pName{Nitrogen} etex), (btex \pAltName{Stickstoff} etex), (btex \pConf{$1s^22s^22p^3$} etex)); element(2*dy, 16*dx, (btex \pSym{O} etex), (btex \pZ{8} etex), (btex \pM{15.9994} etex), (btex \pName{Oxygen} etex), (btex \pAltName{Sauerstoff} etex), (btex \pConf{$1s^22s^22p^4$} etex)); element(2*dy, 17*dx, (btex \pSym{F} etex), (btex \pZ{9} etex), (btex \pM{18.9984032} etex), (btex \pName{Fluorine} etex), (btex \pAltName{Fluor} etex), (btex \pConf{$1s^22s^22p^5$} etex)); element(2*dy, 18*dx, (btex \pSym{Ne} etex), (btex \pZ{10} etex), (btex \pM{20.1797} etex), (btex \pName{Neon} etex), (btex \pAltName{Neon} etex), (btex \pConf{$1s^22s^22p^6$} etex)); element(3*dy, 1*dx, (btex \pSym{Na} etex), (btex \pZ{11} etex), (btex \pM{22.989770} etex), (btex \pName{Sodium} etex), (btex \pAltName{Natrium} etex), (btex \pConf{[Ne]$3s$} etex)); element(3*dy, 2*dx, (btex \pSym{Mg} etex), (btex \pZ{12} etex), (btex \pM{24.3050} etex), (btex \pName{Magnesium} etex), (btex \pAltName{Magnesium} etex), (btex \pConf{[Ne]$3s^2$} etex)); element(3*dy, 13*dx, (btex \pSym{Al} etex), (btex \pZ{13} etex), (btex \pM{26.981538} etex), (btex \pName{Aluminium} etex), (btex \pAltName{Aluminium} etex), (btex \pConf{[Ne]$3s^23p$} etex)); element(3*dy, 14*dx, (btex \pSym{Si} etex), (btex \pZ{14} etex), (btex \pM{28.0855} etex), (btex \pName{Silicon} etex), (btex \pAltName{Silizium} etex), (btex \pConf{[Ne]$3s^23p^2$} etex)); element(3*dy, 15*dx, (btex \pSym{P} etex), (btex \pZ{15} etex), (btex \pM{30.973761} etex), (btex \pName{Phosphorus} etex), (btex \pAltName{Phosphor} etex), (btex \pConf{[Ne]$3s^23p^3$} etex)); element(3*dy, 16*dx, (btex \pSym{S} etex), (btex \pZ{16} etex), (btex \pM{32.065} etex), (btex \pName{Sulfur} etex), (btex \pAltName{Schwefel} etex), (btex \pConf{[Ne]$3s^23p^4$} etex)); element(3*dy, 17*dx, (btex \pSym{Cl} etex), (btex \pZ{17} etex), (btex \pM{35.453} etex), (btex \pName{Chlorine} etex), (btex \pAltName{Chlor} etex), (btex \pConf{[Ne]$3s^23p^5$} etex)); element(3*dy, 18*dx, (btex \pSym{Ar} etex), (btex \pZ{18} etex), (btex \pM{39.948} etex), (btex \pName{Argon} etex), (btex \pAltName{Argon} etex), (btex \pConf{[Ne]$3s^23p^6$} etex)); element(4*dy, 1*dx, (btex \pSym{K} etex), (btex \pZ{19} etex), (btex \pM{} etex), (btex \pName{Potassium} etex), (btex \pAltName{Kalium} etex), (btex \pConf{[Ar]$4s$} etex)); element(4*dy, 2*dx, (btex \pSym{Ca} etex), (btex \pZ{20} etex), (btex \pM{}
Re: [NTG-context] MetaPost question
Tobias Burnus wrote: Hello, I try to print a periodic table in MP+TeX, but I get the following error if I uncomment the % lines; I fail to see my error. Is there any trick to debug this? It is not easy do debug that (in general), but it normally helps to run a standalone label in TeX if you have mtx trouble. In this case, they are all the same typo: %element(5*dy, 1*dx, (btex \pSym{Rb} etex), (btex \pZ{37} etex), %(btex \pM{} etex), (btex \pName{Rubidium} etex), %(btex \pAltName{Rubidium} etex), (btex \pConf{[Kr}$5s$} etex)); That last label should probably be \pConf{[Kr]$5s$} not \pConf{[Kr}$5s$} Best, 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost question
On Wed, 2 May 2007, Aditya Mahajan wrote: On Wed, 2 May 2007, Tobias Burnus wrote: Hi, I want to define a macro in MetaPost which does: def myfunc (expr x,y)(text t) = draw thelabel.rt (btex You passed \quotation{t} etex, (x,y)); where t in btex ... text is replaced by the argument. How to do so? You can do that using TEX.mp. I remember that it is also possible to use textext to do something like this. I need to check my files to see if I have an example. Here is a working solution. \starttext \forceMPTEXcheck{myfunc} \startMPinclusions def myfunc (expr x,y) (text t) = label.rt (textext(You passed \quotation{ t }), (x,y)) enddef; \stopMPinclusions \startMPpage myfunc (0,0) (Hello) ; myfunc (2cm,1cm) (World) ; \stopMPpage \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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] MetaPost question
Hi, I want to define a macro in MetaPost which does: def myfunc (expr x,y)(text t) = draw thelabel.rt (btex You passed \quotation{t} etex, (x,y)); where t in btex ... text is replaced by the argument. How to do so? Tobias ___ 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 question
On Wed, 2 May 2007, Tobias Burnus wrote: Hi, I want to define a macro in MetaPost which does: def myfunc (expr x,y)(text t) = draw thelabel.rt (btex You passed \quotation{t} etex, (x,y)); where t in btex ... text is replaced by the argument. How to do so? You can do that using TEX.mp. I remember that it is also possible to use textext to do something like this. I need to check my files to see if I have an example. 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Metapost question
Hello, does someone know how, if at all, one can printout some variable? Like Emean:=(2*Eone+Ezero+2*Etwo)/5.; label.urt(btex $A = x$ where x is the value of Emean? I frequently create some diagrams, modify them and then forget to change the label. (If one could set the number of digits, it would be even nicer.) Tobias ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context