15

I know that \setkomafont is supposed to deal with switching fonts but sometimes instead of switching font, I'd like to switch to uppercase. I've not found a way to do this reliably. This breaks:

\documentclass{scrartcl}
\setkomafont{title}{\normalfont\uppercase}
\author{A. Author}
\title{The title}
\begin{document}
\maketitle
\end{document}

But this works:

\documentclass{scrartcl}
\setkomafont{section}{\normalfont\uppercase}
\author{A. Author}
\title{The title}
\begin{document}
\maketitle
\section{Something}
\end{document}

But this breaks:

\documentclass{scrartcl}
\setkomafont{disposition}{\normalfont\uppercase}
\author{A. Author}
\title{The title}
\begin{document}
\maketitle
\section{something}
\end{document}

Now, here's the one that's really weird:

\begin{filecontents}{\jobname.bib}
@Book{sen70,
  author =   {Amartya Sen},
  title =    {Collective choice and social welfare},
  publisher =    {Holden-Day},
  year =     1970}
\end{filecontents}
\documentclass{scrartcl}
\setkomafont{section}{\normalfont\uppercase}
\author{A. Author}
\title{The title}
\bibliographystyle{plain}
\begin{document}
\maketitle

\section{Something}
\cite{sen70}
\bibliography{\jobname}
\end{document}

Now, this kind of works in that the section heading is uppercased. But it doesn't work in that the "References" is set lowercase. But it is set in normalfont...

I know that \uppercase doesn't behave like a font switching command, but is there a robust way to do what I want?

I guess I could create a virtual font with the capitals in place of the lc letters, but there must be a better way...

lockstep
  • 250,273
Seamus
  • 73,242
  • 1
    Just in case you're using LuaTeX: you could try the approach I've written in http://tex.stackexchange.com/a/109476/ – topskip Apr 20 '13 at 06:07

2 Answers2

8

Imho there is no better way. A font is the best solution. Some of the problems with \uppercase & friends are described in the FAQ: https://texfaq.org/FAQ-casechange. In your example there are the additional problems that you don't know where in the code the upper case command is executed and you can have various arguments.

David Carlisle
  • 757,742
Ulrike Fischer
  • 327,261
5

You can add a layer over \section and redefine \author:

\makeatletter
\def\author#1{\gdef\@author{\MakeUppercase{#1}}}
\let\scr@section\section
\def\section{\@ifstar\seamus@sections\seamus@section}
\def\seamus@sections#1{\scr@section*{\MakeUppercase{#1}}}
\def\seamus@section{\@dblarg{\seamus@section@}}
\def\seamus@section@[#1]#2{%
  \scr@section[\MakeUppercase{#1}]{\MakeUppercase{#2}}}
\makeatother

The method advertised by source2e.pdf of terminating the sixth parameter passed to \@startsection with \MakeUppercase doesn't work with scrartcl.

egreg
  • 1,121,712