Article View: comp.text.tex
Article #11096re: question about parsing numbers
From: C.E. Thompson
Date: Sat, 09 Jan 1993 22:29
Date: Sat, 09 Jan 1993 22:29
29 lines
1472 bytes
1472 bytes
In article <726603701.528921.BNB@MATH.AMS.ORG>, BNB@MATH.AMS.ORG (bbeeton) writes:
|>
|> take a simpler example:
|> \newcount\num
|> \def\newnum#1#2.{\num=#1 \def\rest{#2}}
|> \newnum12345.
|> this will end up with \num=12345 and \rest empty (with a delimited
|> string, the part between delimiters need not contain anything).
Ahem. No it won't. The splitting into '1' and '2345' occurs at macro
argument parsing time, and is no different for this fragment than in
the one you give later:
|> \newcount\num
|> \def\newnum#1#2.{\def\xnum{#1}\num=\xnum \def\rest{#2}}
|> \newnum12345.
You are thinking of some case when the assignment is seeing the whole
string of digits and will gobble as many as it can, e.g.
\newcount\num
\def\newnum{\afterassignment\newnumrest \num=}
\def\newnumrest#1.{\def\rest{#1}}
\newnum12345.
Chris Thompson
Cambridge University Computing Service
JANET: cet1@uk.ac.cam.phx
Internet: cet1@phx.cam.ac.uk
Technical Details
Message-ID:
<1993Jan9.222907.8717@infodev.cam.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!pavo.csi.cam.ac.uk!camcus!cet1References:
<726603701.528921.BNB@MATH.AMS.ORG>Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!pavo.csi.cam.ac.uk!camcus!cet1 From: cet1@cus.cam.ac.uk (C.E. Thompson) Subject: re: question about parsing numbers Message-ID: <1993Jan9.222907.8717@infodev.cam.ac.uk> Sender: news@infodev.cam.ac.uk (USENET news) Nntp-Posting-Host: apus.cus.cam.ac.uk Organization: U of Cambridge, England References: <726603701.528921.BNB@MATH.AMS.ORG> Date: Sat, 9 Jan 1993 22:29:07 GMT Lines: 29