ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* metapost getting broken
@ 1999-11-11 22:27 Ed L. Cashin
  1999-11-12  0:51 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Ed L. Cashin @ 1999-11-11 22:27 UTC (permalink / raw)


Hi.  With the help of several documents, including "TeX as a
Presentation Tool" (art-pres.pdf) I have configured my teTeX
installation so that it's ready for inline MetaPost in ConTeXt.  

I made a little yellow circle.  (Whoo!!!)  But when I tried to add a
label I noticed that the mp source was getting broken:

    \setupcolors[state=start]
    \def\myMPFig%
    	    {\startreusableMPgraphic{}
    	    input mp-tool;
    	    fill fullcircle scaled (1in) withcolor (1, 1, 0);
    	    label.rt(btex first inline etex, (.5in, .25in));
    	    \stopreusableMPgraphic
    	    \reuseMPgraphic{}}

    \starttext
    hi
    \myMPFig
    bye
    \stoptext

... resulting in mpgraph.mp:

    mpgraph:=1;
    beginfig(1);
    input mp-tool;
    fill fullcircle scaled (1in) withcolor (1, 1, 0);
    label.rt(btex first inline etex;
    , (.5in, .25in));
    endfig;
    end.

... which doesn't work, of course.  Why is the semicolon getting added
before the comma?  Are there constraints on how to write mp code
inside of context? 

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


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

* Re: metapost getting broken
  1999-11-11 22:27 metapost getting broken Ed L. Cashin
@ 1999-11-12  0:51 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 1999-11-12  0:51 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

At 05:27 PM 11/11/99 -0500, Ed L. Cashin wrote:
>label I noticed that the mp source was getting broken:

This was corrected recently: 

\long\def\writeMPgraphic#1%
  {\bgroup
   \edef\overlaywidth     {\overlaywidth    \space}%
   \edef\overlayheight    {\overlayheight   \space}%
   \edef\overlaylinewidth {\overlaylinewidth\space}%
   \iflongMPlines
     \let\par=\empty
     \long\def\flush##1##2\par%
       {\ifx##1\relax \else
          \immediate\write\MPwrite{##1##2}%
          \expandafter\flush
        \fi}%
     \flush#1\empty\par\relax\par
   \else
     \long\def\flush##1##2;%
       {\ifx##1\relax \else
          \dowriteMPgraphicline##1##2tex\relax etex\MPend
          \expandafter\flush
        \fi}%
     \flush#1\empty;\relax;%
   \fi
   \egroup}

%D The \type {;} aware method (the \type {\else} branch) also
%D takes care of \type {btex}||\type {etex}, \type
%D {verbatimtex}||\type {etex}.

\def\dowriteMPgraphicline%
  {\futurelet\next\dodowriteMPgraphicline}

\long\def\dodowriteMPgraphicline#1tex#2#3etex#4\MPend%
  {\ifx\next\empty\else\ifx\next\relax\else
     \bgroup
     \let\par=\empty
     \ifx#2\relax
       \immediate\write\MPwrite{#1;}%
       \egroup
     \else
       \convertargument#2#3\to\ascii
       \immediate\write\MPwrite{#1tex \ascii etex}%
       \egroup
       \dowriteMPgraphicline#4tex\relax etex\MPend
     \fi
   \fi\fi}

BTW, in texmf.cnf, you can add: 

  TEX = texexec --batch --once

This makes MP run context! 

Also, I suggest you pass a name to the reuse macro: 

\startreusableMPgraphic{ed} 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


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

end of thread, other threads:[~1999-11-12  0:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-11 22:27 metapost getting broken Ed L. Cashin
1999-11-12  0:51 ` 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).