🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10103

(Another) puzzler for wannabe wizards

#10103
From: Bernd Raichle
Date: Wed, 05 Jun 1991 10:56
49 lines
2255 bytes
Some time ago Don Hosek posted
> A couple puzzlers for those who think that they're TeX gurus.

Here is another puzzle...

% ------- CUT HERE ------
% use plainTeX
\catcode`\"=\active\gdef"{\"}
T"ater                     % output: T\"ater
\begingroup\catcode`\"=12
  \showthe\catcode`\"      % print:  12
  % @<Insert your hack at this place@>
  \showthe\catcode`\"      % print:  12
  T"ater                   % output: T''ater
  \catcode`\"=\active
  T"ater                   % output: T''ater
\endgroup
T"ater                     % output: T\"ater
\bye
% ------- CUT HERE ------

At the place marked with @<Insert your hack...@> there should be a
local(!) re-definition of the active char "

This re-definition should satisfy the following constraints:
- do not assume that the catcode of " is 12
- no side-effects (local or global) except of changing the macro
  definition of " with catcode `active' (i.e., you can't use a
  counter, macro, ... to save the current catcode of ")
- with the behaviour specified in the comments
- "small is beautiful" => TeX code with no more than 160 chars
- do not use \aftergroup


A solution with \aftergroup:

% @<Insert your hack at this place@>=
  \begingroup \catcode`\"=\active
    \aftergroup\def\aftergroup"\catcode`\"=12
    \aftergroup{\aftergroup"\aftergroup}%
  \endgroup


Have fun
	-bernd
__________________________________________________________________________
Bernd Raichle, Student der Universit"at Stuttgart | "Le langage est source
privat: Stettener Str. 73, D-7300 Esslingen       |  de malentendus"
email:  raichle@azu.informatik.uni-stuttgart.de   |  (A. de Saint-Exupery)
Technical Details
Message-ID: <RAICHLE.91Jun5125624@azu.informatik.uni-stuttgart.de>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!ifistg!raichle

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!ifistg!raichle
From: raichle@informatik.uni-stuttgart.de (Bernd Raichle)
Newsgroups: comp.text.tex
Subject: (Another) puzzler for wannabe wizards
Keywords: Dirty Tricks, catcode changing, puzzle
Message-ID: <RAICHLE.91Jun5125624@azu.informatik.uni-stuttgart.de>
Date: 5 Jun 91 10:56:23 GMT
Sender: news@ifistg.uucp
Reply-To: raichle@azu.informatik.uni-stuttgart.de
Distribution: comp
Organization: Informatik, Univ. Stuttgart. W.Germany
Lines: 49