ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MPenvironment ignored for btex..etex (or should I use sometxt)?
@ 2006-09-29  5:21 Sanjoy Mahajan
  2006-09-29  7:32 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Sanjoy Mahajan @ 2006-09-29  5:21 UTC (permalink / raw)


I'm not sure what's going on here, but this file fails (2006.09.28
beta): [well I have a better idea now after writing out the whole email,
see the end...]

=================== 3.tex =================
\starttext
\startMPenvironment
\def\2{hello}
\stopMPenvironment

\startreusableMPgraphic{fig}
label(btex \2 etex, origin);
\stopreusableMPgraphic

\reuseMPgraphic{fig}

\stoptext
=========================================

The error is (from 3.log):

============== error snippet ===============
systems         : begin file 3 at line 1
color           : currentcolor (def) is not defined 
\openout7 = `3-mpgraph.mp'.

! Undefined control sequence.
<argument>  label(btex \2
                          etex, origin);
\writecheckedMPgraphic ...icfalse \edef \ascii {#1
                                                  }\convertcommand \ascii \t...

\startMPgraphic ...hic \writecheckedMPgraphic {#1}
                                                  \stopwritingMPgraphic 
\handlereusableMPgraphic ...phic #3\stopMPgraphic 
                                                  \doifobjectssupportedelse ...

\douseMPgraphic ...s [#1][#2]\getvalue {\@@MPG #1}
                                                  {}\elabelgroup 
<to be read again> 
                    
l.10 \reuseMPgraphic{fig}
                         
? R
etc.
============== error snippet ===============

But 3-mpgraph.mp (produced after giving 'R' to enter nonstopmode) looks
fine:

=============== 3-mpgraph.mp ================
<lots of stuff>
beginfig(1);
verbatimtex \global \loadfontfileoncetrue \def \2{hello}  etex;
label(btex  \2 etex
, origin);
;
endfig;
let end=mprunend;
end.
=============== 3-mpgraph.mp ================

It processes by hand fine:

$ mpost -mem=metafun 3-mpgraph
...
1 output file written: 3-mpgraph.1

(or by using the system(texmfstart ...) command in 3.log)

Oh, wait, if metapost is fine with the file but ConTeXt isn't, then the
error above must be from ConTeXt parsing the metapost code and seeing
the \2, then complaining.  So am I supposed to use the global option to
\startMPenvironment?  If it's needed in this case, I think it would be
needed in every case (ConTeXt would see all the metapost uses of the
definition).  Or is btex deprecated and I should use \sometxt (except in
loops)?  Or am I just confused?!

-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   -- Bertrand de Jouvenal

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

* Re: MPenvironment ignored for btex..etex (or should I use sometxt)?
  2006-09-29  5:21 MPenvironment ignored for btex..etex (or should I use sometxt)? Sanjoy Mahajan
@ 2006-09-29  7:32 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2006-09-29  7:32 UTC (permalink / raw)


Sanjoy Mahajan wrote:
> Oh, wait, if metapost is fine with the file but ConTeXt isn't, then the
> error above must be from ConTeXt parsing the metapost code and seeing
> the \2, then complaining.  So am I supposed to use the global option to
> \startMPenvironment?  If it's needed in this case, I think it would be
> needed in every case (ConTeXt would see all the metapost uses of the
> definition).  Or is btex deprecated and I should use \sometxt (except in
> loops)?  Or am I just confused?!
>   
indeed commands in an mp environment are not expanded when writing an mp graphic to file; it's always a bit of a trade of (i didn't expect users to cook up all kind of commands in environments; when i have to do that, inormally put them in an environment and load that in the mp graphic (since one load tex files there) 

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] 2+ messages in thread

end of thread, other threads:[~2006-09-29  7:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-29  5:21 MPenvironment ignored for btex..etex (or should I use sometxt)? Sanjoy Mahajan
2006-09-29  7:32 ` Hans Hagen

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