# Remapping German sharp s (Eszett)

I assume mine is a general problem with remapping, but what I want to do is to use, with Linux Libertine (and XeLaTeX), the round (ligature ss) form of German sharp s (E04C) instead of the standard form (00DF).

I thought this could be done by adding

U+00DF <> U+E04C

to my tex-text.map.

This does not seem to work however. Compiling

\documentclass{minimal}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Linux Libertine O}
\begin{document}
Lessingstraße
\end{document}

with XeLaTeX still gives me 00DF in Lessingstra_ß_e''.

Can someone please tell me what I am missing here?

Rainer

• Welcome to TeX.SE! Would you be open to using LuaLaTeX instead of XeLaTeX? If so, you could use an OpenType feature file to perform the substitution from ß (00DF) to ß (E04C). – Mico Mar 28 '15 at 13:04
• How exactly did you add the mapping? Did you call teckit afterwards? See tex.stackexchange.com/questions/230118/… – Ulrike Fischer Mar 28 '15 at 16:50
• @Mico: XeLaTeX supports OpenType as well. The problem is that there is no OpenType feature for this glyph for some reason – except for access all alternates, which is not natively supported by Fontspec, as far as I know. – Wrzlprmft Jul 14 '15 at 7:59

If using LuaLaTeX is an option for you, you could achieve your objective by (a) defining a Lua function that replaces all instances of ß with \char"E04C and (b) adding this function to the process_input_buffer callback. As its name indicates, this callback processes the input buffer before TeX does any processing.

\documentclass{article}
\usepackage{fontspec,luatextra}
\setmainfont{Linux Libertine O}

\begin{luacode}
function replace_eszett( line )
return string.gsub( line, 'ß', '\\char"E04C ' )
end
replace_eszett, "replace_eszett" )
\end{luacode}

\begin{document}
Lessingstraße \emph{Lessingstraße}
\end{document}

For completeness, here's what the output of the preceding example looks like without the lua-based code:

I managed to do achieve the desired output as follows using newunicodechar:

\documentclass{minimal}
\usepackage{xltxtra, newunicodechar}
\setmainfont[Mapping=tex-text]{Linux Libertine O}
\newunicodechar{ß}{^^^^e04c}
\begin{document}
Lessingstraße
\end{document}

In the fourth line, you can also use \newunicodechar{ß}{}, where the second argument is the Unicode character U+E04C.

Finally, you can use the way described in this answer to directly access a font’s glyphs:

\newunicodechar{ß}{\XeTeXglyph\the\XeTeXglyphindex "germandbls.alt"\relax}

This way, you do not not employ Unicode’s Private-Use Area at any point, which makes the mapping more robust to changes to the font’s encoding, also works for characters that are not assinged to a Unicode code point in the first place and also works with other fonts using the same naming convention.

• Maybe you prefer \newunicodechar{ß}{^^^^e04c} that's more readable. Avoid loading xltxtra, just fontspec is needed. – egreg Jul 14 '15 at 10:05
• @egreg: Thanks for the hint. I used xltxtra, because the question used it and it does not matter for this purpose. – Wrzlprmft Jul 14 '15 at 10:23

Solved: I needed to compile the relevant .map-file:

teckit_compile tex-text.map -o tex-text.tec

• I think it's a bad idea to modify a standard mapping file; create a new one, with a different name. – egreg Mar 28 '15 at 17:13