Article View: comp.text.tex
Article #10948Re: Forcing expansions in Tex
From: Victor Eijkhout
Date: Tue, 05 Jan 1993 15:52
Date: Tue, 05 Jan 1993 15:52
43 lines
2110 bytes
2110 bytes
In article <MANDAL.93Jan5124200@rose.cis.ohio-state.edu> mandal@rose.cis.ohio-state.edu (Manas Mandal) writes:
[I posted this the day before Christmas, and got no responses. So I am
trying again, hoping that Someone Out There knows the answer.]
You rang?
While processing, I want to typeout the current chapter number, so at
the relevant place, I issue the command \typeout{\thechapter}
If \thechapter is defined as I get as output
\roman{chapter} iii
\Roman{chapter} \uppercase {iii}
QUESTION 1::
Is this a bug in LaTeX? \Roman is not expanded but everything else
gets displayed properly?
No bug. The \uppercase command is *not expandable* in the
technical sense, and that's the one that counts.
So how do I force the expansion without changing the definition of
\@Roman? Can I say something like
\typeout{\expand\thechapter}
so that \thechapter is correctly expanded?
No, because you need more than expansion.
The best I can come up with right now is the following:
\edef\tmp{\noexpand\typeout{\thechapter}}
\uppercase\expandafter{\tmp}
which you hide of course in a macro because it's ugly.
(This first generates \tmp as a control sequence that means
\typeout{iii} , and then you uppercase the whole of that.
The behaviour of \uppercase is often counterintuitive.
See a couple of cute examples in section 3.6.2 of the
book by yours truly.)
--
Victor
``I have seen this funny quote, if only I could find it back.''
Technical Details
Message-ID:
<EIJKHOUT.93Jan5155258@cupid.cs.utk.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!emory!cs.utk.edu!cs.utk.edu!eijkhoutReferences:
<MANDAL.93Jan5124200@rose.cis.ohio-state.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!emory!cs.utk.edu!cs.utk.edu!eijkhout From: eijkhout@cupid.cs.utk.edu (Victor Eijkhout) Newsgroups: comp.text.tex Subject: Re: Forcing expansions in Tex Date: 5 Jan 93 15:52:58 Organization: /pearl/homes/eijkhout/.organization Lines: 43 Message-ID: <EIJKHOUT.93Jan5155258@cupid.cs.utk.edu> References: <MANDAL.93Jan5124200@rose.cis.ohio-state.edu> NNTP-Posting-Host: cupid.cs.utk.edu In-reply-to: mandal@rose.cis.ohio-state.edu's message of Tue, 5 Jan 1993 17:42:00 GMT