[NTG-context] MPgraphic

2009-05-05 Thread R. Bastian
Salut tout le monde,

I wrote

[...]
texte texte

\startMPgraphic
draw (0.0cm, 0.0cm) -- (1.1cm, 1.1cm) ;
\stopMPgraphic

[...]
-

The compilation works ; I get an EPS-file with suffixe mpgraph.2 (visible with 
gv)
but there is nothing in the PDF.

I use the minimals from 23.04.09.

What is wrong ?

best regards,

René B.




___
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] MPgraphic with rounded corners

2009-01-16 Thread Duncan Hothersall
Thank you to both Aditya and Wolfgang; I think I need to get a better 
grounding in the basic principles of MetaFun before trying to dabble 
again...


Duncan

___
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] MPgraphic with rounded corners

2009-01-15 Thread Duncan Hothersall

Hello all.

I have adapted a bit of MP code from Aditya from a mailing list message 
dated 2006-05-19 
(http://archive.contextgarden.net/message/20060519.214124.9174ac0e.en.html) 
to ensure that when a page break occurs in a textbackground there is a 
forced vertical space inside the box at the top of the new page.


This code works fine for me (although interestingly not in the garden):


\setupcolors[state=start]

\startuseMPgraphic{mpos:par:myexample}
path p;
for i = 1 upto nofmultipars :
p := multipars[1] topenlarged 8pt bottomenlarged 8pt;
fill p withcolor 0.9white ;
draw p withcolor black
withpen pencircle scaled \MPvar{linewidth};
endfor;
\stopuseMPgraphic

\definetextbackground[ExampleBackground]
   
[mp=mpos:par:myexample,location=paragraph,leftoffset=1em,rightoffset=1em,rulethickness=1pt]


\starttext
\input knuth \endgraf
\starttextbackground[ExampleBackground]
\dorecurse{13}{\input knuth \endgraf}
\stoptextbackground
\input knuth \endgraf
\stoptext


But now I need to make this box have rounded corners, and I am very 
confused when reading core-pgr.tex because that is a level of MP code I 
just don't understand.


Would somebody please be able to tell me what to change in the above to 
make the corners of the box rounded (with a radius of 2mm)?


Thank you very much!

Duncan

___
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] MPgraphic with rounded corners

2009-01-15 Thread Aditya Mahajan

On Thu, 15 Jan 2009, Duncan Hothersall wrote:


Hello all.

I have adapted a bit of MP code from Aditya from a mailing list message dated 
2006-05-19 
(http://archive.contextgarden.net/message/20060519.214124.9174ac0e.en.html) 
to ensure that when a page break occurs in a textbackground there is a forced 
vertical space inside the box at the top of the new page.


This code works fine for me (although interestingly not in the garden):


\setupcolors[state=start]

\startuseMPgraphic{mpos:par:myexample}
path p;
for i = 1 upto nofmultipars :
p := multipars[1] topenlarged 8pt bottomenlarged 8pt;


Change this to

  p := multipars[1] topenlarged 8pt bottomenlarged 8pt cornered 2mm ;


fill p withcolor 0.9white ;
draw p withcolor black
withpen pencircle scaled \MPvar{linewidth};
endfor;
\stopuseMPgraphic

\definetextbackground[ExampleBackground]
  
[mp=mpos:par:myexample,location=paragraph,leftoffset=1em,rightoffset=1em,rulethickness=1pt]

\starttext
\input knuth \endgraf
\starttextbackground[ExampleBackground]
\dorecurse{13}{\input knuth \endgraf}
\stoptextbackground
\input knuth \endgraf
\stoptext


But now I need to make this box have rounded corners, and I am very confused 
when reading core-pgr.tex because that is a level of MP code I just don't 
understand.


Look at the metafun manual. The path p is basically a box (whose 
dimentions are equal to the text on the page, but for metapost this is 
immaterial) and you wnat to make it have round corners. So you the 
appropriate metafun transformation (cornered in this case).


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] MPgraphic with rounded corners

2009-01-15 Thread Wolfgang Schuster


Am 15.01.2009 um 18:26 schrieb Duncan Hothersall:


Hello all.

