Command "show" in Metapost/Metafun
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.
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
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 -----------------------------------------------------------------
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.
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 ___________________________________________________________________________________
Taco Hoekwater
(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.
On Fri, Mar 13, 2009 at 2:39 PM, Curious Learn
Taco Hoekwater
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
Curious Learn wrote:
Taco Hoekwater
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;
participants (6)
-
Aditya Mahajan
-
Albrecht Kauffmann
-
Curious Learn
-
Hans Hagen
-
Mikael Persson
-
Taco Hoekwater