From: Hans Hagen <pragma@wxs.nl>
Subject: Re: MPenvironment \def gives "Parameters must be numbered consecutively"
Date: Fri, 29 Sep 2006 09:29:19 +0200 [thread overview]
Message-ID: <451CCB4F.6090409@wxs.nl> (raw)
In-Reply-To: <E1GTAap-00057B-PF@approximate.corpus.cam.ac.uk>
Sanjoy Mahajan wrote:
> This test file (beta 2006.09.28):
>
> ============ 1.tex ============================
> \starttext
> \startMPenvironment
> \def\2#1#2{\vbox{\halign{\hfil##\hfil\cr #1\cr #2\cr}}}
> \stopMPenvironment
>
> \startreusableMPgraphic{fig}
> label(btex sun etex, origin);
> \stopreusableMPgraphic
>
> \reuseMPgraphic{fig}
>
> \stoptext
> ========================================
>
> fails with the error:
>
> ! Parameters must be numbered consecutively.
> <to be read again>
> ##
> l.44 \global \loadfontfileoncetrue \def \2##
> 1##2{\vbox {\halign {\hfil ####\...
>
>
> 1-mpgraph.mp gets this figure definition:
>
> beginfig(1);
> verbatimtex \global \loadfontfileoncetrue \def \2##1##2{\vbox {\halign {\hfil ####\hfil \cr ##1\cr ##2\cr }}} etex;
> label(btex sun etex
> , origin);
> ;
> endfig;
>
environments are saved in macros, therefore you end up in an argument
mess
\starttext
\startbuffer[mp]
\def\2#1#2{\vbox{\halign{\hfil##\hfil\cr #1\cr #2\cr}}}
\stopbuffer
\def\useMPenvironmentbuffer[#1]%
{\expanded{\startMPenvironment\noexpand\readfile{\TEXbufferfile{\jobname}}{}{}}\stopMPenvironment}
\useMPenvironmentbuffer[mp]
\startreusableMPgraphic{fig}
label(btex sun etex, origin);
\stopreusableMPgraphic
\reuseMPgraphic{fig}
\stoptext
works ok ; maybe i should add that command to the core but anyhow you
can wikify it
> So the parameters in the definition are being doubled up by one of the
> transformations that inserts the verbatimtex..etex block. By the way,
> should the verbatimtex..etex block go outside the beginfig..endfig, as
> it would in a standalone MP file? If only for efficiency rather than MP
> reparsing it with each beginfig.
>
>
depends, if you process them runtime, it does not matter, if you process graphics between runs, they may be some cary over effects, although the btex/etex snippets are grouped
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
-----------------------------------------------------------------
next prev parent reply other threads:[~2006-09-29 7:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-29 5:07 Sanjoy Mahajan
2006-09-29 7:29 ` Hans Hagen [this message]
2006-09-30 15:50 ` Sanjoy Mahajan
2006-10-05 7:10 ` Aditya Mahajan
2006-09-29 16:29 ` Mojca Miklavec
2006-09-30 15:46 ` Sanjoy Mahajan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=451CCB4F.6090409@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).