* metapost to pdf on the fly
@ 2011-09-29 18:37 Meer, H. van der
2011-09-29 19:21 ` Aditya Mahajan
0 siblings, 1 reply; 6+ messages in thread
From: Meer, H. van der @ 2011-09-29 18:37 UTC (permalink / raw)
To: NTG ConTeXt
I would like to generate metapost figures in separate pdf-files (in some convenient directory, they are reused elsewhere). This as part of a project structure. I know that on a separate run such a pdf can be generated with:
context figurefile running on input
\input some-metapost-inclusions
\starttext
\startMPpage
..
\stopMPpage
\stoptext
But the idea is to do it on the fly while typesetting a project (using mode=*first to prevent further iterations):
..
\component figurefile
..
And in the figurefile
\startcomponent figurefile
\environment some-metapost-inclusions
\starttext
.. BUT THEN WHAT?
As such it is not sufficient for the goal proposed. Can this be done at all?
Hans van der Meer
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: metapost to pdf on the fly
2011-09-29 18:37 metapost to pdf on the fly Meer, H. van der
@ 2011-09-29 19:21 ` Aditya Mahajan
2011-10-03 7:05 ` Meer, H. van der
0 siblings, 1 reply; 6+ messages in thread
From: Aditya Mahajan @ 2011-09-29 19:21 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Thu, 29 Sep 2011, Meer, H. van der wrote:
> I would like to generate metapost figures in separate pdf-files (in some convenient directory, they are reused elsewhere). This as part of a project structure. I know that on a separate run such a pdf can be generated with:
> context figurefile running on input
> \input some-metapost-inclusions
> \starttext
> \startMPpage
> ..
> \stopMPpage
> \stoptext
>
> But the idea is to do it on the fly while typesetting a project (using mode=*first to prevent further iterations):
> ..
> \component figurefile
> ..
> And in the figurefile
> \startcomponent figurefile
> \environment some-metapost-inclusions
> \starttext
> .. BUT THEN WHAT?
>
> As such it is not sufficient for the goal proposed. Can this be done at all?
What I usually do is have all the figures in separate buffers:
\startenvironment figures
\startbuffer[fig-1]
...
\stopbuffer
\stopenvironment
and in the main file
\environment figures
\starttext
....
\processMPbuffer[fig-1]
....
\stoptext
This way you can also combine multiple figures using
\processMPbuffer[fig-common,fig-1]
etc.
The metapost processing is fast enough that there is no noticable speed
difference.
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: metapost to pdf on the fly
2011-09-29 19:21 ` Aditya Mahajan
@ 2011-10-03 7:05 ` Meer, H. van der
2011-10-03 7:09 ` Wolfgang Schuster
0 siblings, 1 reply; 6+ messages in thread
From: Meer, H. van der @ 2011-10-03 7:05 UTC (permalink / raw)
To: mailing list for ConTeXt users
I am afraid I don't completely understand this. Doing:
\startbuffer[fig-1]
\startMPcode
draw origin-(20,0) .. origin+(0,20) .. origin+(20,0) .. origin+(0,-20) .. cycle withcolor darkgreen;
label(textext("Test"),origin);
\stopMPcode
\stopbuffer
\starttext
\processMPbuffer[fig-1]
\stoptext
I get the error:
! Argument of \dostartMPpositiongraphic has an extra }.
system > tex > error on line 8 in file onfly.tex: Argument of ...
1 \startbuffer[fig-1]
2 \startMPcode
3 draw origin-(20,0) .. origin+(0,20) .. origin+(20,0) .. origin+(0,-20) .. cycle withcolor darkgreen;
4 label(textext("Test"),origin);
5 \stopMPcode
6 \stopbuffer
7 \starttext
8 >> \processMPbuffer[fig-1]
..
<inserted text>
\par
<to be read again>
}
\processMPgraphic ...le ;\!!es , \MPaskedfigure )}
}\egroup \placeMPgraphic \...
\doprocessMPbuffer ...("\currentMPgraphicname ")}}
\endMPgraphicgroup
l.8 \processMPbuffer[fig-1]
Hans van der Meer
On 29 sep. 2011, at 21:21, Aditya Mahajan wrote:
> On Thu, 29 Sep 2011, Meer, H. van der wrote:
>
>> I would like to generate metapost figures in separate pdf-files (in some convenient directory, they are reused elsewhere). This as part of a project structure. I know that on a separate run such a pdf can be generated with:
>> context figurefile running on input
>> \input some-metapost-inclusions
>> \starttext
>> \startMPpage
>> ..
>> \stopMPpage
>> \stoptext
>>
>> But the idea is to do it on the fly while typesetting a project (using mode=*first to prevent further iterations):
>> ..
>> \component figurefile
>> ..
>> And in the figurefile
>> \startcomponent figurefile
>> \environment some-metapost-inclusions
>> \starttext
>> .. BUT THEN WHAT?
>>
>> As such it is not sufficient for the goal proposed. Can this be done at all?
>
> What I usually do is have all the figures in separate buffers:
>
> \startenvironment figures
>
> \startbuffer[fig-1]
> ...
> \stopbuffer
>
> \stopenvironment
>
> and in the main file
>
> \environment figures
>
> \starttext
> ....
> \processMPbuffer[fig-1]
> ....
> \stoptext
>
> This way you can also combine multiple figures using
>
> \processMPbuffer[fig-common,fig-1]
>
> etc.
>
> The metapost processing is fast enough that there is no noticable speed difference.
>
> 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 : http://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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: metapost to pdf on the fly
2011-10-03 7:05 ` Meer, H. van der
@ 2011-10-03 7:09 ` Wolfgang Schuster
2011-10-03 8:12 ` Meer, H. van der
0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2011-10-03 7:09 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 03.10.2011 um 09:05 schrieb Meer, H. van der:
> I am afraid I don't completely understand this. Doing:
> \startbuffer[fig-1]
> \startMPcode
> draw origin-(20,0) .. origin+(0,20) .. origin+(20,0) .. origin+(0,-20) .. cycle withcolor darkgreen;
> label(textext("Test"),origin);
> \stopMPcode
> \stopbuffer
> \starttext
> \processMPbuffer[fig-1]
> \stoptext
This works:
\startbuffer[fig-1]
draw (-20,0) .. (0,20) .. (20,0) .. (0,-20) .. cycle withcolor \MPcolor{darkgreen};
label(textext("Test"),origin);
\stopbuffer
\starttext
\processMPbuffer[fig-1]
\stoptext
Wolfgang
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: metapost to pdf on the fly
2011-10-03 7:09 ` Wolfgang Schuster
@ 2011-10-03 8:12 ` Meer, H. van der
2011-10-03 9:33 ` Mojca Miklavec
0 siblings, 1 reply; 6+ messages in thread
From: Meer, H. van der @ 2011-10-03 8:12 UTC (permalink / raw)
To: mailing list for ConTeXt users
Thanks, this works indeed. But I hoped to be able to produce in this manner at one stroke a series of separate figures, each in its own pdf file. Or is this an impossible action?
Hans van der Meer
On 3 okt. 2011, at 09:09, Wolfgang Schuster wrote:
>
> Am 03.10.2011 um 09:05 schrieb Meer, H. van der:
>
>> I am afraid I don't completely understand this. Doing:
>> \startbuffer[fig-1]
>> \startMPcode
>> draw origin-(20,0) .. origin+(0,20) .. origin+(20,0) .. origin+(0,-20) .. cycle withcolor darkgreen;
>> label(textext("Test"),origin);
>> \stopMPcode
>> \stopbuffer
>> \starttext
>> \processMPbuffer[fig-1]
>> \stoptext
>
> This works:
>
> \startbuffer[fig-1]
> draw (-20,0) .. (0,20) .. (20,0) .. (0,-20) .. cycle withcolor \MPcolor{darkgreen};
> label(textext("Test"),origin);
> \stopbuffer
>
> \starttext
> \processMPbuffer[fig-1]
> \stoptext
>
> Wolfgang
>
> ___________________________________________________________________________________
> 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 : http://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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: metapost to pdf on the fly
2011-10-03 8:12 ` Meer, H. van der
@ 2011-10-03 9:33 ` Mojca Miklavec
0 siblings, 0 replies; 6+ messages in thread
From: Mojca Miklavec @ 2011-10-03 9:33 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Mon, Oct 3, 2011 at 10:12, Meer, H. van der wrote:
> Thanks, this works indeed. But I hoped to be able to produce in this manner at one stroke a series of separate figures, each in its own pdf file. Or is this an impossible action?
Then create file.mp with
beginfig(1);
... metapost code ...
endfig;
beginfig(2);
... metapost code ...
endfig;
beginfig(3);
... metapost code ...
endfig;
end.
and process it with mptopdf file.mp
Mojca
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-10-03 9:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-29 18:37 metapost to pdf on the fly Meer, H. van der
2011-09-29 19:21 ` Aditya Mahajan
2011-10-03 7:05 ` Meer, H. van der
2011-10-03 7:09 ` Wolfgang Schuster
2011-10-03 8:12 ` Meer, H. van der
2011-10-03 9:33 ` Mojca Miklavec
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).