ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Command "show" in Metapost/Metafun
@ 2009-03-12  0:53 Curious Learn
  2009-03-12  4:44 ` Aditya Mahajan
  0 siblings, 1 reply; 12+ messages in thread
From: Curious Learn @ 2009-03-12  0:53 UTC (permalink / raw)
  To: ntg-context

Hi,

I am trying to learn Metapost using Context. I tried a few examples for drawing
things and they worked well. But the "show" command does not seem to work. For
example, the code 

\startuseMPgraphic{GridDots}
	u=1cm;
	pickup pencircle scaled 8pt
	for i = 0 upto 2:
		for j = 0 upto 2: draw (i*u,j*u); endfor
	endfor 
\stopuseMPgraphic  
\useMPgraphic{GridDots}  

from John Hobby's manual works great. 

However, the following code gives no output in the PDF file. Am I doing
something wrong?

\startuseMPgraphic{LinearEq}
   a+b = 2a - b = 3;
   show a,b;
\stopuseMPgraphic  
\useMPgraphic{LinearEq}  

I am using the following version from Texlive
ConTeXt  ver: 2008.05.21 15:21 MKII  fmt: 2008.10.1  int: english/english

Thanks for your help.

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Command "show" in Metapost/Metafun
  2009-03-12  0:53 Command "show" in Metapost/Metafun Curious Learn
@ 2009-03-12  4:44 ` Aditya Mahajan
  2009-03-12  8:40   ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Aditya Mahajan @ 2009-03-12  4:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 12 Mar 2009, Curious Learn wrote:

> Hi,
>
> I am trying to learn Metapost using Context. I tried a few examples for drawing
> things and they worked well. But the "show" command does not seem to work. For
> example, the code
>
> \startuseMPgraphic{GridDots}
> 	u=1cm;
> 	pickup pencircle scaled 8pt
> 	for i = 0 upto 2:
> 		for j = 0 upto 2: draw (i*u,j*u); endfor
> 	endfor
> \stopuseMPgraphic
> \useMPgraphic{GridDots}
>
> from John Hobby's manual works great.
>
> However, the following code gives no output in the PDF file. Am I doing
> something wrong?
>
> \startuseMPgraphic{LinearEq}
>   a+b = 2a - b = 3;
>   show a,b;
> \stopuseMPgraphic
> \useMPgraphic{LinearEq}
>
> I am using the following version from Texlive
> ConTeXt  ver: 2008.05.21 15:21 MKII  fmt: 2008.10.1  int: english/english

The output of show goes to the terminal and the log file. Look for the 
values in filename-mpgraph.log.

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Command "show" in Metapost/Metafun
  2009-03-12  4:44 ` Aditya Mahajan
@ 2009-03-12  8:40   ` Hans Hagen
  2009-03-12 15:42     ` Aditya Mahajan
  2009-03-12 23:11     ` Thanks. Two new questions: rotate and scale Curious Learn
  0 siblings, 2 replies; 12+ messages in thread
From: Hans Hagen @ 2009-03-12  8:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Aditya Mahajan wrote:
> On Thu, 12 Mar 2009, Curious Learn wrote:
> 
>> Hi,
>>
>> I am trying to learn Metapost using Context. I tried a few examples 
>> for drawing
>> things and they worked well. But the "show" command does not seem to 
>> work. For
>> example, the code
>>
>> \startuseMPgraphic{GridDots}
>>     u=1cm;
>>     pickup pencircle scaled 8pt
>>     for i = 0 upto 2:
>>         for j = 0 upto 2: draw (i*u,j*u); endfor
>>     endfor
>> \stopuseMPgraphic
>> \useMPgraphic{GridDots}
>>
>> from John Hobby's manual works great.
>>
>> However, the following code gives no output in the PDF file. Am I doing
>> something wrong?
>>
>> \startuseMPgraphic{LinearEq}
>>   a+b = 2a - b = 3;
>>   show a,b;
>> \stopuseMPgraphic
>> \useMPgraphic{LinearEq}
>>
>> I am using the following version from Texlive
>> ConTeXt  ver: 2008.05.21 15:21 MKII  fmt: 2008.10.1  int: english/english
> 
> The output of show goes to the terminal and the log file. Look for the 
> values in filename-mpgraph.log.

\ctxlua{metapost.showlog = true}


