domen@euler.crin.fr (Eric Domenjoud) (03/25/91)
I want to write a macro with 2 arguments, the first one being a single characters, which makes #1 active and defines it as #2. I tried \def\makeactive#1#2{\catcode`\#1=\active \let#1{#2}} but it doesn't work. Does anybody have an idea ? Note that the definition should be local to the group in which \makeactive occurs. Eric
eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (03/26/91)
domen@euler.crin.fr (Eric Domenjoud) writes: >I want to write a macro with 2 arguments, the first one being a single >characters, which makes #1 active and defines it as #2. I tried > \def\makeactive#1#2{\catcode`\#1=\active \let#1{#2}} >but it doesn't work. Does anybody have an idea ? Start with an active character, say the tilde; write: \catcode`#1=\active \tempcount=\uccode`\~ \uccode`\~=`#1 \uppercase{\let~}{#2} \uccode`\~=\tempcount Victor.
em@dce.ie (Eamonn McManus) (03/27/91)
eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) writes: >> \def\makeactive#1#2{\catcode`\#1=\active \let#1{#2}} > >\catcode`#1=\active \tempcount=\uccode`\~ >\uccode`\~=`#1 \uppercase{\let~}{#2} >\uccode`\~=\tempcount Also, it's worth noting that \let#1{#2} is probably not what you want, since it will set #1 to be the same as { (like \bgroup). Presumably \def#1{#2} is what's intended. , Eamonn