Article View: net.text
Article #714One-level token expansion in TeX.
From: Kathryn Hargreaves
Date: Mon, 06 Jan 1986 20:18
Date: Mon, 06 Jan 1986 20:18
20 lines
1402 bytes
1402 bytes
Although Knuth has an exercise on this topic, the solution uses
\expandafter. Although that works fine when the token to be expanded doesn't
have arguments, I would like to expand a control sequence ``one
level''---and not read any more tokens, even if that expansion is a macro
with arguments.
More precisely,
\def\macarg#1{This is a macro with argument #1.}
\futurelet\next\cont
\def\cont{
if \next is a control sequence...
I get stuck at the above. I want to know if \next is a control sequence, but
I don't want to read more from the input if it happens to be a control
sequence with arguments. (Such as macarg.) If I knew it didn't have
arguments, I could do it using \ifcat and \expandafter---but it might.
Please mail me any ideas. Thanks.
Karl. ucbvax!jenny jenny@ucbvax.berkeley.edu
Technical Details
Message-ID:
<11364@ucbvax.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!ucbvax!jennyShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!ucbvax!jenny From: jenny@ucbvax.BERKELEY.EDU (Kathryn Hargreaves) Newsgroups: net.text Subject: One-level token expansion in TeX. Message-ID: <11364@ucbvax.BERKELEY.EDU> Date: Mon, 6-Jan-86 15:18:26 EST Article-I.D.: ucbvax.11364 Posted: Mon Jan 6 15:18:26 1986 Date-Received: Tue, 7-Jan-86 04:35:44 EST Organization: University of California at Berkeley Lines: 20 Keywords: Expansion, TeX.