ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* character redefinition environment
@ 2006-11-05 14:49 Enzo Cordes
  2006-11-05 17:14 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Enzo Cordes @ 2006-11-05 14:49 UTC (permalink / raw)


Hi list,

I want to assign Metapost graphics to single letters (in a newly defined 
evironment, that take care of these assignments). The purpose is being 
able to rapidly build huge tables containing lots of these symbols.

Everything works fine if I assign these graphics to non-letters, e.g. 
"|", but somehow it doesn't work with normal letters.

Here is what I tried (with a simple Foo instead of Metapost graphics):

\definesymbol[foosymbol][{\tt Foo}]
\def\startmychars{%
\bgroup\catcode`\|=\active\def|{\symbol[foosymbol]}}
\def\stopmychars{\egroup}

This works with | as reassigned character without any problems. But, we 
want to have normal characters in the table, no punctuation marks, etc. 
Does anyone know what to do to reassign a special definition for a 
letter e.g. like uppercase B or else?

I got this error:
(/usr/local/share/texmf/tex/context/base/pdfr-ec.tex)
! Undefined control sequence.
\startmychars ...up \catcode `\B=\active \defB
                                                   {\symbol[foosymbol]}
l.24 \startmychars

which seems to indicate that B is not recognized as active character in 
the "\defB"?


Any hints very welcome,
Enzo.

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

* Re: character redefinition environment
  2006-11-05 14:49 character redefinition environment Enzo Cordes
@ 2006-11-05 17:14 ` Hans Hagen
  2006-11-06 16:40   ` Enzo Cordes
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2006-11-05 17:14 UTC (permalink / raw)


Enzo Cordes wrote:
> Hi list,
>
> I want to assign Metapost graphics to single letters (in a newly defined 
> evironment, that take care of these assignments). The purpose is being 
> able to rapidly build huge tables containing lots of these symbols.
>
> Everything works fine if I assign these graphics to non-letters, e.g. 
> "|", but somehow it doesn't work with normal letters.
>
> Here is what I tried (with a simple Foo instead of Metapost graphics):
>
> \definesymbol[foosymbol][{\tt Foo}]
> \def\startmychars{%
> \bgroup\catcode`\|=\active\def|{\symbol[foosymbol]}}
> \def\stopmychars{\egroup}
>
> This works with | as reassigned character without any problems. But, we 
> want to have normal characters in the table, no punctuation marks, etc. 
> Does anyone know what to do to reassign a special definition for a 
> letter e.g. like uppercase B or else?
>
> I got this error:
> (/usr/local/share/texmf/tex/context/base/pdfr-ec.tex)
> ! Undefined control sequence.
> \startmychars ...up \catcode `\B=\active \defB
>                                                    {\symbol[foosymbol]}
> l.24 \startmychars
>
> which seems to indicate that B is not recognized as active character in 
> the "\defB"?
>
>   
| is already active, but not b

\bgroup
\catcode`B=\active
\def\start...

\egroup

otherwise a 'character B' and not an 'active character B' ends up in the 
definition

This may be easier:

\def\Whatever
  {\defineactivecharacter B {[oeps]}}

bla bla \start \Whatever B \stop ble bla


-- 

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

* Re: character redefinition environment
  2006-11-05 17:14 ` Hans Hagen
@ 2006-11-06 16:40   ` Enzo Cordes
  0 siblings, 0 replies; 3+ messages in thread
From: Enzo Cordes @ 2006-11-06 16:40 UTC (permalink / raw)
  Cc: mailing list for ConTeXt users

Many thanks, Hans!

I wasn't sure I made myself clear, but defineactivecharacter does the 
job very very nicely. One day I understand one of its many definitions - 
especially the \uccode tilde business, which is probably necessary for 
the TeX mastication process ;-)

Enzo


Hans Hagen wrote:
> | is already active, but not b
> 
> \bgroup
> \catcode`B=\active
> \def\start...
> 
> \egroup
> 
> otherwise a 'character B' and not an 'active character B' ends up in the 
> definition
> 
> This may be easier:
> 
> \def\Whatever
>  {\defineactivecharacter B {[oeps]}}
> 
> bla bla \start \Whatever B \stop ble bla

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

end of thread, other threads:[~2006-11-06 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-05 14:49 character redefinition environment Enzo Cordes
2006-11-05 17:14 ` Hans Hagen
2006-11-06 16:40   ` Enzo Cordes

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