ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Patch to get MetaPost-inclusions to work
@ 2003-03-29 15:09 Dennis Brakhane
  2003-03-31 16:04 ` Patrick Gundlach
  2003-03-31 16:18 ` Patrick Gundlach
  0 siblings, 2 replies; 14+ messages in thread
From: Dennis Brakhane @ 2003-03-29 15:09 UTC (permalink / raw)


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 ;

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

* Re: Patch to get MetaPost-inclusions to work
  2003-03-29 15:09 Patch to get MetaPost-inclusions to work Dennis Brakhane
@ 2003-03-31 16:04 ` Patrick Gundlach
  2003-03-31 16:34   ` Dennis Brakhane
  2003-03-31 16:18 ` Patrick Gundlach
  1 sibling, 1 reply; 14+ messages in thread
From: Patrick Gundlach @ 2003-03-31 16:04 UTC (permalink / raw)


Dennis Brakhane <dennis@fsmath.zbt.uni-heidelberg.de> writes:

Hi,

please try 

\protectbufferstrue

> \setupcolors[state=start]
> \starttext

....


and report the result.


Patrick


(I should put this on a keyboard shortcut :-} )

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

* Re: Patch to get MetaPost-inclusions to work
  2003-03-29 15:09 Patch to get MetaPost-inclusions to work Dennis Brakhane
  2003-03-31 16:04 ` Patrick Gundlach
@ 2003-03-31 16:18 ` Patrick Gundlach
  2003-03-31 16:50   ` Dennis Brakhane
  1 sibling, 1 reply; 14+ messages in thread
From: Patrick Gundlach @ 2003-03-31 16:18 UTC (permalink / raw)


Dennis Brakhane <dennis@fsmath.zbt.uni-heidelberg.de> writes:

Hello Dennis,

> Is this a correct patch or am I missing something?

did you take into account that one can use the write18 feature to
generate the mp stuff on the fly?

Patrick

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

* Re: Re: Patch to get MetaPost-inclusions to work
  2003-03-31 16:04 ` Patrick Gundlach
@ 2003-03-31 16:34   ` Dennis Brakhane
  0 siblings, 0 replies; 14+ messages in thread
From: Dennis Brakhane @ 2003-03-31 16:34 UTC (permalink / raw)


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.

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

* Re: Re: Patch to get MetaPost-inclusions to work
  2003-03-31 16:18 ` Patrick Gundlach
@ 2003-03-31 16:50   ` Dennis Brakhane
  2003-04-07  7:40     ` write18 and mpost Patrick Gundlach
  0 siblings, 1 reply; 14+ messages in thread
From: Dennis Brakhane @ 2003-03-31 16:50 UTC (permalink / raw)


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?

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

* write18 and mpost
  2003-03-31 16:50   ` Dennis Brakhane
@ 2003-04-07  7:40     ` Patrick Gundlach
  2003-04-07 11:49       ` Dennis Brakhane
  0 siblings, 1 reply; 14+ messages in thread
From: Patrick Gundlach @ 2003-04-07  7:40 UTC (permalink / raw)


Dennis Brakhane <dennis@fsmath.zbt.uni-heidelberg.de> writes:

Hi,


> 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

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

* Re: write18 and mpost
  2003-04-07  7:40     ` write18 and mpost Patrick Gundlach
@ 2003-04-07 11:49       ` Dennis Brakhane
  2003-04-07 12:01         ` Patrick Gundlach
  0 siblings, 1 reply; 14+ messages in thread
From: Dennis Brakhane @ 2003-04-07 11:49 UTC (permalink / raw)


Am Montag, den 07.April 2003 um 09:40 schrieb Patrick Gundlach:
> Dennis Brakhane <dennis@fsmath.zbt.uni-heidelberg.de> 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

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

* Re: write18 and mpost
  2003-04-07 11:49       ` Dennis Brakhane
@ 2003-04-07 12:01         ` Patrick Gundlach
  2003-04-07 13:09           ` Dennis Brakhane
  0 siblings, 1 reply; 14+ messages in thread
