2

I am using a template for a CV letter which does not include the "sharp S" in its font. Instead it compiles every possible way to encode "ß" into "ss". I would like to import the symbol from a different font. I know that there are similar questions on the forum but they are all about very specific cases and as an unexperienced LaTeX user, it is hard for me to make the analogy to my case.

I am using TeXnicCenter on a Windows PC with xelatex.exe as a pdf compiler with a MiKTex distribution and the following packages :

\usepackage{fontspec} % For loading fonts
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin} % Main document font

\usepackage{xunicode,xltxtra,url,parskip} % Formatting packages

\usepackage[usenames,dvipsnames]{xcolor} % Required for specifying custom colors

\usepackage[big]{layaureo} % Margin formatting of the A4 page, an alternative to layaureo can be \usepackage{fullpage}
% To reduce the height of the top margin uncomment: \addtolength{\voffset}{-1.3cm}

\usepackage{hyperref} % Required for adding links   and customizing them
\definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour} % Set link colors throughout the document

\usepackage{titlesec} % Used to customize the \section command
\titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule] % Text formatting of sections
\titlespacing{\section}{0pt}{3pt}{3pt} % Spacing around sections

In the document I use :

\font\fb=''[cmr10]'' % Change the font of the \LaTeX command under the skills section
  • I would try to pursue a solution like \ss -> \begin{fontxy}ß\end{fontxy}. If this is acceptable. Since the ß is pretty rare, I think, this is okay. Maybe you should asign catcode 2 to the ß to not use them accidentally. – MaestroGlanz May 31 '16 at 9:18
  • 1
    Related: tex.stackexchange.com/questions/235556/… – Henri Menke May 31 '16 at 9:24
  • 1
    You should use commands line \font\fb and you shouldn't use cmr10 with xelatex. Beside this: both fontin and cmr10 have an ß. Correct the font setup of your document instead of trying to find bad work arounds. – Ulrike Fischer May 31 '16 at 9:24
  • @UlrikeFischer you are right, they have an "ß". the problem was that the word I tried to write was in capital letters and in this case "ß" is replaced by "SS" like in Henri Menke's answer. My bad. But why shouldn't I use cmr10 with xelatex ? – derthomas May 31 '16 at 9:42
  • 1
    @derthomas »Shouldn't use« is maybe a bit too harsh, but you will likely run into problems, because when using cmr10 you have to use the 8-bit character mapping, which makes it impossible to input UTF-8, i.e. ß is not possible but has to be replaced with \ss. For math in xetex there is unfortunately no other option currently, because Unicode math font loading is broken (so no unicode-math). You might want to use LuaTeX instead. – Henri Menke May 31 '16 at 12:51
3

Use the newunicodechar package to redefine a single glyph. Also load the surrogate font using fontspec instead of \font.

I downloaded the OpenType variant of Fontin from here (No worries, Fontin is free!).

\documentclass{article}
\usepackage{fontspec}
\setmainfont[
   Extension = .otf,
   UprightFont = *-Regular,
   SmallCapsFont=*-SmallCaps
]{Fontin}
\newfontfamily\lmr{Latin Modern Roman}
\usepackage{newunicodechar}
\newunicodechar{ß}{{\lmr\ss}}
\begin{document}
Straße
\end{document}

enter image description here

Actually, I would not use this replacement, but rely on the fontspec substitution.

\documentclass{article}
\usepackage{fontspec}
\setmainfont[
   Extension = .otf,
   UprightFont = *-Regular,
   SmallCapsFont=*-SmallCaps
]{Fontin}
\begin{document}
Straße \textsc{Straße}
\end{document}

enter image description here

Or use a font which offers the captial sharp S

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\begin{document}
Straße \textsc{Straße}
\end{document}

enter image description here


Related:

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.