* importing figures in metapost
@ 2005-06-11 14:52 andrea valle
2005-06-12 15:50 ` Mojca Miklavec
0 siblings, 1 reply; 8+ messages in thread
From: andrea valle @ 2005-06-11 14:52 UTC (permalink / raw)
Hi to all,
newbie here, so please pardon me if I'm asking obvious things.
I'm a latex user, but I am fascinated by context.
I've a project and I'd like to know if it's possible to do it in
context.
The idea is the following:
I have to draw a directed graph representing relations between musical
elements. My graph is made of nodes and links. Links are represented as
arrows as usual, but they should include a label with text displayed
near to each of them.
Nodes should be blocks of musical notation.
Now, I'm using lilypond to generate musical fragments
(www.lilypond.org). Lilypond outputs ps, pdf and png also. For my
project actually I am using the pgf package under latex. In this way I
can create graphs: I can draw lines with arrows, I can give each vertex
an xy pair of coordinates, and I can associate each vertex an external
figure.
But I'n not satisfied with the output, and I like very much context
capabilties: more, metafun is amazing.
Taking a look at the metafun doc, it seems to me that the drawing the
edges should be a very simple task.
But: is it possible to import an external figure inside metapost giving
it a precise place in terms of xy coordinates?
Thanks a lot
-a-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: importing figures in metapost
2005-06-11 14:52 importing figures in metapost andrea valle
@ 2005-06-12 15:50 ` Mojca Miklavec
[not found] ` <b8288e98f6a2750159050409b84b09f0@unito.it>
2005-06-14 3:04 ` h h extern
0 siblings, 2 replies; 8+ messages in thread
From: Mojca Miklavec @ 2005-06-12 15:50 UTC (permalink / raw)
Cc: andrea valle
andrea valle wrote:
> But: is it possible to import an external figure inside metapost giving
> it a precise place in terms of xy coordinates?
Sure:
externalfigure "filename.pdf"
xyscaled (theWidth, theHeight)
shifted (theLowerLeftX, theLowerLeftY);
(However, I don't know if there's a way to include a picture without the
need to provide width and height explicitly.)
Mojca
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: importing figures in metapost
[not found] ` <42ADA01B.4010604@gmail.com>
@ 2005-06-13 15:52 ` andrea valle
2005-06-13 15:56 ` andrea valle
1 sibling, 0 replies; 8+ messages in thread
From: andrea valle @ 2005-06-13 15:52 UTC (permalink / raw)
Cc: ntg-context
Thanks Mojca,
(I put again the discussion on the list)
> andrea valle wrote:
>> Thanks a lot,
>> It seems that it is exactly what I need,as I want to use pdfs.
>> Actually I'm able to scale, but not to shift.
>
> I don't understand why not. Can you send an (non-working) example?
>
>>
It seems to me that this:
% 1
\setupcolors[state=start]
\starttext
\startuseMPgraphic{dummy}
externalfigure "mptext.pdf"
xyscaled (10cm, 8cm)
shifted (3cm, 6cm);
\stopuseMPgraphic
\useMPgraphic{dummy}
\stoptext
and
% 2
\setupcolors[state=start]
\starttext
\startuseMPgraphic{dummy}
externalfigure "mptext.pdf"
xyscaled (10cm, 8cm)
shifted (3cm, 6cm);
\stopuseMPgraphic
\useMPgraphic{dummy}
\stoptext
...have the same results.
(these are my pdfs in output:
http://www.semiotiche.it/andrea/conTest.pdf
http://www.semiotiche.it/andrea/conTest1.pdf
)
Where am I making a mistake?
>
> It is not extensively documented, it is only mentioned in metafun
> manual (CTRL-F to search in Acrobat). Or, alternatively, you can take
> a look at:
>
So, how do I know all the options I can use? Simply I can't?
Best
-a-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: importing figures in metapost
[not found] ` <42ADA01B.4010604@gmail.com>
2005-06-13 15:52 ` andrea valle
@ 2005-06-13 15:56 ` andrea valle
2005-06-13 17:00 ` Mojca Miklavec
2005-06-13 17:20 ` Taco Hoekwater
1 sibling, 2 replies; 8+ messages in thread
From: andrea valle @ 2005-06-13 15:56 UTC (permalink / raw)
Cc: ntg-context
Thanks Mojca,
(I put again the discussion on the list)
> andrea valle wrote:
>> Thanks a lot,
>> It seems that it is exactly what I need,as I want to use pdfs.
>> Actually I'm able to scale, but not to shift.
>
> I don't understand why not. Can you send an (non-working) example?
>
>>
It seems to me that this:
% 1
\setupcolors[state=start]
\starttext
\startuseMPgraphic{dummy}
externalfigure "mptext.pdf"
xyscaled (10cm, 8cm)
shifted (3cm, 6cm);
\stopuseMPgraphic
\useMPgraphic{dummy}
\stoptext
and
% 2
\setupcolors[state=start]
\starttext
\startuseMPgraphic{dummy}
externalfigure "mptext.pdf"
xyscaled (10cm, 8cm)
shifted (3cm, 6cm);
\stopuseMPgraphic
\useMPgraphic{dummy}
\stoptext
...have the same results.
(these are my pdfs in output:
http://www.semiotiche.it/andrea/conTest.pdf
http://www.semiotiche.it/andrea/conTest1.pdf
)
Where am I making a mistake?
>
> It is not extensively documented, it is only mentioned in metafun
> manual (CTRL-F to search in Acrobat). Or, alternatively, you can take
> a look at:
>
So, how do I know all the options I can use? Simply I can't?
Best
-a-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: importing figures in metapost
2005-06-13 15:56 ` andrea valle
@ 2005-06-13 17:00 ` Mojca Miklavec
2005-06-13 17:20 ` Taco Hoekwater
1 sibling, 0 replies; 8+ messages in thread
From: Mojca Miklavec @ 2005-06-13 17:00 UTC (permalink / raw)
Cc: andrea valle
andrea valle wrote:
> Thanks Mojca,
> (I put again the discussion on the list)
>
>> andrea valle wrote:
> It seems to me that this:
Btw: take a look at the thread "MetaFun questions" in ConTeXt archive
and at the command naturalfigure(expr name) defined in mp-figs.mp.
> externalfigure "mptext.pdf"
> xyscaled (10cm, 8cm);
>
> and
>
> externalfigure "mptext.pdf"
> xyscaled (10cm, 8cm)
> shifted (3cm, 6cm);
>
> ...have the same results.
Of course they do. Metapost is clever enough to calculate the proper
bounding box. If you "draw origin" or "draw origin shifted
anypointyoucanthinkof" and if that is the only thing you draw, than both
figures will be identical.
If you would like the figure to be different, you can set the bounding
box explicitely with:
setbounds currentpicture to unitsquare xyscaled ... shifted ...;
If you want your graphic to appear somewhere else on the page than you
have to handle that with plain TeX/ConTeXt commands to achieve the
desired placing ... or using layers in MetaFun.
> So, how do I know all the options I can use? Simply I can't?
The command externalfigure in MetaFun has no additional
options/parameters. The best place to learn metafont/post/fun is:
- take The METAPOSTBook in a library (not necessary)
- metapost manual: http://www.tug.org/tutorials/mp/mpman.pdf
- MetaFun manual: http://www.pragma-ade.com/general/manuals/metafun-s.pdf
- sources: go to http://source.contextgarden.net/ and search for
externalfigure for example
I usually use the metapost and metafun manual and simply the search
function in Adobe Acrobat fo find what I'm looking for. Reading the
whole metafun manual is no bad idea anyway.
If you're looking for ConTeXt documentation: well, yes, than you start
reading one manual after another, keep looking into the source code and
search through the mailing list archive & contribute to Wiki. I'm
affraid there's no other way for the moment.
Mojca
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: importing figures in metapost
2005-06-13 15:56 ` andrea valle
2005-06-13 17:00 ` Mojca Miklavec
@ 2005-06-13 17:20 ` Taco Hoekwater
2005-06-13 19:35 ` andrea valle
1 sibling, 1 reply; 8+ messages in thread
From: Taco Hoekwater @ 2005-06-13 17:20 UTC (permalink / raw)
Cc: Mojca Miklavec
andrea valle wrote:
>
> It seems to me that this:
>
>
> % 1
> ...
> and
> % 2
> ...
>
> ...have the same results.
That's what I would expect as well, from identical input ;)
Taco
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: importing figures in metapost
2005-06-13 17:20 ` Taco Hoekwater
@ 2005-06-13 19:35 ` andrea valle
0 siblings, 0 replies; 8+ messages in thread
From: andrea valle @ 2005-06-13 19:35 UTC (permalink / raw)
(...)
ahem, yes.
Sorry, I forgot a % before a
> shifted (3cm, 6cm);
in the second example
I suppose Mojca has already replied considering the %.
Thanks
-a-
On 13 Jun 2005, at 19:20, Taco Hoekwater wrote:
> andrea valle wrote:
>> It seems to me that this:
>> % 1
>> ...
>> and
>> % 2
>> ...
>> ...have the same results.
>
> That's what I would expect as well, from identical input ;)
>
> Taco
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>
Andrea Valle
Laboratorio multimediale "G. Quazza"
Facoltà di Scienze della Formazione
Università degli Studi di Torino
andrea.valle@unito.it
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: importing figures in metapost
2005-06-12 15:50 ` Mojca Miklavec
[not found] ` <b8288e98f6a2750159050409b84b09f0@unito.it>
@ 2005-06-14 3:04 ` h h extern
1 sibling, 0 replies; 8+ messages in thread
From: h h extern @ 2005-06-14 3:04 UTC (permalink / raw)
Mojca Miklavec wrote:
> andrea valle wrote:
>
>> But: is it possible to import an external figure inside metapost
>> giving it a precise place in terms of xy coordinates?
>
>
> Sure:
>
> externalfigure "filename.pdf"
> xyscaled (theWidth, theHeight)
> shifted (theLowerLeftX, theLowerLeftY);
>
> (However, I don't know if there's a way to include a picture without the
> need to provide width and height explicitly.)
hack:
texexec --fig=d *.png
and then in the mp file:
input mpfigs.mp
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] 8+ messages in thread
end of thread, other threads:[~2005-06-14 3:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-11 14:52 importing figures in metapost andrea valle
2005-06-12 15:50 ` Mojca Miklavec
[not found] ` <b8288e98f6a2750159050409b84b09f0@unito.it>
[not found] ` <42ADA01B.4010604@gmail.com>
2005-06-13 15:52 ` andrea valle
2005-06-13 15:56 ` andrea valle
2005-06-13 17:00 ` Mojca Miklavec
2005-06-13 17:20 ` Taco Hoekwater
2005-06-13 19:35 ` andrea valle
2005-06-14 3:04 ` h h extern
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).