* #'s in MPinclusions
@ 2003-01-22 10:21 Emil Hedevang Lohse
2003-01-22 11:54 ` Patrick Gundlach
0 siblings, 1 reply; 5+ messages in thread
From: Emil Hedevang Lohse @ 2003-01-22 10:21 UTC (permalink / raw)
The following code results in an error.
\startMPinclusions
vardef a@#(text t) = @#(t) enddef;
\stopMPinclusions
\starttext
Hello.
\stoptext
! Illegal parameter number in definition of \theMPinclusions.
<to be read again>
(
<argument> vardef a@##(
text t) = @##(t) enddef;
\startMPinclusions ...tions ;}}\writeMPgraphic {#1
}}
l.3 \stopMPinclusions
I know that # is a special character in TeX, but is there a way to get
abound this? What I actually trying to do, is to make a diagram
drawing package that I wrote for Metapost, work in ConTeXt. So I would
like to include the Metapost macros once and then use them later in
drawings, that is,
<include the Metapost macros in one way or another>
\starttext
... we now have the following commutative diagram.
\startuseMPgraphic
<my code for the diagram>
\stopuseMPgraphic
\useMPgraphic
\stoptext
--
Emil Hedevang Lohse <http://home.imf.au.dk/emil/>
Alle spørgsmål er lige dumme.
Og spørgsmålet "Kan ænder flyve?" er ikke dumt.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: #'s in MPinclusions
2003-01-22 10:21 #'s in MPinclusions Emil Hedevang Lohse
@ 2003-01-22 11:54 ` Patrick Gundlach
2003-01-22 13:18 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Patrick Gundlach @ 2003-01-22 11:54 UTC (permalink / raw)
Emil Hedevang Lohse <emil@imf.au.dk> writes:
Hello,
> I know that # is a special character in TeX, but is there a way to get
> abound this?
I see two posibilites (both untested):
either replace the # with \# or surround your
\startuseMPgraphic
\stopuseMPgraphic
with
{\catcode`#=11
\startuseMPgraphic
\stopuseMPgraphic
}
I don't know if this has any side effects in the startuseMPgraphic
environment or if this even works. Probably there is an official
ConTeXt way to do this.
Patrick
--
Mehr Buchstaben - mehr Spass
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: #'s in MPinclusions
2003-01-22 11:54 ` Patrick Gundlach
@ 2003-01-22 13:18 ` Hans Hagen
2003-01-24 13:38 ` Emil Hedevang Lohse
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2003-01-22 13:18 UTC (permalink / raw)
At 12:54 PM 1/22/2003 +0100, Patrick Gundlach wrote:
>Emil Hedevang Lohse <emil@imf.au.dk> writes:
>
>Hello,
>
> > I know that # is a special character in TeX, but is there a way to get
> > abound this?
>
>I see two posibilites (both untested):
>
>either replace the # with \# or surround your
>
>\startuseMPgraphic
>\stopuseMPgraphic
>
>with
>
>{\catcode`#=11
>\startuseMPgraphic
>\stopuseMPgraphic
>}
>
>I don't know if this has any side effects in the startuseMPgraphic
>environment or if this even works. Probably there is an official
>ConTeXt way to do this.
Your first method is the proper way:
copied from supp-mps.tex:
\appendtoks
\let \# \letterhash
\let \_ \letterunderscore
\let \& \letterampersand
\let \{ \letteropenbrace
\let \} \letterclosebrace
\to \everyMPgraphic
so, all these can be escaped
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] 5+ messages in thread
* Re: Re: #'s in MPinclusions
2003-01-22 13:18 ` Hans Hagen
@ 2003-01-24 13:38 ` Emil Hedevang Lohse
2003-01-24 14:18 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Emil Hedevang Lohse @ 2003-01-24 13:38 UTC (permalink / raw)
Hans Hagen <pragma@wxs.nl> writes:
> Your first method is the proper way:
>
> copied from supp-mps.tex:
>
> \appendtoks
> \let \# \letterhash
> \let \_ \letterunderscore
> \let \& \letterampersand
> \let \{ \letteropenbrace
> \let \} \letterclosebrace
> \to \everyMPgraphic
I believe there is a bug in supp-ini.tex:
.catcode `.} 12 .xdef .letterclosebrace B.string{E
should be
.catcode `.} 12 .xdef .letterclosebrace B.string}E
--
Emil Hedevang Lohse <http://home.imf.au.dk/emil/>
Alle spørgsmål er lige dumme.
Og spørgsmålet "Kan ænder flyve?" er ikke dumt.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-01-24 14:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22 10:21 #'s in MPinclusions Emil Hedevang Lohse
2003-01-22 11:54 ` Patrick Gundlach
2003-01-22 13:18 ` Hans Hagen
2003-01-24 13:38 ` Emil Hedevang Lohse
2003-01-24 14:18 ` 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).