7

Analog to this question I've been wondering WHAT is to \lowercase as \bfseries is to \textbf?
(... and for uppercase, or \MakeLowercase and MakeUppercase, etc., which also seem to be text-block commands as explained here.)

Is there a "switch"/"declaration"/"modal command" (what is the correct term here?, is there a difference between them?) that would allow one to turn something into lowercase/uppercase in the same way that one would use \scshape for example, i.e., not as text-block command with the curly braces? Or how to create such a command? I couldn't find any clue on the forum.

2
  • My initial thought is that you're out of luck here since \lowercase is a primitive and ultimately any other macro would be defined in terms of it.
    – cgnieder
    Mar 30, 2016 at 12:39
  • No, there isn't. One would need an “all caps font” or an “all lowercase font”.
    – egreg
    Mar 30, 2016 at 12:44

2 Answers 2

8

Really there is no such command.

If you have a command that acts as a switch, such as a font change like \bfseries then it is easy to make a command that takes an argument and applies the original command in a local group, so \textbf is (simplified a bit) just

\def\textbf#1{{\bfseries #1}}

However going the other way is harder. \MakeUppercase is a wrapper around \edef and \uppercase and both of these primitives require a {} delimited list of tokens on which to act.

You can get caps and small caps as a modal switch \scshape as that font shape is commonly available, however an all-caps font is not available in most font sets. \uppercase (and so \MakeUppercase) does not work as a font change but as a token level transformation replacing each token in the argument by a specified replacement a to A for example. Conversely with an all caps font then a would still be a (ASCII/Unicode hex 61) but would use a glyph that looked like A when rendered.

3
  • Got it, thanks! One question, though, for clarification: For italics and bf there are, of course, special sets of each font, so each glyph has still the same code point. Small caps, afaik usually are encoded elsewhere in the same set. So with scshape there must be some replacement going on, right? (and I thought it might be possible to replicate this for caps or non-caps) Or am I mistaken here?
    – jan
    Mar 30, 2016 at 23:05
  • 1
    @jan no the small caps font is handled (normally) just like italics, it's a separate font but has small capitals in the lower case slots Mar 30, 2016 at 23:06
  • I just read up on open type/unicode a bit and it seems that Adobe once used to encode its small caps in U+F761 to U+F77A but that was bad practice and now seems not to be the case anymore. Thanks for your explanation!
    – jan
    Mar 30, 2016 at 23:23
7

You can define such control sequence as macro, if you need it. The following code defines \lowc.

\def\lowc{\expandafter\lowercaseA\expandafter{\iffalse}\fi}
\long\def\lowercaseA#1{\lowercase{#1}\egroup}

Test: {\bf TEXT \lowc AHA UFF}

\bye
3
  • \bf text \bye works; \lowc TEXT \bye doesn't.
    – egreg
    Apr 1, 2016 at 15:23
  • 1
    @egreg Still, +1; I like the idea.
    – Manuel
    Apr 1, 2016 at 16:09
  • 1
    I am trying to automate the use of uppercase letters in \chapter and \section entries in the table of contents. This answer has helped. Mar 10, 2018 at 3:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .