Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!jarthur!sif.claremont.edu From: dhosek@sif.claremont.edu (Hosek, Donald A.) Newsgroups: comp.text.tex Subject: Re: defining active characters by number Keywords: active characters Message-ID: <8083@jarthur.Claremont.EDU> Date: 10 Aug 90 23:36:54 GMT Sender: news@jarthur.Claremont.EDU Reply-To: dhosek@sif.claremont.edu Followup-To: comp.text.tex Organization: Harvey Mudd College Lines: 47 In article <157@skye.cs.ed.ac.uk>, ajcd@cs.ed.ac.uk (Angus Duggan) writes... >I'm flummoxed. I've searched through the TeXbook for an answer to this >problem, and tried everything I can think of, but I can't find an answer. I >want to make a character active, and define a macro for it, with only the >number of the character specified (in a count register). >What I'm trying to do is to set up a lot of the character codes from 128--255 >to call a common macro, with the number of the character code as a parameter. >I'd prefer to have a loop, something like: >\bgroup % localise \count0 > \count0=161 > \loop > \expandafter\global\expandafter\catcode\count0=\active > % \edef active character number \count0 to expand to: > % {\noexpand\macro{\the\count0}} > \advance\count0 by 1 > \ifnum\count0<255\repeat >\egroup >The only way I can see of doing this is writing out an auxiliary file, and >re-reading it. Somebody please show me that I'm wrong. The following ought to work. \uccode`\~=\count0 \uppercase{\catcode`\~=\active \xdef~{\noexpand\macro{\the\count0}}} I haven't tried it though so I'd appreciate it if someone could let me know how close I've come. -dh --- Don Hosek TeX, LaTeX, and Metafont support, consulting dhosek@ymir.claremont.edu installation and production work. dhosek@ymir.bitnet Free Estimates. uunet!jarthur!ymir Phone: 714-625-0147 finger dhosek@ymir.claremont.edu for more info