Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!stanford.edu!agate!sunkist.berkeley.edu!raymond From: raymond@math.berkeley.edu (Raymond Chen) Newsgroups: comp.text.tex Subject: Re: (Another) puzzler for wannabe wizards Keywords: Dirty Tricks, catcode changing, puzzle Message-ID: <1991Jun6.161408.16830@agate.berkeley.edu> Date: 6 Jun 91 16:14:08 GMT References: Sender: usenet@agate.berkeley.edu (USENET Administrator) Reply-To: raymond@math.berkeley.edu (Raymond Chen) Distribution: comp Organization: U.C. Berkeley Lines: 40 In-Reply-To: raichle@informatik.uni-stuttgart.de (Bernd Raichle) Originator: raymond@sunkist.berkeley.edu In article , raichle@informatik (Bernd Raichle) writes: >% use plainTeX >\catcode`\"=\active\gdef"{\"} >T"ater % output: T\"ater >\begingroup\catcode`\"=12 > \showthe\catcode`\" % print: 12 > % @ > \showthe\catcode`\" % print: 12 > T"ater % output: T''ater > \catcode`\"=\active > T"ater % output: T''ater >\endgroup >T"ater % output: T\"ater >\bye I know we were expressly forbidden from using \aftergroup, but here's a solution shorter than the one Mr. Raichle provided (47 characters) {\catcode`"\active\aftergroup\let\aftergroup"}" Of equal length, but slightly more devious (using the fact that we can use " itself as a scratch variable!) {\catcode`"\active\aftergroup\let\futurelet"}"" Anyway, here's a non-aftergroup solution. {\catcode`"\active\let"a\expandafter}\expandafter\let"" It makes the assumption that \catcode`\a=11, which is a safe assumption because if it weren't, the \catcode csname wouldn't have been parsed correctly in the first place! Other things I tried... use an \halign to control the order of tokenization using \char34 instead of \catcode`"12" (turned out not to be necessary) using \afterassignment instead of \aftergroup (turned out not to be nec.) Does this make me a wizard?