ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MPgraphic with rounded corners
@ 2009-01-15 17:26 Duncan Hothersall
  2009-01-15 17:48 ` Aditya Mahajan
  2009-01-15 17:48 ` MPgraphic with rounded corners Wolfgang Schuster
  0 siblings, 2 replies; 5+ messages in thread
From: Duncan Hothersall @ 2009-01-15 17:26 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: MPgraphic with rounded corners
  2009-01-15 17:26 MPgraphic with rounded corners Duncan Hothersall
@ 2009-01-15 17:48 ` Aditya Mahajan
  2009-01-18 11:05   ` mpgraph and minimals Alan BRASLAU
  2009-01-15 17:48 ` MPgraphic with rounded corners Wolfgang Schuster
  1 sibling, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2009-01-15 17:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: MPgraphic with rounded corners
  2009-01-15 17:26 MPgraphic with rounded corners Duncan Hothersall
  2009-01-15 17:48 ` Aditya Mahajan
@ 2009-01-15 17:48 ` Wolfgang Schuster
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Schuster @ 2009-01-15 17:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* mpgraph and minimals
  2009-01-15 17:48 ` Aditya Mahajan
@ 2009-01-18 11:05   ` Alan BRASLAU
  2009-01-18 13:48     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Alan BRASLAU @ 2009-01-18 11:05 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 6072 bytes --]

Trying to use the metapost macros mpgraph under the context minimals MKIV gives font and other errors,
whereas my test files process correctly under MKII (texlive).

Has anyone tried mpgraph with the minimals?

Alan


mplib          : loading format: metafun.mp, name: /home/local/context-beta/tex/texmf-cache/luatex-cache/context/ca2c461281d32a4032d9fe2a0384924b/formats/cont-en-metafun.mem                                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
define font | font with name sa is not found                                                                                         
define font | unknown font sa, loading aborted                                                                                       
define font | unable to define sa as \**thedefinedfont**                                                                             
mplib | mp terminal: (/home/local/context-beta/tex/texmf/metapost/base/graph.mp                                                      
! Redundant equation.                                                                                                                
<to be read again>                                                                                                                   
                   ;                                                                                                                 
l.143 Gmargin.low=-.07;                                                                                                              
                                              % bbox fraction for default ra...                                                      

! Redundant equation.
<to be read again>   
                   ; 
l.144 Gmargin.high=1.07;
                                              % bbox fraction for default ra...

)
mplib | mp error: unknown, no error, terminal or log messages
mplib | mp terminal: [1]                                     
mplib | mp error: unknown, no error, terminal or log messages

[-- Attachment #1.2: Type: text/html, Size: 15044 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mpgraph and minimals
  2009-01-18 11:05   ` mpgraph and minimals Alan BRASLAU
@ 2009-01-18 13:48     ` Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2009-01-18 13:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Alan BRASLAU wrote:
> Trying to use the metapost macros mpgraph under the context minimals 
> MKIV gives font and other errors,
> 
> whereas my test files process correctly under MKII (texlive).
> 
> Has anyone tried mpgraph with the minimals?

no, as i never use it; do you have a test file?

Hans


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-18 13:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-15 17:26 MPgraphic with rounded corners Duncan Hothersall
2009-01-15 17:48 ` Aditya Mahajan
2009-01-18 11:05   ` mpgraph and minimals Alan BRASLAU
2009-01-18 13:48     ` Hans Hagen
2009-01-15 17:48 ` MPgraphic with rounded corners Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).