home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / text / tex / 14787 < prev    next >
Encoding:
Text File  |  1993-01-09  |  1.7 KB  |  52 lines

  1. Newsgroups: comp.text.tex
  2. Path: sparky!uunet!wupost!udel!sbcs.sunysb.edu!hanche
  3. From: hanche@ams.sunysb.edu (Harald Hanche-Olsen)
  4. Subject: Re: question about parsing numbers
  5. In-Reply-To: BNB@MATH.AMS.ORG's message of 9 Jan 93 18: 21:41 GMT
  6. Message-ID: <HANCHE.93Jan9165906@ptolemy.ams.sunysb.edu>
  7. Sender: usenet@sbcs.sunysb.edu (Usenet poster)
  8. Nntp-Posting-Host: ptolemy.ams.sunysb.edu
  9. Organization: University at Stony Brook, NY
  10. References: <726603701.528921.BNB@MATH.AMS.ORG>
  11. Date: Sat, 9 Jan 1993 21:59:06 GMT
  12. Lines: 38
  13.  
  14. >>>>> In article <726603701.528921.BNB@MATH.AMS.ORG>, BNB@MATH.AMS.ORG (bbeeton) writes:
  15.  
  16. bbeeton> julio dix (jd01@swtexas.bitnet, to comp.text.tex, jan 8) wants
  17. bbeeton> to strip off the first digit from a series of digits in a box,
  18. bbeeton> replacing the remaining digits into the same box.
  19.  
  20. bbeeton> i won't tackle the boxing part of the question, but can explain
  21. bbeeton> why the whole string of numbers is being gobbled at once.
  22.  
  23. bbeeton> take a simpler example:
  24. bbeeton> \newcount\num
  25. bbeeton> \def\newnum#1#2.{\num=#1 \def\rest{#2}}
  26. bbeeton> \newnum12345.
  27. bbeeton> this will end up with \num=12345 and \rest empty (with a delimited
  28. bbeeton> string, the part between delimiters need not contain anything).
  29.  
  30. Nope:
  31.  
  32. *\showthe\num
  33. > 1.
  34. <*> \showthe\num
  35. *\show\rest
  36. > \rest=macro:
  37. ->2345.
  38. <*> \show\rest
  39.  
  40. The relevant mechanism deciding this is not number parsing, but macro
  41. parameter parsing.  I haven't seen the original post so can only guess
  42. at the question asked, but perhaps the example
  43.  
  44. \newcount\num \def\digits{12345} \def\newnum#1#2.{\num=#1 \def\rest{#2}}
  45. \newnum\digits67890.      %% Result: \num=12345 and \rest -> 67890
  46. \expandafter\digits67890. %% Result: \num=1 and \rest -> 234567890
  47.  
  48. hits closer to the mark?
  49.  
  50. - Harald
  51.