I have adapted a bit of MP code from Aditya from a mailing list  
message dated 2006-05-19 (http://archive.contextgarden.net/message/20060519.214124.9174ac0e.en.html 
) to ensure that when a page break occurs in a textbackground there  
is a forced vertical space inside the box at the top of the new page.


This code works fine for me (although interestingly not in the  
garden):



\setupcolors[state=start]

\startuseMPgraphic{mpos:par:myexample}
path p;
for i = 1 upto nofmultipars :
p := multipars[1] topenlarged 8pt bottomenlarged 8pt;


p := multipars[1] topenlarged 8pt bottomenlarged 8pt smoothed 2mm ;


fill p withcolor 0.9white ;
draw p withcolor black
withpen pencircle scaled \MPvar{linewidth};
endfor;
\stopuseMPgraphic

\definetextbackground[ExampleBackground]
   
[mp 
= 
mpos:par:myexample 
,location=paragraph,leftoffset=1em,rightoffset=1em,rulethickness=1pt]


\starttext
\input knuth \endgraf
\starttextbackground[ExampleBackground]
\dorecurse{13}{\input knuth \endgraf}
\stoptextbackground
\input knuth \endgraf
\stoptext


But now I need to make this box have rounded corners, and I am very  
confused when reading core-pgr.tex because that is a level of MP  
code I just don't understand.


Would somebody please be able to tell me what to change in the above  
to make the corners of the box rounded (with a radius of 2mm)?


The smoothed function is explained in the MetaFun manual.

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] MPgraphic question

2006-01-15 Thread Hans Hagen

David Arnold wrote:

I am recalling from memory, but try each, but use the graphic about  
five times in your document. Before compiling, clear your directory  
of all files except your sample tex file. Then compile.


If I remember, when you use the useMPgraphic, you'll get a graphic  
file each time you use it (five of them), but only one with the  
uniqueMPgraphic.


unique only generates a new instance when the overlaystamp has changed:

\def\overlaystamp
 {\overlaywidth:\overlayheight:\overlaydepth 
:\MPcolor\overlaycolor:\MPcolor\overlaylinecolor}


Hans

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] MPgraphic question

2006-01-13 Thread Hans Hagen

Hans van der Meer wrote:

I find it difficult to see the difference -- and therefore when to  
use the one or the other -- between useMPgraphic and uniqueMPgraphic.
Is there someone who will enlighten me? Because I hate not knowing  
what I am doing.


say that you have a background behind framed:

compare:

\startuseMPgraphic{test}
   draw OverlayBox withcolor red ;
\stopuseMPgraphic{test}

\setupcolor[state=start]

\defineoverlay[test][\useMPgraphic{test}]

\starttext

\framed[background=test]{Hans}
\framed[background=test]{Hans van}
\framed[background=test]{Hans van der}
\framed[background=test]{Hans van der Meer}
\framed[background=test]{Hans}


\stoptext

compare: use, reuse and unique and you'll notice the differnece:

use: every time (i.e. 5 mp runs)
reuse: once, each framed gets the same background (some have wrong 
dimensions)

unique: 4 runs, the last one has the same dimensions and is shared

so ... unique is able to determine if it can reuse (based on 
configurable characteristics)


Hans

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] MPgraphic question

2006-01-13 Thread David Arnold
I am recalling from memory, but try each, but use the graphic about  
five times in your document. Before compiling, clear your directory  
of all files except your sample tex file. Then compile.


If I remember, when you use the useMPgraphic, you'll get a graphic  
file each time you use it (five of them), but only one with the  
uniqueMPgraphic.


That's one difference, if I am remembering this properly.

On Jan 13, 2006, at 12:52 PM, Hans van der Meer wrote:

I find it difficult to see the difference -- and therefore when to  
use the one or the other -- between useMPgraphic and uniqueMPgraphic.
Is there someone who will enlighten me? Because I hate not knowing  
what I am doing.


yours sincerely,
dr. H. van der Meer



___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


David Arnold
College of the Redwoods
Mathematics Department
Eureka, CA 95501
(707) 476-4222
http://online.redwoods.edu/instruct/darnold/


___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context