# [NTG-context] Struggling with ConTeXt

Aditya Mahajan adityam at umich.edu
Wed Aug 22 10:42:46 CEST 2012

On Wed, 22 Aug 2012, Olivier Binda wrote:

> Thank you for the tips.
>
> Here, I cleaned up the code some more (sorry to have left stuff over last
> time),.
>
> I added some explanations to make my issue clearer
>
>
> \startusableMPgraphic{myFrame}
>   draw OverlayBox withpen pencircle scaled 1pt withcolor green;
>   draw (currentpicture enlarged 2cm) withcolor red withpen pencircle scaled
> 2pt;
> \stopusableMPgraphic
>
> \defineoverlay[myOverlay][\useMPgraphic{myFrame}]
> \defineframedtext[myStatement][frame=off]
> \setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force]
> \starttext
> \framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement}
> In the first test, I would like the black box to have the dimensions of the
> red box.

\defineframed[myStatement][background=myOverlay, offset=overlay,width=fit]
\dontleavehmode\framed[strut=no, offset=2cm]{\myStatement{FIRST TEST}}
In the first test, I would like the black box to have the dimensions of
the red box.

> \blank[big,big,big,big,big,big,big,big,big,big]
>
> \placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement}
> In the second test, I'm going to demonstrate the issue by flowing text around
> the framed text, the green color {\em and the red color} shouldn't touch the
> flowing text as I want the float box to include the text box {\em and the
> overlay box.}

\placefigure[left,none]{}{\framed[strut=no,offset=2cm]{\myStatement{SECOND
TEST}}}
....

If needed, you can hide this behind macros:

\def\startmyStatement
{\framed[struct=no, offset=2cm]\bgroup\myStatement\bgroup}

\def\stopmyStatement
{\egroup\egroup}

Aditya


More information about the ntg-context mailing list