Article View: comp.text.tex
Article #11095Re: question about parsing numbers
From: Harald Hanche-Olsen
Date: Sat, 09 Jan 1993 21:59
Date: Sat, 09 Jan 1993 21:59
38 lines
1817 bytes
1817 bytes
>>>>> In article <726603701.528921.BNB@MATH.AMS.ORG>, BNB@MATH.AMS.ORG (bbeeton) writes:
bbeeton> julio dix (jd01@swtexas.bitnet, to comp.text.tex, jan 8) wants
bbeeton> to strip off the first digit from a series of digits in a box,
bbeeton> replacing the remaining digits into the same box.
bbeeton> i won't tackle the boxing part of the question, but can explain
bbeeton> why the whole string of numbers is being gobbled at once.
bbeeton> take a simpler example:
bbeeton> \newcount\num
bbeeton> \def\newnum#1#2.{\num=#1 \def\rest{#2}}
bbeeton> \newnum12345.
bbeeton> this will end up with \num=12345 and \rest empty (with a delimited
bbeeton> string, the part between delimiters need not contain anything).
Nope:
*\showthe\num
> 1.
<*> \showthe\num
?
*\show\rest
> \rest=macro:
->2345.
<*> \show\rest
The relevant mechanism deciding this is not number parsing, but macro
parameter parsing. I haven't seen the original post so can only guess
at the question asked, but perhaps the example
\newcount\num \def\digits{12345} \def\newnum#1#2.{\num=#1 \def\rest{#2}}
\newnum\digits67890. %% Result: \num=12345 and \rest -> 67890
\expandafter\digits67890. %% Result: \num=1 and \rest -> 234567890
hits closer to the mark?
- Harald
Technical Details
Message-ID:
<HANCHE.93Jan9165906@ptolemy.ams.sunysb.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!wupost!udel!sbcs.sunysb.edu!hancheReferences:
<726603701.528921.BNB@MATH.AMS.ORG>Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!udel!sbcs.sunysb.edu!hanche From: hanche@ams.sunysb.edu (Harald Hanche-Olsen) Subject: Re: question about parsing numbers In-Reply-To: BNB@MATH.AMS.ORG's message of 9 Jan 93 18: 21:41 GMT Message-ID: <HANCHE.93Jan9165906@ptolemy.ams.sunysb.edu> Sender: usenet@sbcs.sunysb.edu (Usenet poster) Nntp-Posting-Host: ptolemy.ams.sunysb.edu Organization: University at Stony Brook, NY References: <726603701.528921.BNB@MATH.AMS.ORG> Date: Sat, 9 Jan 1993 21:59:06 GMT Lines: 38