Patch to get MetaPost-inclusions to work
Hi. I'm running Debian/GNU (unstable) and was trying to get the following file to work: \setupcolors[state=start] \starttext Bla \startuseMPgraphic{bla} u := 1cm; z0 = (0,0); z1 = (0,1)*u; z2 = (1,1)*u; z3 = (1,0)*u; draw z0--z1--z2--z3--cycle; z4 = whatever[z0,z2] = whatever[z1,z3]; dotlabel.bot(btex $z_4$ etex,z4); \stopuseMPgraphic \startuseMPgraphic{blubb} z0 = (0,0); z1 = (0,1)*u; z2 = (1,1)*u; z3 = (1,0)*u; draw z0--z1--z2--z3--cycle; z4 = whatever[z0,z2] = whatever[z1,z3]; dotlabel.bot(btex $z_{42}$ etex,z4); \stopuseMPgraphic \useMPgraphic{bla} \useMPgraphic{blubb} Blubb \stoptext When the dotlabel-Lines do not use btex..etex, "texexec --pdf" works just fine, creating mpgraph.{1,2}. But if I use btex, the files are not created. I think I found the reason for this. When texexec calls etex to typeset the labels, the file mpgraph.mp is overwritten with a simple "end." Now, texexec keeps a backup of it but seems to restore it too late. I've moved the specific lines futher ahead. Now everything seems to work fine. Is this a correct patch or am I missing something? Greetings, Dennis Patch follows... (texexec version is 3.2) --- texexec.pl.orig 2003-03-29 15:39:32.000000000 +0100 +++ texexec.pl 2003-03-29 15:42:55.000000000 +0100 @@ -2200,6 +2200,9 @@ rename $MpTex, $MpBck ; unlink $MpDvi } } print " metapost : $MpName\n" ; + if (-e $MpKep) + { unlink ($MpFile) ; + rename ($MpKep, $MpFile) } my $cmd = "$own_quote$MpExecutable$own_quote" ; if ($EnterBatchMode) { $cmd .= " $MpBatchFlag " } @@ -2218,9 +2221,7 @@ { while (/^l\.(\d+)\s/gmois) { print " error in metapost run : $MpName.mp:$1\n" } } unlink "mptrace.tmp" ; rename ($MpFile, "mptrace.tmp") ; - if (-e $MpKep) - { unlink ($MpFile) ; - rename ($MpKep, $MpFile) } } } + } } sub RunMPX { my $MpName = shift ; $MpName =~ s/\..*$//o ;
Am Montag, den 31.März 2003 um 18:04 schrieb Patrick Gundlach:
please try
\protectbufferstrue
\setupcolors[state=start] \starttext
Using my patch to texexec, 'texexec --automprun --pdf file' produces exactly the same pdf file whether the lines exists or not, when using protectbufferstrue is used, the intermediate files are prefixed with 'filename-', which is what i suppose protectbufferstrue should do.
Am Montag, den 31.März 2003 um 18:18 schrieb Patrick Gundlach:
did you take into account that one can use the write18 feature to generate the mp stuff on the fly?
No, I didn't know this feature before and, besides that, am using ConTeXt since 2 days, could to post an example how to do that so I could check it does what it is supposed to?
Dennis Brakhane
No, I didn't know this feature before and, besides that, am using ConTeXt since 2 days, could to post an example how to do that so I could check it does what it is supposed to?
Well, just activate write18 in your texmf.cnf file and you'll see. Perhaps you need \runMPgraphicstrue and \runMPTEXgraphicstrue, both are set in cont-sys.tex. %output=pdf \setupcolors[state=start] \defineoverlay[linearshadetest][\uniqueMPgraphic{linearshadetest}] \startuseMPgraphic{linearshadetest} linear_shade(OverlayBox,11,green,blue); \stopuseMPgraphic \starttext \framed[width=6cm,height=6cm,background=linearshadetest]{Sunglasses needed?} \stoptext the output of pdfetex should be: This is pdfeTeX, Version 3.14159-1.10b-2.1 (Web2C 7.4.5) \write18 enabled. entering extended mode [...] Patrick
Am Montag, den 07.April 2003 um 09:40 schrieb Patrick Gundlach:
Dennis Brakhane
writes: No, I didn't know this feature before and, besides that, am using ConTeXt since 2 days, could to post an example how to do that so I could check it does what it is supposed to?
Well, just activate write18 in your texmf.cnf file and you'll see. [...] the output of pdfetex should be:
This is pdfeTeX, Version 3.14159-1.10b-2.1 (Web2C 7.4.5) \write18 enabled. entering extended mode
Yes, but maybe we talk about different things here, I wanted to know an example of how to create and include a MetaPost-File using \write18 so that I could verify that my patch also handles this case the way it should. Greetings, Dennis
Dennis Brakhane
Yes, but maybe we talk about different things here, I wanted to know an example of how to create and include a MetaPost-File using \write18 so that I could verify that my patch also handles this case the way it should.
I did post an example. Run texexec on it and it will be generated on the fly. Don't pass any options to texexec. the log is something like: pg@levana:~/TeX/context/test/shading$ texexec shade TeXExec 3.2 - ConTeXt / PRAGMA ADE 1997-2003 [...] systems : begin file shade at line 32 systems : randomizer starts with 984898428 This is MetaPost, Version 0.641 (Web2C 7.4.5) (shade-mpgraph.mp [1] ) 1 output file written: shade-mpgraph.1 Transcript written on shade-mpgraph.log. [MP to PDF] (./shade-mpgraph.1)This is MetaPost, Version 0.641 (Web2C 7.4.5) (shade-mpgraph.mp [1] ) 1 output file written: shade-mpgraph.1 Transcript written on shade-mpgraph.log. [MP to PDF] (./shade-mpgraph.1) [1.1{/var/tmp/t etex/dvips/config/pdftex.map}] systems : end file shade at line 36 ){/opt/tetex/2.0.2/texmf/dvips/tetex/f7b6d320.enc} Output written on shade.pdf (1 page, 7784 bytes). Transcript written on shade.log. [...] Patrick
Hello again! Am Montag, den 07.April 2003 um 14:01 schrieb Patrick Gundlach:
I did post an example. Run texexec on it and it will be generated on the fly. Don't pass any options to texexec.
Oh! I was missing the \write18 statement. Nevertheless, the file you posted works just fine, metapost is called and the graphic is included. Dennis
Dennis Brakhane
Nevertheless, the file you posted works just fine, metapost is called and the graphic is included.
OK, so now to step two. Please try some btex...etex stuff (from your original post) and see if that is working fine. Patrcik (cant spell my own name....)
Am Montag, den 07.April 2003 um 15:18 schrieb Patrick Gundlach:
OK, so now to step two. Please try some btex...etex stuff (from your original post) and see if that is working fine.
? Of course it works fine. This is what my patch is all about: if i use the original texexec, btex etex stuff doesn't work, after the patch it works as I suppose it should (ie the same way it does without btex etex, the mpgraph PS file is created automatically when needed)
Dennis Brakhane
OK, so now to step two. Please try some btex...etex stuff (from your original post) and see if that is working fine.
?
Of course it works fine.
Perhaps it is obvious for you, it was not for me. Since the write18 stuff does behave somewhat different than the regular texexec mechanism (see supp-mps.tex), there were chances that your patch does not catch the write18 mpto (dvitomp,...) case. But after some tests it looks good to me. Now it would be nice to see some miktex, fptex, someothertex users test this to see if there are any unseen drawbacks. Perhaps one day this error will vanish.
This is what my patch is all about: if i use the original texexec, btex etex stuff doesn't work, after the patch it works as I suppose it should (ie the same way it does without btex etex, the mpgraph PS file is created automatically when needed)
there is much more than just running mpost as you have probably seen. Patrick
At 18:25 07/04/2003 +0200, you wrote:
Dennis Brakhane
writes: Hello Dennis,
OK, so now to step two. Please try some btex...etex stuff (from your original post) and see if that is working fine.
?
Of course it works fine.
Perhaps it is obvious for you, it was not for me. Since the write18 stuff does behave somewhat different than the regular texexec mechanism (see supp-mps.tex), there were chances that your patch does not catch the write18 mpto (dvitomp,...) case. But after some tests it looks good to me.
Now it would be nice to see some miktex, fptex, someothertex users test this to see if there are any unseen drawbacks. Perhaps one day this error will vanish.
This is what my patch is all about: if i use the original texexec, btex etex stuff doesn't work, after the patch it works as I suppose it should (ie the same way it does without btex etex, the mpgraph PS file is created automatically when needed)
there is much more than just running mpost as you have probably seen.
Can someone summarize the problem? Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
Am Montag, den 07.April 2003 um 20:08 schrieb Hans Hagen:
there is much more than just running mpost as you have probably seen.
Can someone summarize the problem?
Hans
The problem was the following: Using the "original" texexec.pl that was installed on my Debian unstable system, using MetaPost in a ConTeXt-file was not handled correctly: \starttext ... \start..MP label("test", (0,0)) \stop..MP \stoptext would work correctly; the MP instructions would be written into mpgraph.mp and converted to PS on-the-fly (if using automprun). If you would use MPcode that uses btex: ... \startMP label(btex test etex, (0,0)) \stopMP ... it would not work; you'll have to run "mpost mpgraph" after running texexec to create the PS file. Trying to solve the problem, I've found that after texexec calles e-TeX to typeset the 'btex ... etex' part, the file mpgraph.mp would be overwritten. Texexec, it is true, keeps a backup of the original mpgraph but seems to restore it _after_ calling mpost on it (which results in MetaPost compiling a file that contains only an 'end.') I have posted my patch to this problem, and asked if someone knows whether the late restoral was intended or a bug. Hope this somewhat clears the matter, Dennis
participants (3)
-
Dennis Brakhane
-
Hans Hagen
-
Patrick Gundlach