ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Strange behaviour? Metapost om connection with MPpage
@ 2004-01-16 22:45 Willi Egger
  2004-01-24  9:54 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Willi Egger @ 2004-01-16 22:45 UTC (permalink / raw)


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

Hi all,

Currently I am preparing a series of figures. I use the approach given 
in Metafun:

\startuseMPgraphic{test}
...
code
...
\stopuseMPgraphic

\starttext
    \startMPpage
          \includeMPgraphic{test}
    \stopMPpage
% \useMPgraphic
\stoptext

The appended code does compile if the MPpage lines are commented. and 
useMPgraphic is uncommented.
Otherwise the following error is given:

! Missing `,' has been inserted.
<to be read again>
                   :
gluedraw->...me_stripe(height,width,linewidth,\@@:
                                                  
linecolor,angle,\@@:gap,sh...
l.248 gluedraw(sq)
                  ;
I use currently: ConTeXt  ver: 2003.12.18  fmt: 2004.1.13

Could some metafun-literate try the code in both versions and see what 
happens?

Thanks Willi



[-- Attachment #2: test.tex --]
[-- Type: text/plain, Size: 1473 bytes --]

\setupoutput[pdftex]
\setupcolors[state=start]

\def\PICT{Test}

\startMPenvironment
  \setupbodyfont[ss,8pt]
\stopMPenvironment

\setupMPvariables
   [\PICT]
   [linecolor=blue,
    gap=.2\bodyfontsize]

\startuseMPgraphic{\PICT}{linecolor,gap}

% the following definition is taken from mp-back.mp and adapted
% in order to be able to fill a given path with a pattern
def some_stripe (expr awidth    ,
                     aheight    ,
                     alinewidth ,
                     alinecolor ,
                     aangle     ,
                     agap       ,
                     ashape_path ) =

  stripe_gap := agap ;
  stripe_angle := aangle ;
  drawoptions (withpen pencircle scaled alinewidth
               withcolor alinecolor) ;
  path p ; p := ashape_path ;
  stripe_path_a () (draw) p ;
enddef;

def gluedraw(expr gluepath)=
       path shape_path; shape_path := gluepath;
       some_stripe
         (height,
          width,
          linewidth,
          \MPvar{linecolor},
          angle,
          \MPvar{gap},
          shape_path);
enddef ;

numeric u; u := 5mm;
numeric width; width := 100u;
numeric height; height := 50u;
numeric angle; angle := 45 ;
numeric linewidth; linewidth :=.5pt;

path sq; sq = (0,0)--(10u,0)--(12u,5u)--(10u,10u)--(0,10u) --cycle ;
fill sq withcolor \MPcolor{red} ;

gluedraw(sq);
\stopuseMPgraphic

\starttext
%     \startMPpage
%         \includeMPgraphic{\PICT}
%     \stopMPpage
\useMPgraphic{\PICT}
\stoptext

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

* Re: Strange behaviour? Metapost om connection with MPpage
  2004-01-16 22:45 Strange behaviour? Metapost om connection with MPpage Willi Egger
@ 2004-01-24  9:54 ` Hans Hagen
  2004-01-24 17:47   ` Willi Egger
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2004-01-24  9:54 UTC (permalink / raw)


At 23:45 16/01/2004, you wrote:
>Hi all,
>
>Currently I am preparing a series of figures. I use the approach given in 
>Metafun:
>
>\startuseMPgraphic{test}
>...
>code
>...
>\stopuseMPgraphic
>
>\starttext
>    \startMPpage
>          \includeMPgraphic{test}
>    \stopMPpage
>% \useMPgraphic

    \useMPgraphic{test} % otherwise it is \useMPgraphic{\stoptext}

>\stoptext

Hans  

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

* Re: Strange behaviour? Metapost om connection  with MPpage
  2004-01-24  9:54 ` Hans Hagen