-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Command "show" in Metapost/Metafun
  2009-03-12  8:40   ` Hans Hagen
@ 2009-03-12 15:42     ` Aditya Mahajan
  2009-03-12 23:11     ` Thanks. Two new questions: rotate and scale Curious Learn
  1 sibling, 0 replies; 12+ messages in thread
From: Aditya Mahajan @ 2009-03-12 15:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 12 Mar 2009, Hans Hagen wrote:

> \ctxlua{metapost.showlog = true}

Can you make this default?

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Thanks. Two new questions: rotate and scale
  2009-03-12  8:40   ` Hans Hagen
  2009-03-12 15:42     ` Aditya Mahajan
@ 2009-03-12 23:11     ` Curious Learn
  2009-03-13 11:23       ` Albrecht Kauffmann
  1 sibling, 1 reply; 12+ messages in thread
From: Curious Learn @ 2009-03-12 23:11 UTC (permalink / raw)
  To: ntg-context

Aditya and Hans,

Thanks very much for your replies. I suppose I should install minimals afterall.
Still using the TexLive version. 

I have two new questions:

(1) In the following code the triangle outline (obtained with the "draw"
command) does not rotate, i.e., I get the same triangle as without the "rotated"
command. On the other hand the fill command rotates as expected. What is wrong?

\startuseMPgraphic{Dir} 
pickup pencircle scaled 2pt;
numeric u;
u=2cm;
draw (0,0) -- dir(0)*u -- dir(60)*u --cycle rotated 60;
fill (0,0) -- dir(0)*u -- dir(60)*u --cycle rotated 60 withcolor (0.58,0.94,0.9);
\stopuseMPgraphic  
\useMPgraphic{Dir} 


(2) Is there a command to scale the whole picture...not the components? 

Thanks very much. 

I have said this before but want to say this again. Thanks so much to the
developers of Context who have given us this wonderful system. Thanks also to
all the people on this mailing list who take their precious time to answer
questions.   

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Thanks. Two new questions: rotate and scale
  2009-03-12 23:11     ` Thanks. Two new questions: rotate and scale Curious Learn
@ 2009-03-13 11:23       ` Albrecht Kauffmann
  2009-03-13 11:59         ` Curious Learn
  2009-03-13 12:09         ` Taco Hoekwater
  0 siblings, 2 replies; 12+ messages in thread
From: Albrecht Kauffmann @ 2009-03-13 11:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

only to (1): try

draw (((0,0) -- dir(0)*u -- dir(60)*u --cycle) rotated 60);

greetings,
Albrecht


On Thu, 12 Mar 2009, Curious Learn wrote:

> Aditya and Hans,
>
> Thanks very much for your replies. I suppose I should install minimals afterall.
> Still using the TexLive version.
>
> I have two new questions:
>
> (1) In the following code the triangle outline (obtained with the "draw"
> command) does not rotate, i.e., I get the same triangle as without the "rotated"
> command. On the other hand the fill command rotates as expected. What is wrong?
>
> \startuseMPgraphic{Dir}
> pickup pencircle scaled 2pt;
> numeric u;
> u=2cm;
> draw (0,0) -- dir(0)*u -- dir(60)*u --cycle rotated 60;
> fill (0,0) -- dir(0)*u -- dir(60)*u --cycle rotated 60 withcolor (0.58,0.94,0.9);
> \stopuseMPgraphic
> \useMPgraphic{Dir}
>
>
> (2) Is there a command to scale the whole picture...not the components?
>
> Thanks very much.
>
> I have said this before but want to say this again. Thanks so much to the
> developers of Context who have given us this wonderful system. Thanks also to
> all the people on this mailing list who take their precious time to answer
> questions.
>
> ___________________________________________________________________________________
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Thanks. Two new questions: rotate and scale
  2009-03-13 11:23       ` Albrecht Kauffmann
@ 2009-03-13 11:59         ` Curious Learn
  2009-03-13 12:09         ` Taco Hoekwater
  1 sibling, 0 replies; 12+ messages in thread
From: Curious Learn @ 2009-03-13 11:59 UTC (permalink / raw)
  To: ntg-context

Albrecht Kauffmann <alkauffm <at> rz.uni-potsdam.de> writes:

> 
> only to (1): try
> 
> draw (((0,0) -- dir(0)*u -- dir(60)*u --cycle) rotated 60);

Thanks Albrecht. That worked great.

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Thanks. Two new questions: rotate and scale
  2009-03-13 11:23       ` Albrecht Kauffmann
  2009-03-13 11:59         ` Curious Learn
@ 2009-03-13 12:09         ` Taco Hoekwater
  2009-03-13 13:39           ` Curious Learn
  1 sibling, 1 reply; 12+ messages in thread
From: Taco Hoekwater @ 2009-03-13 12:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>>
>> (2) Is there a command to scale the whole picture...not the components?

Parse error. In my view, the whole picture *is* the components.

Best wishes,
Taco

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Thanks. Two new questions: rotate and scale
  2009-03-13 12:09         ` Taco Hoekwater
@ 2009-03-13 13:39           ` Curious Learn
  2009-03-13 13:44             ` Mikael Persson
  2009-03-13 13:56             ` Taco Hoekwater
  0 siblings, 2 replies; 12+ messages in thread
