* A question on drawing functions in MetaFun
@ 2005-08-10 13:55 Jin-Hwan Cho
2005-08-10 23:26 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Jin-Hwan Cho @ 2005-08-10 13:55 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 952 bytes --]
I tried to generate "Figure 9.2 An example of a graphic with labels
along the axes." in metafun-p.pdf (p.209), but could get only graphics
without labels.
I used the codes in the page 208 as follows (see the attached file)
\startMPpage
StartPage ;
... codes in p.208 here ...
StopPage ;
\stopMPpage
In this case, the generated MPS file (ch93-1-mpgraph.1) had the bounding
box (0, 0, 420, 596).
When I used \startuseMPgraphic instead of \startMPpage, the generated
MPS file had the different bounding box (-47, -17, 300, 575), and I
could see the right one.
Please tell me what I missed.
Best, ChoF.
~~~~~~~~~~~~~~~~~~~~~~~~~ ***
| Cho, Jin-Hwan == ChoF | ^ ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~ o
| Dept. of Mathematics | ---
| The University of Suwon | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| Korean TeX Users Group | |
| http://www.ktug.or.kr | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| chofchof@ktug.or.kr | ***
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[-- Attachment #2: ch93-1.tex --]
[-- Type: application/octet-stream, Size: 1202 bytes --]
% Chapter 9. Functions
%
% 9.3 Drawing functions
\setupcolors [state=start]
\starttext
% If \startMPpage is used, the generating mps graphic does not have
% accurate bounding box. Why?
%\startuseMPgraphic{function demo}
\startMPpage
StartPage ;
drawoptions(withpen pencircle scaled .25pt withcolor .5white) ;
draw hlingrid (0, 20, .2, 20cm, 10cm) ;
draw vloggrid (0, 10, .5, 10cm, 20cm) ;
drawoptions(withpen pencircle scaled .50pt) ;
draw hlingrid (0, 20, 1, 20cm, 10cm) ;
draw vloggrid (0, 10, 1, 10cm, 20cm) ;
fmt_pictures := false ; % use the TeX as formatting engine
textextoffset := ExHeight ; % a variable set by ConTeXt
draw hlintext.lft(0, 20, 5, 20cm, "@3e") ;
draw vlogtext.bot(0, 10, 9, 10cm, "@3e") ;
draw
function(1,"log(x)","x",1,10,1) xyscaled (10cm,2cm)
withpen pencircle scaled 5mm withcolor transparent(1,.5,yellow) ;
draw
function(2,".5log(x)","x",1,10,1) xyscaled (10cm,2cm)
withpen pencircle scaled 5mm withcolor transparent(1,.5,blue) ;
StopPage ;
\stopMPpage
%\stopuseMPgraphic
\useMPgraphic{function demo}
\stoptext
[-- Attachment #3: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-10 13:55 A question on drawing functions in MetaFun Jin-Hwan Cho
@ 2005-08-10 23:26 ` Hans Hagen
2005-08-12 8:42 ` Jin-Hwan Cho
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2005-08-10 23:26 UTC (permalink / raw)
Jin-Hwan Cho wrote:
> \startMPpage
> StartPage ;
> ... codes in p.208 here ...
> StopPage ;
> \stopMPpage
>
> In this case, the generated MPS file (ch93-1-mpgraph.1) had the bounding
> box (0, 0, 420, 596).
>
> When I used \startuseMPgraphic instead of \startMPpage, the generated
> MPS file had the different bounding box (-47, -17, 300, 575), and I
> could see the right one.
StartPage .. StopPage will make a graphic as large as the current page; dimensions are passed by context to mp, but this happens before the graphic is drawn; so, the graphic becomes (default) a4.
just omit the StartPage .. StopPage (the inner ones)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-10 23:26 ` Hans Hagen
@ 2005-08-12 8:42 ` Jin-Hwan Cho
2005-08-12 10:15 ` Vit Zyka
0 siblings, 1 reply; 10+ messages in thread
From: Jin-Hwan Cho @ 2005-08-12 8:42 UTC (permalink / raw)
On Aug 11, 2005, at 8:26 AM, Hans Hagen wrote:
> StartPage .. StopPage will make a graphic as large as the current
> page; dimensions are passed by context to mp, but this happens
> before the graphic is drawn; so, the graphic becomes (default) a4.
> just omit the StartPage .. StopPage (the inner ones)
Got it. Thanks a lot. Could you tell me the answer of my previous
posting
on Aug 11, about \Shaped definition?
Best, ChoF.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-12 8:42 ` Jin-Hwan Cho
@ 2005-08-12 10:15 ` Vit Zyka
2005-08-12 15:06 ` Jin-Hwan Cho
0 siblings, 1 reply; 10+ messages in thread
From: Vit Zyka @ 2005-08-12 10:15 UTC (permalink / raw)
Jin-Hwan Cho wrote:
> On Aug 11, 2005, at 8:26 AM, Hans Hagen wrote:
>
>> StartPage .. StopPage will make a graphic as large as the current
>> page; dimensions are passed by context to mp, but this happens before
>> the graphic is drawn; so, the graphic becomes (default) a4.
>> just omit the StartPage .. StopPage (the inner ones)
>
>
> Got it. Thanks a lot. Could you tell me the answer of my previous posting
> on Aug 11, about \Shaped definition?
Try to play with
\defineframed[Shaped][...=...]
\Shaped{...}
vit
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-12 10:15 ` Vit Zyka
@ 2005-08-12 15:06 ` Jin-Hwan Cho
2005-08-12 16:10 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Jin-Hwan Cho @ 2005-08-12 15:06 UTC (permalink / raw)
On Aug 12, 2005, at 7:15 PM, Vit Zyka wrote:
> \defineframed[Shaped][...=...]
Thanks. However what I wanted to know was the definition of \Shaped
which generates the second figure in p.145 of metafun-p.pdf (the oval
shape in the second line went to under the first oval).
Best, ChoF.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-12 15:06 ` Jin-Hwan Cho
@ 2005-08-12 16:10 ` Hans Hagen
2005-08-12 17:14 ` Jin-Hwan Cho
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2005-08-12 16:10 UTC (permalink / raw)
Jin-Hwan Cho wrote:
> On Aug 12, 2005, at 7:15 PM, Vit Zyka wrote:
>
>> \defineframed[Shaped][...=...]
>
>
> Thanks. However what I wanted to know was the definition of \Shaped
> which generates the second figure in p.145 of metafun-p.pdf (the oval
> shape in the second line went to under the first oval).
\startbuffer[def]
\defineframed[Shaped][background=Shape,frame=off,location=low]
\stopbuffer
\getbuffer[def]
We can now put this background shape behind the running text,
for instance with:
\startbuffer
.... some \inframed[background=Shape]{text} with a frame ...
.... some \Shaped{text} with a frame ...
\stopbuffer
\typebuffer
\startlines
\getbuffer
\stoplines
The \type {\Shaped} macro was defined as:
\typebuffer[def]
>>> this last line had no [def] so the wrong buffer was shown; it's indeed defined by \defineframed[Shapes]
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-12 16:10 ` Hans Hagen
@ 2005-08-12 17:14 ` Jin-Hwan Cho
2005-08-12 22:00 ` Vit Zyka
2005-08-15 11:56 ` Hans Hagen
0 siblings, 2 replies; 10+ messages in thread
From: Jin-Hwan Cho @ 2005-08-12 17:14 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 399 bytes --]
On Aug 13, 2005, at 1:10 AM, Hans Hagen wrote:
> \defineframed[Shaped][background=Shape,frame=off,location=low]
Thanks. Still I could not get the right figure with
\setuplayer[BackLayer][direction=reverse]
Even though "direction=reverse" option was given, I got only the first
figure. Means that the option did not work. Hope anyone fix my problem
by checking the attached sample.
Best, ChoF.
[-- Attachment #2: ch53-2.tex --]
[-- Type: application/octet-stream, Size: 748 bytes --]
% Chapter 5. Positional Graphics
%
% 5.3 More layers
\setupcolors [state=start]
\setupinteraction [state=start]
\starttext
\definelayer[BackLayer][position=yes]
\setuplayer[BackLayer][direction=reverse]
\setupbackgrounds[page][background=BackLayer]
\defineoverlay[Shape] [BackLayer] [\uniqueMPgraphic{Shape}]
\startuniqueMPgraphic{Shape}
path p ; p := fullcircle xyscaled(OverlayWidth,OverlayHeight) ;
fill p withcolor \MPcolor{lightgray} ;
draw p withpen pencircle scaled 1pt withcolor \MPcolor{darkred} ;
\stopuniqueMPgraphic
\defineframed[Shaped][background=Shape,frame=off,location=low]
\startlines
.... some \inframed[background=Shape]{text} with a frame ...
.... some \Shaped{text} with a frame ...
\stoplines
\stoptext
[-- Attachment #3: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-12 17:14 ` Jin-Hwan Cho
@ 2005-08-12 22:00 ` Vit Zyka
2005-08-12 22:33 ` Hans Hagen
2005-08-15 11:56 ` Hans Hagen
1 sibling, 1 reply; 10+ messages in thread
From: Vit Zyka @ 2005-08-12 22:00 UTC (permalink / raw)
Jin-Hwan Cho wrote:
> On Aug 13, 2005, at 1:10 AM, Hans Hagen wrote:
>
>> \defineframed[Shaped][background=Shape,frame=off,location=low]
>
>
> Thanks. Still I could not get the right figure with
>
> \setuplayer[BackLayer][direction=reverse]
>
> Even though "direction=reverse" option was given, I got only the first
Ou, now I understand. I got exactly the same result as you. Seems
'direction' is ommited. The only relevant occurence in the source is in
the core-lyr.tex, but sorry, I have no solution.
vit
> figure. Means that the option did not work. Hope anyone fix my problem
> by checking the attached sample.
>
> Best, ChoF.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-12 22:00 ` Vit Zyka
@ 2005-08-12 22:33 ` Hans Hagen
0 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2005-08-12 22:33 UTC (permalink / raw)
Vit Zyka wrote:
> Jin-Hwan Cho wrote:
>
>> On Aug 13, 2005, at 1:10 AM, Hans Hagen wrote:
>>
>>> \defineframed[Shaped][background=Shape,frame=off,location=low]
>>
>>
>>
>> Thanks. Still I could not get the right figure with
>>
>> \setuplayer[BackLayer][direction=reverse]
>>
>> Even though "direction=reverse" option was given, I got only the first
>
>
> Ou, now I understand. I got exactly the same result as you. Seems
> 'direction' is ommited. The only relevant occurence in the source is
> in the core-lyr.tex, but sorry, I have no solution.
i'll have a look at it
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: A question on drawing functions in MetaFun
2005-08-12 17:14 ` Jin-Hwan Cho
2005-08-12 22:00 ` Vit Zyka
@ 2005-08-15 11:56 ` Hans Hagen
1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2005-08-15 11:56 UTC (permalink / raw)
Jin-Hwan Cho wrote:
> On Aug 13, 2005, at 1:10 AM, Hans Hagen wrote:
>
>> \defineframed[Shaped][background=Shape,frame=off,location=low]
>
>
> Thanks. Still I could not get the right figure with
>
> \setuplayer[BackLayer][direction=reverse]
>
> Even though "direction=reverse" option was given, I got only the first
> figure. Means that the option did not work. Hope anyone fix my problem
> by checking the attached sample.
it took me a while to uncover but ... in page-lyr,
\doifnotvalue{\layerparameter\c!direction}\v!reverse{\box\layerpagebox}%
should be
\doifnot{\layerparameter\c!direction}\v!reverse{\box\layerpagebox}%
(bug introduced when \layerparameter was added)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-08-15 11:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-10 13:55 A question on drawing functions in MetaFun Jin-Hwan Cho
2005-08-10 23:26 ` Hans Hagen
2005-08-12 8:42 ` Jin-Hwan Cho
2005-08-12 10:15 ` Vit Zyka
2005-08-12 15:06 ` Jin-Hwan Cho
2005-08-12 16:10 ` Hans Hagen
2005-08-12 17:14 ` Jin-Hwan Cho
2005-08-12 22:00 ` Vit Zyka
2005-08-12 22:33 ` Hans Hagen
2005-08-15 11:56 ` Hans Hagen
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).