[Tex/LaTex] Capital ẞ in LaTeX/XeTeX/lualatex/whatever

fontsfontspecunicode

I am trying to get a ẞ in my LaTeX document. How can I do this? I already tried:

  • Using other fonts: dejavu and libertine
  • Using \MakeUppercase{ß}, which sometimes produces nothing, sometimes produces "SS"
  • Using {\sc ß}, which sometimes produces nothing, sometimes produces "SS"
  • Using XeTeX and lualatex: Just leaves out ẞ and warns about the Glyph that it could not find
  • Using \symbol{"1E9E}, which also produces nothing

How can I do this?

Best Answer

The easiest solution, if you're sure that all the fonts you use in the document have the character U+1E9E LATIN CAPITAL LETTER SHARP S, is to say

\uccode`ß="1E9E

Otherwise, you need to provide substitutes; here's an example with Linux Libertine and Latin Modern.

\documentclass{article}
\usepackage{fontspec}
\usepackage{libertine}
\usepackage{newunicodechar}

%% simplistic solution
%\uccode`ß="1E9E

%% solution with substitutions
\newunicodechar{ß}{\ss}
\renewcommand{\SS}{\iffontchar\font"1E9E \symbol{"1E9E}\else SS\fi}

\newfontfamily{\lmr}[
  Ligatures=TeX,
  SmallCapsFont=Latin Modern Roman Caps,
]{Latin Modern Roman}


\begin{document}
\Huge
groß \MakeUppercase{groß}
\scshape Groß \MakeUppercase{Groß}

\lmr
groß \MakeUppercase{groß}
\scshape Groß \MakeUppercase{Groß}

\end{document}

enter image description here