Now that \sometxt works with static figures (thanks!), I'm converting
from using btex..etex to using \sometxt, to avoid MPenvironments
(instead put it in the general .tex environment).

But I ran into an error with macro arguments and static figures.  Let me
know if it's not worth fixing in view of the Mk IV cleanup, and I'll
switch to reusable figures (and eventually Linux will support dual core
CPUs + suspend to ram, and then I won't notice the processing time
much).

Here is a small example file:

================= y.tex ========================
\def\2#1#2{\vbox{\halign{##\hfil\cr#1\cr#2\cr}}}
\starttext

\startstaticMPfigure{fig}
label(\sometxt{\2{h}{x}}, origin);
\stopstaticMPfigure

\usestaticMPfigure[fig]
\stoptext
================= y.tex ========================

It produces this texexec.tex (2006.09.28 22:43 beta):

================ texexec.tex =====================
\setupoutput[pdftex]
\setupcolors[state=start]
\global \loadfontfileoncetrue \starttext
\startMPpage


beginfig(1);

label(\sometxt{\vbox {\halign {##\hfil \cr h\cr x\cr }}}, origin);

endfig; \stopMPpage
\stoptext
================ texexec.tex =====================

The ## in the expanded argument to \sometxt causes a problem:

=================== texexec.log ==============
! Only one # is allowed per tab.
l.1 \vbox {\halign {##
                      \hfil \cr h\cr x\cr }}
\doTeXtext ... \startcurrentcolor \scantokens {#3}
                                                  \stopcurrentcolor }\global...

\dodofiltersometxt ...er \TeXtext \txtcounter {#1}
                                                  \expandafter \filtersometx...
<argument> ...halign {##\hfil \cr h\cr x\cr }}}, o
                                                  rigin);

endfig; 
\flushTeXtexts ...llectedmptexts \filtersometxt #1
                                                  \sometxt {}\empty \relax \...

\writecheckedMPgraphic ...phic \flushTeXtexts {#1}
                                                  \writeMPgraphic {#1}
...
l.9 endfig; \stopMPpage
                       
? 
=================== texexec.log ==============

Alas using

\def\2#1#2{\vbox{\halign{#\hfil\cr#1\cr#2\cr}}}

leads to a different error (illegal parameter number).

But using a reusable graphic works:

==================== yy.tex =====================
\def\2#1#2{\vbox{\halign{##\hfil\cr#1\cr#2\cr}}}
\starttext

\startreusableMPgraphic{fig}
label(\sometxt{\2{h}{x}}, origin);
\stopreusableMPgraphic

\reuseMPgraphic{fig}
\stoptext
==================== yy.tex =====================


-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   -- Bertrand de Jouvenal
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to