Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!jarthur!nntp-server.caltech.edu!news From: marcel@cs.caltech.edu (Marcel van der Goot) Newsgroups: comp.text.tex Subject: Re: letA=3 edefB{A} does not put 3 into B ????? Summary: implicit characters are not macros nor character tokens Keywords: implicit characters, \let, expansion Message-ID: <1990Nov23.190635.4949@nntp-server.caltech.edu> Date: 23 Nov 90 19:06:35 GMT References: <1990Nov22.001531.7022@zaphod.mps.ohio-state.edu> Sender: news@nntp-server.caltech.edu Reply-To: marcel@cs.caltech.edu Organization: California Institute of Technology (CS dept) Lines: 49 Nntp-Posting-Host: stun4d.caltech.edu In <1990Nov22.001531.7022@zaphod.mps.ohio-state.edu> and <1990Nov22.001733.7082@zaphod.mps.ohio-state.edu> Ed Overman (eao@shape.mps.ohio-state.edu) writes > I want to do > \let\A=3 \edef\B{\A} > and have \B contain 3. This does not happen [...] > [...] > (any references or good explanations would be greatly appreciated). I can explain why this doesn't work, but a solution is a different thing. * On p. 207 (TeXbook) it is explained that \A (on that page \zero) is not a macro, and therefore doesn't expand. * In the answer of exercise 20.14 Knuth does exactly what you do, precisely because \A is not expanded. * On p. 269 it is explained what \A is, namely an ``implicit character.'' * Answer 8.7 points out that \A is not a character token. Unfortunately, as far as I can tell, there are only three ways to get the current value of an implicit character: by using it as a command in horizontal mode (p. 286, 283) (i.e., by typesetting it), or by using \meaning, or by comparing it with something else using \if. > The only solution I have found is to use \meaning\A since the third word > in the output of this control squence, which is the character in question, > can be grabbed and put into a control sequence. This does not seem a very > elegant solution to me. It doesn't seem very elegant to me either, but apparently this sort of use of \meaning has occurred to Knuth (although he considers it ``obscure''), see answer 24.1. I think it is better not to use \let or \futurelet in the first place, but to use something with \def instead. First define \def\mylet#1=#2{\def#1{#2}} I don't quite know how you want to use it, but say #1 is a sequence of characters. Then \mylet\a=#1 has almost the same effect as \let\a=#1, except that \let\a=3 would have been changed to \def\a{3}, so that \edef\b{\a} has the required effect. Only the behavior with respect to spaces is different. Spaces may not be important in your case, otherwise you will have to do something complicated to test first whether #1 starts with a space. Marcel van der Goot marcel@vlsi.cs.caltech.edu