ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MPpositiongraphic: I don't know when it's going to work and when it's not.
@ 2014-01-19  7:00 Elspeth McGullicuddy
  2014-01-20 17:55 ` Hans Hagen
  2014-01-20 17:57 ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Elspeth McGullicuddy @ 2014-01-19  7:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


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

* Re: MPpositiongraphic: I don't know when it's going to work and when it's not.
  2014-01-19  7:00 MPpositiongraphic: I don't know when it's going to work and when it's not Elspeth McGullicuddy
@ 2014-01-20 17:55 ` Hans Hagen
  2014-01-20 17:57 ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2014-01-20 17:55 UTC (permalink / raw)
  To: ntg-context

On 1/19/2014 8:00 AM, Elspeth McGullicuddy wrote:

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

so that is effectively background={ my first overlay, my fourth overlay}

spaces after , are gobbled so if you want to comment things like that do 
this

\setupbackgrounds[paper][background={%
      my first overlay,%
      my fourth overlay%
}]

now you can comment one of both lines

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


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

* Re: MPpositiongraphic: I don't know when it's going to work and when it's not.
  2014-01-19  7:00 MPpositiongraphic: I don't know when it's going to work and when it's not Elspeth McGullicuddy
  2014-01-20 17:55 ` Hans Hagen
@ 2014-01-20 17:57 ` Hans Hagen
  2014-01-23 23:52   ` Elspeth McGullicuddy
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2014-01-20 17:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 1/19/2014 8:00 AM, Elspeth McGullicuddy wrote:
> \framed [ background=my first overlay,my fourth
> overlay,align=middle,width=7cm] {
>    have attached it: \hpos{three}{{\em here}}, the}

here

background=my first overlay

and

my fourth overlay

a key without value

so: be careful with spaces and commas

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


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

* Re: MPpositiongraphic: I don't know when it's going to work and when it's not.
  2014-01-20 17:57 ` Hans Hagen
@ 2014-01-23 23:52   ` Elspeth McGullicuddy
  2014-01-27 12:34     ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Elspeth McGullicuddy @ 2014-01-23 23:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2065 bytes --]

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.

Chris


On Mon, Jan 20, 2014 at 6:57 PM, Hans Hagen <pragma@wxs.nl> wrote:
> On 1/19/2014 8:00 AM, Elspeth McGullicuddy wrote:
>>
>> \framed [ background=my first overlay,my fourth

The line break here wasn't in my file.

>> overlay,align=middle,width=7cm] {
>>    have attached it: \hpos{three}{{\em here}}, the}
>
>
> here
>
> background=my first overlay
>
> and
>
> my fourth overlay
>
> a key without value
>
> so: be careful with spaces and commas
>
> -----------------------------------------------------------------
>                                           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
> ___________________________________________________________________________________

[-- Attachment #2: test-012_02.tex --]
[-- Type: application/x-tex, Size: 950 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: MPpositiongraphic: I don't know when it's going to work and when it's not.
  2014-01-23 23:52   ` Elspeth McGullicuddy
@ 2014-01-27 12:34     ` Hans Hagen
  2014-01-27 23:10       ` Elspeth McGullicuddy
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2014-01-27 12:34 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________


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

* Re: MPpositiongraphic: I don't know when it's going to work and when it's not.
  2014-01-27 12:34     ` Hans Hagen
@ 2014-01-27 23:10       ` Elspeth McGullicuddy
  0 siblings, 0 replies; 6+ messages in thread
From: Elspeth McGullicuddy @ 2014-01-27 23:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Jan 27, 2014 at 1:34 PM, Hans Hagen <pragma@wxs.nl> wrote:
>
> you need to anchor the graphic:
>
>     anchor_box(\MPanchor{\MPvar{self}}) ;

Thanks a lot, it works now. I wouldn't have guessed: I learnt a lot with that.

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
___________________________________________________________________________________


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

end of thread, other threads:[~2014-01-27 23:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-19  7:00 MPpositiongraphic: I don't know when it's going to work and when it's not 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
2014-01-27 23:10       ` Elspeth McGullicuddy

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).