Article View: comp.text.tex
Article #637Re: A feature and not a bug
From: David Carlisle
Date: Fri, 31 Jul 1992 10:01
Date: Fri, 31 Jul 1992 10:01
114 lines
4432 bytes
4432 bytes
>>>>> On 30 Jul 92 14:08:42 GMT, barr@triples.Math.McGill.CA (Michael Barr) said:
In article <9207301408.AA00220@triples.math.mcgill.ca> barr@triples.Math.McGill.CA (Michael Barr) writes:
[expansion v evaluation inside a \mark, (and \write, and \edef,...)]
Michael> A different workaround would be to redefine the \ps@... words that use
Michael> \uppercase so that it appears _outside_, not inside, the \mark. For
Michael> example, the following works fine.
No it doesn't!
[example moved to the end of this message]
Michael> In this case, the \ifucase is evaluated at the time that the \mark is
Michael> compiled, not when it is used, so the control sequences don't have to be
Michael> \protect'ed. This would require rewriting all the style files,
Michael> including fancyhed.sty, which have the \uppercase inside. Since there
Michael> is, as far as I know, no negative effects to having it outside the
Michael> \mark, I would like to see that done by style file designers.
Michael> Michael Barr
By moving the \uppercase *before* any expansion takes place, you stop
any macros that appear in the \mark (chapter heading) from being
uppercased.
See the header of page two in the following:
=======================================
\documentstyle{book}
\newcount\atcat
\atcat\the\catcode`\@
\makeatletter
\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{}\def\@evenfoot{}% No feet.
\def\@evenhead{\rm \thepage\hfil \sl \leftmark}% Left heading.
\def\@oddhead{\hbox{}\sl \rightmark \hfil \rm\thepage}% Right heading.
\def\chaptermark##1{\uppercase{\markboth{\ifnum \c@secnumdepth >\m@ne
\@chapapp\ \thechapter. \ \fi ##1}{}}}%
\def\sectionmark##1{\uppercase{\markright{\ifnum \c@secnumdepth >\z@
\thesection. \ \fi ##1}}}}
\pagestyle{headings}
\catcode`\@=\the\atcat
\newcommand{\MU}{Manchester University}
\begin{document}
\chapter{Introduction to \MU.}
some stuff
\clearpage
some more stuff
\end{document}
=======================================
So now you see there ARE advantages to a scheme where expansion *only*
takes place, and then you can apply operators to the expanded tokens.
So DEK is vindicated after all :-)
The problem here is not with \uppercase, but rather with the
(plain|La)TeX's rather anglo-centric view of the world. If you want
\oe \ss and friends to act like letters, they should be defined as
such. Of course this is much easier with TeX3. as even characters in
the top half of the font can be assigned uccode values.
Anyway the following plain tex file shows a definition of \oe that
uppercases correctly *As long as it is EXPANDED BEFORE BEING
UPPERCASED*. If \oe is defined like \myoe below, then it will
uppercase correctly in the page headings.
Note also that your definition of \oe should have a space before the
\fi or it will read ahead trying to complete the <number>, and so
generates an error in the following example as \char"1BA is not a
valid character.
=======================================
\let\uc=\uppercase
\newif\ifucase
\def\MBuppercase#1{{\ucasetrue \uc{#1}}}
\def\MBoe{\ifucase\OE\else\char"1B\fi}
\def\myoe{^^1b}% TeX3 notation
\uccode"1B="1E
DEK \oe\ \uppercase{\oe}\ \expandafter\uppercase{\oe}
\ \oe A
MB \MBoe\ \MBuppercase{\MBoe}\ \MBuppercase\expandafter{\MBoe}
\ \MBoe A
DPC \myoe\ \uppercase{\myoe}\ \uppercase\expandafter{\myoe}
\ \myoe A
\bye
=======================================
David
--
David Carlisle
JANET: carlisle@uk.ac.man.cs
Computer Science Department
Manchester University
Oxford Road
Manchester
England
M13 9PL
Technical Details
Message-ID:
<CARLISLE.92Jul31110158@r8d.cs.man.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!mucs!m1!carlisleReferences:
<9207301408.AA00220@triples.math.mcgill.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!mucs!m1!carlisle From: carlisle@cs.man.ac.uk (David Carlisle) Newsgroups: comp.text.tex Subject: Re: A feature and not a bug Message-ID: <CARLISLE.92Jul31110158@r8d.cs.man.ac.uk> Date: 31 Jul 92 10:01:58 GMT References: <9207301408.AA00220@triples.math.mcgill.ca> Sender: news@cs.man.ac.uk Organization: Department of Computer Science, University of Manchester Lines: 114 In-reply-to: barr@triples.Math.McGill.CA's message of 30 Jul 92 14:08:42 GMT