# Using a single small caps word in header/ section title with KOMA-script

I am writing a paper and would like to emphasize all software names using small caps. To easily manage this, I create a macro to set text to small caps, which works fine most of the time.

``````\usepackage{xspace}
\newcommand{\tool}[1]{\textsc{#1}\xspace}

% ...

\section{Analysis of \tool{software}}  % doesn't work

This is my \tool{software}.  % works perfectly
``````

However, since my document type is scrartcl my macro doesn't work in titles and headers. This is most likely the case, because the font used for titles does not have small caps.

Is there a way to create a macro like the one above that works in headers? There are other solutions which completely change the header font to a small caps font, but I would like to keep the 'normal' header font.

• Just my two cents: I would not recommend to mix a sans serif font with the sans serif small caps of another font. If you want sans serif small caps use a sans serif family that provides small caps. Oct 19, 2017 at 16:04
• I agree that this most certainly is not best practice. I posted this more to show that it is possible. I will edit my answer to point this out more clearly. Oct 19, 2017 at 16:19

While it is not possible to solve this without completely changing the header font, as suggested in the other questions, it is possible to change the font to a similar sans serif font that supports small caps. I tried the fonts from this list and modified the code proposed by @egreg in this answer. I found two fonts that are similar enough for me to tolerate and created a macro that unsets the active font family. It then sets the text given as parameter one in small caps and reinstates the default KOMA-script header font (`\sffamily`) after that.

``````\makeatletter
\let\scshape\relax % to avoid a warning
\not@math@alphabet\scshape\relax
\ifnum\pdf@strcmp{\f@family}{\familydefault}=\z@
\fontfamily{phv}% sans, but a little blocky
%  \fontfamily{qhv}% sans, but a little blocky
%  \fontfamily{qtm}% serifs, but looks ok
\fi
\fontshape\scdefault\selectfont}
\makeatother

Note that this defines a command `\scshapehead`, since using the name `\scshape` here would overwrite the normal behaviour of `\scshape` and the font would be changed for all uses of `\scshape / \textsc`.