home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / text / tex / 14634 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  2.0 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!emory!cs.utk.edu!cs.utk.edu!eijkhout
  2. From: eijkhout@cupid.cs.utk.edu (Victor Eijkhout)
  3. Newsgroups: comp.text.tex
  4. Subject: Re: Forcing expansions in Tex
  5. Date: 5 Jan 93 15:52:58
  6. Organization: /pearl/homes/eijkhout/.organization
  7. Lines: 43
  8. Message-ID: <EIJKHOUT.93Jan5155258@cupid.cs.utk.edu>
  9. References: <MANDAL.93Jan5124200@rose.cis.ohio-state.edu>
  10. NNTP-Posting-Host: cupid.cs.utk.edu
  11. In-reply-to: mandal@rose.cis.ohio-state.edu's message of Tue, 5 Jan 1993 17:42:00 GMT
  12.  
  13. In article <MANDAL.93Jan5124200@rose.cis.ohio-state.edu> mandal@rose.cis.ohio-state.edu (Manas Mandal) writes:
  14.  
  15.    [I posted this the day before Christmas, and got no responses. So I am
  16.    trying again, hoping that Someone Out There knows the answer.]
  17.  
  18. You rang?
  19.  
  20.    While processing, I want to typeout the current chapter number, so at
  21.    the relevant place, I issue the command \typeout{\thechapter}
  22.  
  23.    If \thechapter is defined as               I get as output
  24.        \roman{chapter}                         iii
  25.        \Roman{chapter}                         \uppercase {iii}
  26.  
  27.    QUESTION 1::
  28.  
  29.    Is this a bug in LaTeX? \Roman is not expanded but everything else
  30.    gets displayed properly?
  31.  
  32. No bug. The \uppercase command is *not expandable* in the
  33. technical sense, and that's the one that counts.
  34.  
  35.    So how do I force the expansion without changing the definition of
  36.    \@Roman? Can I say something like
  37.        \typeout{\expand\thechapter}
  38.    so that \thechapter is correctly expanded?
  39.  
  40. No, because you need more than expansion.
  41. The best I can come up with right now is the following:
  42.     \edef\tmp{\noexpand\typeout{\thechapter}}
  43.     \uppercase\expandafter{\tmp}
  44. which you hide of course in a macro because it's ugly.
  45.  
  46. (This first generates \tmp as a control sequence that means
  47.  \typeout{iii} , and then you uppercase the whole of that.
  48. The behaviour of \uppercase is often counterintuitive.
  49. See a couple of cute examples in section 3.6.2 of the
  50. book by yours truly.)
  51.  
  52.  
  53. --
  54. Victor
  55. ``I have seen this funny quote, if only I could find it back.''
  56.