ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Metapost and graphics
@ 2000-04-24  5:22 pragma
  0 siblings, 0 replies; 2+ messages in thread
From: pragma @ 2000-04-24  5:22 UTC (permalink / raw)


>Hello,
>
>I'm new to ConTeXt and interested in including graphs in my
documents. Since
>PSTricks doesn't appear to be supported I've turned to
METAPOST. I have some
>questions about the code below.

You can say: \usemodule[m-pstric] but indeed that does not work
with pdf. 

>1. I've tried some of the examples from the MP docs and
occasionally, the
>"test" graphic fails when the beginfig(1)/endfig pair is
included.

That is because your beginfig overloads the automatic ones. So,
no beginfig etc is needed.

>2. Which is the preferred way to call the "test" image, (1) or
(2) (see
>below)?
>
>3. What is the purpose of the pair
\startMPgraphic...\stopMPgraphic? It
>doesn't seem to do anything.

I bet it does. Add \runMPgraphicstrue (can also go in
cont-sys.tex) and enable write18 in texmf.cnf and you will see
that context generates the graphics runtime (otherwise they are
generated between runs)

>In the docs that I've found, there doesn't seem to be much on
METAPOST info.
>For example, the "graph" package isn't supported. Is there a
more extensive
>discussion of ConTeXt support of METAPOST somewhere?

As far as I know the graph package should work. You can always
make external figures and include them with \externalfigure. 

>\startuseMPgraphic{test}
#### this wone is not needed >beginfig(1);
>	u=1cm;
>	draw (2u,2u)--(0,0)--(0,3u)--(3u,0)--(0,0);
>	pickup pencircle scaled 4pt;
>	for i=0 upto 2:
>	  for j=0 upto 2:
>		 draw (i*u,j*u);
>	  endfor
>	endfor
#### nor is this one >endfig;
>\stopuseMPgraphic
>%1
>\useMPgraphic{test}

ok, should work now

>%2
>\externalfigure[mpgraph.1]

no, but when you make a graphic outside context you can say: 

\externalfigure[somefile.123]

>%3
>\startMPgraphic
>	%same mp code as above.
>\stopMPgraphic

You need to provide a name like {test}

Remark: when color is disables, contextwill automatically
convert color in MP files into weighted grayscales. \

Hans


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

* Metapost and graphics
@ 2000-04-23  0:06 Richard Hensh
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Hensh @ 2000-04-23  0:06 UTC (permalink / raw)


Hello,

I'm new to ConTeXt and interested in including graphs in my documents. Since
PSTricks doesn't appear to be supported I've turned to METAPOST. I have some
questions about the code below.

1. I've tried some of the examples from the MP docs and occasionally, the
"test" graphic fails when the beginfig(1)/endfig pair is included.

2. Which is the preferred way to call the "test" image, (1) or (2) (see
below)?

3. What is the purpose of the pair \startMPgraphic...\stopMPgraphic? It
doesn't seem to do anything.

In the docs that I've found, there doesn't seem to be much on METAPOST info.
For example, the "graph" package isn't supported. Is there a more extensive
discussion of ConTeXt support of METAPOST somewhere?

thanks in advance
ricky

+++++++++++++++++++++++++++++++++++++++++++++
\startuseMPgraphic{test}
beginfig(1);
	u=1cm;
	draw (2u,2u)--(0,0)--(0,3u)--(3u,0)--(0,0);
	pickup pencircle scaled 4pt;
	for i=0 upto 2:
	  for j=0 upto 2:
		 draw (i*u,j*u);
	  endfor
	endfor
endfig;
\stopuseMPgraphic
%1
\useMPgraphic{test}
%2
\externalfigure[mpgraph.1]
%3
\startMPgraphic
	%same mp code as above.
\stopMPgraphic
+++++++++++++++++++++++++++++++++++++++++++++++++


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

end of thread, other threads:[~2000-04-24  5:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-24  5:22 Metapost and graphics pragma
  -- strict thread matches above, loose matches on Subject: below --
2000-04-23  0:06 Richard Hensh

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