@ 2004-01-24 17:47   ` Willi Egger
  2004-01-24 19:08     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Willi Egger @ 2004-01-24 17:47 UTC (permalink / raw)


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

Hi Hans,

Hm, tried to use

\starttext
    \startMPpage
          \useMPgraphic{\Pict}
    \stopMPpage
\stoptext

error:
 >> useMPgraphic
! Isolated expression.
<to be read again>
                   {
l.224 \useMPgraphic {
                     Test} ;
?

Otherwise this works:

\starttext
    \useMPgraphic{\Pict}
\stoptext

Strange, I am stumied...

Willi

Hans Hagen wrote:

> At 23:45 16/01/2004, you wrote:
>
>> Hi all,
>>
>> Currently I am preparing a series of figures. I use the approach 
>> given in Metafun:
>>
>> \startuseMPgraphic{test}
>> ...
>> code
>> ...
>> \stopuseMPgraphic
>>
>> \starttext
>>    \startMPpage
>>          \includeMPgraphic{test}
>>    \stopMPpage
>> % \useMPgraphic
>
>
>    \useMPgraphic{test} % otherwise it is \useMPgraphic{\stoptext}
>
>> \stoptext
>


[-- Attachment #2: test.tex --]
[-- Type: text/plain, Size: 1468 bytes --]

\setupoutput[pdftex]
\setupcolors[state=start]

\def\PICT{Test}

\startMPenvironment
  \setupbodyfont[ss,8pt]
\stopMPenvironment

\setupMPvariables
   [\PICT]
   [linecolor=blue,
    gap=.2\bodyfontsize]

\startuseMPgraphic{\PICT}{linecolor,gap}

% the following definition is taken from mp-back.mp and adapted
% in order to be able to fill a given path with a pattern
def some_stripe (expr awidth    ,
                     aheight    ,
                     alinewidth ,
                     alinecolor ,
                     aangle     ,
                     agap       ,
                     ashape_path ) =
  stripe_gap := agap ;
  stripe_angle := aangle ;
  drawoptions (withpen pencircle scaled alinewidth
               withcolor alinecolor) ;
  path p ; p := ashape_path ;
  stripe_path_a () (draw) p ;
enddef;

def gluedraw(expr gluepath)=
       path shape_path; shape_path := gluepath;
       some_stripe
         (height,
          width,
          linewidth,
          \MPvar{linecolor},
          angle,
          \MPvar{gap},
          shape_path);
enddef ;

numeric u; u := 5mm;
numeric width; width := 100u;
numeric height; height := 50u;
numeric angle; angle := 45 ;
numeric linewidth; linewidth :=.5pt;

path sq; sq = (0,0)--(10u,0)--(12u,5u)--(10u,10u)--(0,10u) --cycle ;
fill sq withcolor \MPcolor{red} ;

gluedraw(sq);
\stopuseMPgraphic

\starttext
%     \startMPpage
%         \useMPgraphic{\PICT}
%     \stopMPpage
\useMPgraphic{\PICT}
\stoptext

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

* Re: Strange behaviour? Metapost om connection  with MPpage
  2004-01-24 17:47   ` Willi Egger
@ 2004-01-24 19:08     ` Hans Hagen
  2004-01-25 17:16       ` Willi Egger
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2004-01-24 19:08 UTC (permalink / raw)


At 18:47 24/01/2004, you wrote:
>Hi Hans,
>
>Hm, tried to use
>
>\starttext
>    \startMPpage
>          \useMPgraphic{\Pict}

\includeMPgraphic{...}


Hans

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

* Re: Strange behaviour? Metapost om connection   with MPpage
  2004-01-24 19:08     ` Hans Hagen
@ 2004-01-25 17:16       ` Willi Egger
  0 siblings, 0 replies; 5+ messages in thread
From: Willi Egger @ 2004-01-25 17:16 UTC (permalink / raw)


Hi Hans,

So we are dancing in a circle? - No problem, I detected in an old file, 
that I used \startTEXpage instead of \startMPpage. When issuing 
\startTEXpage the figures compile perfectly an I get the pagesized to 
the boundingbox of the picture!

Thanks for your guidance

Willi


Hans Hagen wrote:
> At 18:47 24/01/2004, you wrote:
> 
>> Hi Hans,
>>
>> Hm, tried to use
>>
>> \starttext
>>    \startMPpage
>>          \useMPgraphic{\Pict}
> 
> 
> \includeMPgraphic{...}
> 
> 
> Hans
> 
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

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

end of thread, other threads:[~2004-01-25 17:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-16 22:45 Strange behaviour? Metapost om connection with MPpage Willi Egger
2004-01-24  9:54 ` Hans Hagen
2004-01-24 17:47   ` Willi Egger
2004-01-24 19:08     ` Hans Hagen
2004-01-25 17:16       ` Willi Egger

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