ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Elspeth McGullicuddy <elspethmcgullicuddy@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: MPpositiongraphic: I don't know when it's going to work and when it's not.
Date: Sun, 19 Jan 2014 08:00:10 +0100	[thread overview]
Message-ID: <CAGMMSTBuGTMNSu8tUUrOvfFGzAJJhMAZnACcS10QMN5O3kGu+A@mail.gmail.com> (raw)

Hi,

Can you help me with the two examples below, and also tell me how I
could have found out myself when it should have worked and when it
shouldn't: because until now, it is a mix of wild guess and poor trial
and error.

%%%%%% First example %%%%%%%

\starttext

%% This example doesn't work anymore if I comment the
%% indicated line below.

\defineoverlay[my first overlay][\uniqueMPgraphic{first demo}]

\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

\setupbackgrounds[paper][background={
    my first overlay,  %% Doesn't work anymore if I comment this line.
    my fourth overlay}]

% These two lines can be removed without consequences
\startuniqueMPgraphic{first demo}
\stopuniqueMPgraphic


\startMPpositiongraphic{mypos:circle}
  % absolute coordinates relative to paper by default?
  numeric x, y, w, h, d, radius;
  x = \MPx{\MPvar{self}};
  y = \MPy{\MPvar{self}};
  w = \MPw{\MPvar{self}};
  radius = \MPvar{mypos:circleradius};
  color c;
  c = \MPvar{mypos:circlecolor};
  path p ;
  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;
\stopMPpositiongraphic

have attached it: \hpos{three}{{\em here}}, the

\stoptext

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% Second example %%%%%%%%

\starttext

%% This example doesn't work. Though it looks very much like the previous one.
%% The overlay is attached to the backgound of a framed instead of to the
%% background of the page.

\defineoverlay[my first overlay][\uniqueMPgraphic{first demo}]

\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

% These two lines can be removed without consequences
\startuniqueMPgraphic{first demo}
\stopuniqueMPgraphic


\startMPpositiongraphic{mypos:circle}
  % absolute coordinates relative to paper by default?
  numeric x, y, w, h, d, radius;
  x = \MPx{\MPvar{self}};
  y = \MPy{\MPvar{self}};
  w = \MPw{\MPvar{self}};
  radius = \MPvar{mypos:circleradius};
  color c;
  c = \MPvar{mypos:circlecolor};
  path p ;
  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;
\stopMPpositiongraphic

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

\stoptext

%%%%%%%%%%%%%%%


Regards,
Chris
___________________________________________________________________________________
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-19  7:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-19  7:00 Elspeth McGullicuddy [this message]
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
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=CAGMMSTBuGTMNSu8tUUrOvfFGzAJJhMAZnACcS10QMN5O3kGu+A@mail.gmail.com \
    --to=elspethmcgullicuddy@gmail.com \
    --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).