Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!mips!apple!agate!stanford.edu!neon.Stanford.EDU!golding From: golding@neon.Stanford.EDU (Andy Golding) Newsgroups: comp.text.tex Subject: character substitution macro Message-ID: <1991Apr2.031235.26526@neon.Stanford.EDU> Date: 2 Apr 91 03:12:35 GMT Organization: Computer Science Department, Stanford University, Ca , USA Lines: 24 I seem to be having trouble writing a macro to do simple character substitution. I just want it to replace all occurrences of forward quote (') with \char19 and backward quote (`) with \char18. Also, I want everything in typewriter font. First I tried it without using a macro: {\tt\catcode`'=\active\chardef'=19\catcode``=\active\chardef`=18 'toe`nail} That worked just fine. Then I tried making it into a LaTeX macro: \newcommand{\pron}[1]{{\tt\catcode`'=\active\chardef'=19 \catcode``=\active\chardef`=18 #1}} \pron{'toe`nail} At that point, I got some error about \inaccessible -- I think it was objecting to my chardefs. Could someone please tell me how to fix this? Thanks a lot! Andy