From: Patrick Gundlach @ 2003-04-07 12:01 UTC (permalink / raw)


Dennis Brakhane <dennis@fsmath.zbt.uni-heidelberg.de> writes:

Hello Dennis,


> 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}</opt/tetex/2.0.2/texmf/font
s/type1/bluesky/cm/cmr12.pfb>
Output written on shade.pdf (1 page, 7784 bytes).
Transcript written on shade.log.

[...]



Patrick

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

* Re: Re: write18 and mpost
  2003-04-07 12:01         ` Patrick Gundlach
@ 2003-04-07 13:09           ` Dennis Brakhane
  2003-04-07 13:18             ` Patrick Gundlach
  0 siblings, 1 reply; 14+ messages in thread
From: Dennis Brakhane @ 2003-04-07 13:09 UTC (permalink / raw)


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

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

* Re: write18 and mpost
  2003-04-07 13:09           ` Dennis Brakhane
@ 2003-04-07 13:18             ` Patrick Gundlach
  2003-04-07 13:44               ` Dennis Brakhane
  0 siblings, 1 reply; 14+ messages in thread
From: Patrick Gundlach @ 2003-04-07 13:18 UTC (permalink / raw)


Dennis Brakhane <dennis@fsmath.zbt.uni-heidelberg.de> writes:

Hello Dennis,

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

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

* Re: Re: write18 and mpost
  2003-04-07 13:18             ` Patrick Gundlach
@ 2003-04-07 13:44               ` Dennis Brakhane
  2003-04-07 16:25                 ` Patrick Gundlach
  0 siblings, 1 reply; 14+ messages in thread
From: Dennis Brakhane @ 2003-04-07 13:44 UTC (permalink / raw)


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)

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

* Re: write18 and mpost
  2003-04-07 13:44               ` Dennis Brakhane
@ 2003-04-07 16:25                 ` Patrick Gundlach
  2003-04-07 18:08                   ` Hans Hagen
  0 siblings, 1 reply; 14+ messages in thread
From: Patrick Gundlach @ 2003-04-07 16:25 UTC (permalink / raw)


Dennis Brakhane <dennis@fsmath.zbt.uni-heidelberg.de> 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.

Patrick

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

* Re: Re: write18 and mpost
  2003-04-07 16:25                 ` Patrick Gundlach
@ 2003-04-07 18:08                   ` Hans Hagen
  2003-04-08 17:28                     ` Dennis Brakhane
  0 siblings, 1 reply; 14+ messages in thread
From: Hans Hagen @ 2003-04-07 18:08 UTC (permalink / raw)


At 18:25 07/04/2003 +0200, you wrote:
>Dennis Brakhane <dennis@fsmath.zbt.uni-heidelberg.de> 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
-------------------------------------------------------------------------

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

* Re: Re: write18 and mpost
  2003-04-07 18:08                   ` Hans Hagen
@ 2003-04-08 17:28                     ` Dennis Brakhane
  0 siblings, 0 replies; 14+ messages in thread
From: Dennis Brakhane @ 2003-04-08 17:28 UTC (permalink / raw)


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

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

end of thread, other threads:[~2003-04-08 17:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-29 15:09 Patch to get MetaPost-inclusions to work Dennis Brakhane
2003-03-31 16:04 ` Patrick Gundlach
2003-03-31 16:34   ` Dennis Brakhane
2003-03-31 16:18 ` Patrick Gundlach
2003-03-31 16:50   ` Dennis Brakhane
2003-04-07  7:40     ` write18 and mpost Patrick Gundlach
2003-04-07 11:49       ` Dennis Brakhane
2003-04-07 12:01         ` Patrick Gundlach
2003-04-07 13:09           ` Dennis Brakhane
2003-04-07 13:18             ` Patrick Gundlach
2003-04-07 13:44               ` Dennis Brakhane
2003-04-07 16:25                 ` Patrick Gundlach
2003-04-07 18:08                   ` Hans Hagen
2003-04-08 17:28                     ` Dennis Brakhane

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