From: Curious Learn @ 2009-03-13 13:39 UTC (permalink / raw)
  To: ntg-context

Taco Hoekwater <taco <at> elvenkind.com> writes:


> >> (2) Is there a command to scale the whole picture...not the components?
> 
> Parse error. In my view, the whole picture *is* the components.
> 
> Best wishes,
> Taco

Hi Taco,

Sorry for the typo and for not being clear. I meant the following. I know that
"scaled" command can be used to scale any particular component. To scale the
whole picture does one have to scale each and every component individually, or
is there one command that scales every component. 

One way is perhaps to define a variable, say u=1cm and express all measurements
in terms of "u". Then by changing just "u" one can scale the whole picture (and
all the components) up or down. Is there another way? For example, in TikZ there
is a command "scale" which scales the entire picture if put as an option to
\begin{tikzpicture}. I was wondering if something like that is available in
Metapost too.




___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Thanks. Two new questions: rotate and scale
  2009-03-13 13:39           ` Curious Learn
@ 2009-03-13 13:44             ` Mikael Persson
  2009-03-13 13:56             ` Taco Hoekwater
  1 sibling, 0 replies; 12+ messages in thread
From: Mikael Persson @ 2009-03-13 13:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Mar 13, 2009 at 2:39 PM, Curious Learn <curiouslearn@gmail.com> wrote:
> Taco Hoekwater <taco <at> elvenkind.com> writes:
>
>
>> >> (2) Is there a command to scale the whole picture...not the components?
>>
>> Parse error. In my view, the whole picture *is* the components.
>>
>> Best wishes,
>> Taco
>
> Hi Taco,
>
> Sorry for the typo and for not being clear. I meant the following. I know that
> "scaled" command can be used to scale any particular component. To scale the
> whole picture does one have to scale each and every component individually, or
> is there one command that scales every component.
>
> One way is perhaps to define a variable, say u=1cm and express all measurements
> in terms of "u". Then by changing just "u" one can scale the whole picture (and
> all the components) up or down. Is there another way? For example, in TikZ there
> is a command "scale" which scales the entire picture if put as an option to
> \begin{tikzpicture}. I was wondering if something like that is available in
> Metapost too.
>

Hi,

I use the method of
u=1mm;
in the beginning and then use u as the "unit".
I think "currentpicture" is what you are after otherwise, but not sure.

Mikael
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Thanks. Two new questions: rotate and scale
  2009-03-13 13:39           ` Curious Learn
  2009-03-13 13:44             ` Mikael Persson
@ 2009-03-13 13:56             ` Taco Hoekwater
  2009-03-13 14:43               ` Curious Learn
  1 sibling, 1 reply; 12+ messages in thread
From: Taco Hoekwater @ 2009-03-13 13:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Curious Learn wrote:
> Taco Hoekwater <taco <at> elvenkind.com> writes:
> 
> 
>>>> (2) Is there a command to scale the whole picture...not the components?
>> Parse error. In my view, the whole picture *is* the components.
>>
>> Best wishes,
>> Taco
> 
> Hi Taco,
> 
> Sorry for the typo and for not being clear. I meant the following. I know that
> "scaled" command can be used to scale any particular component. To scale the
> whole picture does one have to scale each and every component individually, or
> is there one command that scales every component. 

You want this, I think:

  beginfig(1);
  ... do stuff ...
  currentpicture := currentpicture scaled X;
  endfig;


___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Thanks. Two new questions: rotate and scale
  2009-03-13 13:56             ` Taco Hoekwater
@ 2009-03-13 14:43               ` Curious Learn
  0 siblings, 0 replies; 12+ messages in thread
From: Curious Learn @ 2009-03-13 14:43 UTC (permalink / raw)
  To: ntg-context

Taco Hoekwater <taco <at> elvenkind.com> writes:

> 
> You want this, I think:
> 
>   beginfig(1);
>   ... do stuff ...
>   currentpicture := currentpicture scaled X;
>   endfig;
> 
 
Awesome!! This is exactly what I was looking for. 

Thanks Taco and Mikael.


___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2009-03-13 14:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-12  0:53 Command "show" in Metapost/Metafun Curious Learn
2009-03-12  4:44 ` Aditya Mahajan
2009-03-12  8:40   ` Hans Hagen
2009-03-12 15:42     ` Aditya Mahajan
2009-03-12 23:11     ` Thanks. Two new questions: rotate and scale Curious Learn
2009-03-13 11:23       ` Albrecht Kauffmann
2009-03-13 11:59         ` Curious Learn
2009-03-13 12:09         ` Taco Hoekwater
2009-03-13 13:39           ` Curious Learn
2009-03-13 13:44             ` Mikael Persson
2009-03-13 13:56             ` Taco Hoekwater
2009-03-13 14:43               ` Curious Learn

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