🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #9516

\Roman{ctr} in LaTeX, Forcing expansions of tokens in TeX

#9516
From: Manas Mandal
Date: Wed, 23 Dec 1992 17:40
47 lines
2272 bytes
I am having trouble getting the `correct' value of a counter typed out on the
screen using \typeout and \Roman.

I have a counter called chapter, and defined \thechapter as follows
        \newcounter{chapter}
        \def\thechapter{\Roman{chapter}

so that when the chapter is 3, I would get III as the value of the chapter.

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

        \arabic{chapter}                        3
        \roman{chapter}                         iii
        \Roman{chapter}                         \uppercase {iii}
        \alph{chapter}                          c
        \Alph{chapter}                          C


QUESTION 1::

Is this a bug in LaTeX? \Roman is not expanded but everything else
gets displayed properly? In latex.tex, \@Roman is defined as
        \expandafter\uppercase\expandafter{\romannumeral #1}
which is why the full expansion is not being done.


QUESTION 2::

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? I did go thorugh part of
the TeX book (\expandafter, \noexpand, etc.) but couldn't figure out
the solution. (There is no \expand in TeX.)


Thanks for any pointers,
Manas
-- 
 _____________________________________________________________________________
:     Manas Mandal             Department of Computer and Information Science :
:                                        The Ohio State University            :
: mandal@cis.ohio-state.edu     2036 Neil Avenue, Columbus, OH 43210-1277 USA :
Technical Details
Message-ID: <MANDAL.92Dec23124023@rose.cis.ohio-state.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rose.cis.ohio-state.edu!mandal

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rose.cis.ohio-state.edu!mandal
From: mandal@rose.cis.ohio-state.edu (Manas Mandal)
Subject: \Roman{ctr} in LaTeX, Forcing expansions of tokens in TeX
Message-ID: <MANDAL.92Dec23124023@rose.cis.ohio-state.edu>
Originator: mandal@rose.cis.ohio-state.edu
Sender: news@cis.ohio-state.edu (NETnews        )
Organization: Ohio State Computer Science
Date: Wed, 23 Dec 1992 17:40:23 GMT
Lines: 47