13

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...

6

Imho there is no better way. A font is the best solution. Some of the problems with \uppercase & friends are described in the FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=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.

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.

  • When using this solution in conjunction with hyperref, change the \MakeUppercase command with \solelyuppercase provided by the package stringstrings – Jelle Spijker May 15 '18 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.