# Combining small caps and sans serif?

Is it possible to combine small caps (\textsc) and sans serif (\textsf)? I am using the default LaTeX fonts.

• The Computer Sans typeface has no small caps font. Oct 4 '19 at 16:02
• @egreg Is there another (similar) font which does have small caps? Oct 4 '19 at 19:35

You can nest \textsf and \textsc in either order, but unless there is a font of that form, LaTeX will issue a warning and substitute a different style.

One that does work with no warnings is the newtxtext font set.

\documentclass{article}
\usepackage{newtxtext}
\begin{document}

sc-sf \textsc{\textsf{One two Three}}

sf-sc \textsf{\textsc{One two Three}}

\end{document}

• If you’re using fontspec, many sans-serif fonts have small caps, including TeX Gyre Heros and Adventor. You can also give the \setsansfont command the SmallCapsFont = option. Oct 4 '19 at 19:58
• @Davislor well that's true but I guess the OP isn't, but it wouldn't hurt if you posted a fontspec based answer as a comparison. Oct 4 '19 at 20:41

For the case the font does not support small caps, I recently wrote a small script that transforms lowercase letters into smaller uppercase versions. It even works with ä, ö, ü and ß.

\c{textsmaller}[2] can be replaced by \c{textscale}\cB\{0.7\cE\} to make customisability more granular.

When one's specific case is not covered, these steps might help:

• include a special exception in the regex command
• replace [^A-Z] with [a-z]
• replace \0 with \1
\usepackage[utf8]{inputenc}
\usepackage{xparse,relsize}

\ExplSyntaxOn

\NewDocumentCommand{\textsmallcaps}{ m }{% Define new command with one mandatory argument
\textapperance_smallcaps:n { #1 }% Call
}%

\tl_new:N \l__textapperance_textsmallcaps_input_tl% Initialize string variable
\cs_new_protected:Npn \textapperance_smallcaps:n #1
{% Create hidden command with one argument
\tl_set:Nx \l__textapperance_textsmallcaps_input_tl { #1 } % Fully expand contents and store them in the variable
\regex_replace_all:nnN
{ ([^A-Z]+) }
{ \c{textsmaller}[2]\cB\{\c{uppercase}\cB\{\0\cE\}\cE\} }
\l__textapperance_textsmallcaps_input_tl % Replace everything thats NOT a capital letter by \textsmaller[2]{\uppercase{<match>}}
\tl_use:N \l__textapperance_textsmallcaps_input_tl   % Return
}

\ExplSyntaxOff

• ä, ö, ü have to be lowercase! The reason is, that l3regex does not support utf8 for pdfLaTeX, yet. Apr 12 at 20:36