Article View: comp.text.tex
Article #582A feature and not a bug
From: Michael Barr
Date: Thu, 30 Jul 1992 14:08
Date: Thu, 30 Jul 1992 14:08
57 lines
2639 bytes
2639 bytes
Several people have explained my problem with \mark's. Basically,
macros inside \mark's are expanded, but \let's are not evaluated. So
\ucasetrue expands to \let\ifucase\iftrue and, since it is not evaluated
further, this leaves not one but two unmatched \if's. I am sure there
is a reason for this.
For the immediate problem, there are two workarounds. The simplest is
to replace the \ifuccase by a \ucase counter:
\let\uc=\uppercase
\newcount\ucase
\def\ss{\ifnum\ucase=1 SS\else\char"19\fi}
\def\aa{\ifnum\ucase=1 \AA\else\accent23a\fi}
\def\ae{\ifnum\ucase=1 \AE\else\char"1A\fi}
\def\oe{\ifnum\ucase=1 \OE\else\char"1B\fi}
\def\o{\ifnum\ucase=1 \O\else\char"1C\fi}
\def\uppercase#1{{\ucase=1 \uc{#1}}}
When something like \oe is used inside \chapter or the like, it must be
\protect'ed.
A different workaround would be to redefine the \ps@... words that use
\uppercase so that it appears _outside_, not inside, the \mark. For
example, the following works fine.
\let\uc=\uppercase
\newif\ifucase
\def\ss{\ifucase SS\else\char"19\fi}
\def\aa{\ifucase\AA\else\accent23a\fi}
\def\ae{\ifucase\AE\else\char"1A\fi}
\def\oe{\ifucase\OE\else\char"1B\fi}
\def\o{\ifucase\O\else\char"1C\fi}
\def\uppercase#1{{\ucasetrue \uc{#1}}}
\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
In this case, the \ifucase is evaluated at the time that the \mark is
compiled, not when it is used, so the control sequences don't have to be
\protect'ed. This would require rewriting all the style files,
including fancyhed.sty, which have the \uppercase inside. Since there
is, as far as I know, no negative effects to having it outside the
\mark, I would like to see that done by style file designers.
Michael Barr
Technical Details
Message-ID:
<9207301408.AA00220@triples.math.mcgill.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!network.ucsd.edu!mvb.saic.com!info-texShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!network.ucsd.edu!mvb.saic.com!info-tex From: barr@triples.Math.McGill.CA (Michael Barr) Newsgroups: comp.text.tex Subject: A feature and not a bug Message-ID: <9207301408.AA00220@triples.math.mcgill.ca> Date: Thu, 30 Jul 92 10:08:42 EDT Organization: Info-Tex<==>Comp.Text.Tex Gateway X-Gateway-Source-Info: Mailing List Lines: 57