ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: MPpositiongraphic: I don't know when it's going to work and when it's not.
Date: Mon, 27 Jan 2014 13:34:21 +0100	[thread overview]
Message-ID: <52E6524D.1020601@wxs.nl> (raw)
In-Reply-To: <CAGMMSTD=fW627UZ-x705OL3hcGk=gOXjXn7iWsNny-d6pV+6mQ@mail.gmail.com>

On 1/24/2014 12:52 AM, Elspeth McGullicuddy wrote:
> Hi Hans,
>
> The tip you gave me (wandering spaces), worked for the previous
> example, the one where the overlay was attached to the background of
> the "paper".
> For the other example, where the overlay is attached to the background
> of a "\framed", I haven't been able to make it work. The extra spaces
> there, were in fact added "during the mail process" but weren't in my
> file.
>
> I put the file that doesn't work in "attached files", so there are no
> risk it collects extra spaces.
> There is probably an obvious and silly mistake but I can't find it:
> for me it's quite similar to the examples in metafun-p.pdf, p. 127:
> "\framed[background=demo circle]{This text is overlayed.}", but mine
> refuses to work.

you need to anchor the graphic:

\starttext

\defineoverlay[my fourth overlay][\positionoverlay{my backgraphics}]

\startpositionoverlay{my backgraphics}
 
\setMPpositiongraphic{three}{mypos:circle}{mypos:circleradius=1cm,mypos:circlecolor=red}
 
\setMPpositiongraphic{three}{mypos:circle}{mypos:circleradius=.5cm,mypos:circlecolor=green}
\stoppositionoverlay

\startMPinclusions
     if unknown context_apos : input mp-apos.mpiv ; fi ;
     if unknown context_abck : input mp-abck.mpiv ; fi ;
\stopMPinclusions

\startMPpositiongraphic{mypos:circle}
     numeric x, y, w, h, d, radius;
     color c;
     path p ;
     x = \MPx{\MPvar{self}};
     y = \MPy{\MPvar{self}};
     w = \MPw{\MPvar{self}};
     radius = \MPvar{mypos:circleradius};
     c = \MPvar{mypos:circlecolor};
     p = (x+w/2+radius,y)..(x+w/2,y+radius)..(x+w/2-radius,y) 
..(x+w/2,y-radius)..cycle;
     drawarrow p withpen pencircle scaled 2pt withcolor c;
     anchor_box(\MPanchor{\MPvar{self}}) ;
\stopMPpositiongraphic

\framed [background=my fourth overlay,align=middle,width=7cm] {have 
attached it: \hpos{three}{{\em here}}, the}

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 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
___________________________________________________________________________________


  reply	other threads:[~2014-01-27 12:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-19  7:00 Elspeth McGullicuddy
2014-01-20 17:55 ` Hans Hagen
2014-01-20 17:57 ` Hans Hagen
2014-01-23 23:52   ` Elspeth McGullicuddy
2014-01-27 12:34     ` Hans Hagen [this message]
2014-01-27 23:10       ` Elspeth McGullicuddy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52E6524D.1020601@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).