* Using frames with metapost background in metapost
@ 2010-01-11 2:07 Aditya Mahajan
2010-01-11 11:39 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2010-01-11 2:07 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
I want to use a frame with metapost background to highlight some text
inside metapost. But, the best that I can do is get metapost
to typeset the code for the background, rather than execute it! Any ideas
on a work around (in MkIV).
\startmode[error]
\defineoverlay[MP:background]
[\useMPgraphic{MP:backgound}]
\startuseMPgraphic{MP:backgound}
draw OverlayBox randomized 9pt withcolor blue;
\stopuseMPgraphic
\stopmode
\defineframed[boxframed][frame=on,background=MP:background]
% A frame defined with \defineframe does not work
% inside Metapost, so I prevent expansion.
\unexpanded\def\boxed#1{\boxframed{#1}}
\starttext
\boxed{Boxed in text}
\startMPcode
draw textext("\boxed{boxed in metapost}") ;
%draw textext("\boxframed{boxed in metapost}") ;
\stopMPcode
\stoptext
Thanks,
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Using frames with metapost background in metapost
2010-01-11 2:07 Using frames with metapost background in metapost Aditya Mahajan
@ 2010-01-11 11:39 ` Hans Hagen
2010-01-12 0:28 ` Aditya Mahajan
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2010-01-11 11:39 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 11-1-2010 3:07, Aditya Mahajan wrote:
> \startmode[error]
> \defineoverlay[MP:background]
> [\useMPgraphic{MP:backgound}]
>
> \startuseMPgraphic{MP:backgound}
> draw OverlayBox randomized 9pt withcolor blue;
> \stopuseMPgraphic
> \stopmode
>
> \defineframed[boxframed][frame=on,background=MP:background]
>
> % A frame defined with \defineframe does not work
> % inside Metapost, so I prevent expansion.
>
> \unexpanded\def\boxed#1{\boxframed{#1}}
ok, i'll make 'm unexpandable in the core
> \starttext
>
> \boxed{Boxed in text}
>
> \startMPcode
> draw textext("\boxed{boxed in metapost}") ;
> %draw textext("\boxframed{boxed in metapost}") ;
> \stopMPcode
>
> \stoptext
\starttext
\startMPcode
picture p ; p := textext("boxed in metapost") ;
draw p ;
draw (boundingbox p) randomized 9pt withcolor blue;
\stopMPcode
\stoptext
for more complex cases use image as in
picture p ; p := image (
draw this;
drae that;
) ;
-----------------------------------------------------------------
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Using frames with metapost background in metapost
2010-01-11 11:39 ` Hans Hagen
@ 2010-01-12 0:28 ` Aditya Mahajan
0 siblings, 0 replies; 3+ messages in thread
From: Aditya Mahajan @ 2010-01-12 0:28 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
On Mon, 11 Jan 2010, Hans Hagen wrote:
>> \starttext
>>
>> \boxed{Boxed in text}
>>
>> \startMPcode
>> draw textext("\boxed{boxed in metapost}") ;
>> %draw textext("\boxframed{boxed in metapost}") ;
>> \stopMPcode
>>
>> \stoptext
>
> \starttext
>
> \startMPcode
> picture p ; p := textext("boxed in metapost") ;
> draw p ;
> draw (boundingbox p) randomized 9pt withcolor blue;
> \stopMPcode
>
> \stoptext
>
> for more complex cases use image as in
>
> picture p ; p := image (
> draw this;
> drae that;
> ) ;
Thanks. I needed this for drawing fancy borders with boxes.mp. Using
metapost to directly draw the frame is not as convinient as using \framed,
but it does work.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-12 0:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-11 2:07 Using frames with metapost background in metapost Aditya Mahajan
2010-01-11 11:39 ` Hans Hagen
2010-01-12 0:28 ` Aditya Mahajan
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).