6

I have a German sharp S (ß) in my document. When I compile the document with XeLaTeX, ß is changed to SS. It works with the default font but not with Charter (using the XCharter package):

\documentclass{article}

\usepackage{fontspec}
\usepackage{XCharter}

\begin{document}
Text: ä ö ü ß
\end{document}

This is the output:

enter image description here

I have also tried to compile a similar document with pdfLaTeX and the ß is displayed correctly in the output:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{XCharter}

\begin{document}
Text: ä ö ü ß
\end{document}

enter image description here

How can I get the correct output from XeLaTeX without replacing every ß with \ss?

  • 2
    You can make the ß active and map it to \ss. But I strongly advice not to go this way. xcharter is not suited for xelatex. Find open type versions of the fonts. – Ulrike Fischer Mar 15 '16 at 13:27
  • I downloaded the fonts and replaced \usepackage{XCharter} with \setmainfont[Path=fonts/]{Charter Regular}. Now it's working as expected. Thanks! :) Just out of curiosity: why is XCharter not suited for XeLaTeX? It says in the package description that OTF fonts are provided, so I just assumed that it would work. – Zoidberg Mar 15 '16 at 13:40
  • 1
    You can use the otf fonts with \setmainfont{Xcharter-Roman.otf} (or something similar), but the package is the support for pdflatex not xelatex. – Ulrike Fischer Mar 15 '16 at 13:45
  • also do not use the inputenc and fontenc packages with xelatex – David Carlisle Mar 15 '16 at 14:19
6

Contrary to other font packages, XCharter.sty does not distinguish being called by pdflatex or XeLaTeX+fontspec, so it ends up into defining legacy fonts, using the T1 encoding.

In the T1 encoding, the slot corresponding to ß in Latin-1 (which is respected by UTF-8) has the uppercase form “SS” of the eszet. This is why you get that strange output.

On the other hand, XCharter is available in TeX Live in OpenType format. Depending on your system, you can get away with

\setmainfont{XCharter}

(if the OpenType fonts in TeX Live are made available to the operating system) or you need to specify the associations explicitly

\setmainfont{XCharter}[
  Extension=.otf,
  UprightFont=*-Roman,
  ItalicFont=*-Italic,
  BoldFont=*-Bold,
  BoldItalicFont=*-BoldItalic,
]

Don't load XCharter.sty along with XeLaTeX or LuaLaTeX.

| improve this answer | |
5

Use pdflatex with \usepackage[utf8]{inputenc}\usepackage{xcharter} or xelatex with \usepackage{fontspec}\setmainfont{XCharter}. Both work (the font exists in opentype format):

\documentclass{article}
%\usepackage[utf8]{inputenc}
%\usepackage{xcharter}

\usepackage{fontspec}
\setmainfont{XCharter}

\begin{document}

Text: ä ö ü ß

\end{document} 

enter image description here

| improve this answer | |

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.