25

I have a problem with XeLaTeX. Although German umlauts (äöü) work, "ß" compiles to "SS".

I use TeX Live 2011 on Debian x64.

See this minimal example:

\documentclass{minimal}
\usepackage[T1]{fontenc}
\usepackage[naustrian]{babel}

\begin{document}
Das "`s"' in "`daß"' muß (Achtung, "`muss"' schreibt man normal so) einsam bleiben,
könntest Du auch "`welches"' schreiben.
\end{document}

compiles to

Das „s“ in „daSS“ muSS (Achtung, „muss“ schreibt man normal so) einsam bleiben, könntest Du auch „welches“ schreiben.

(You might think the problem is related to babel, but I tried it without babel as well - babel just makes the quotation marks work right but doesn't harm the "ß").

2 Answers 2

26

With XeLaTeX, use the fontspec package instead of fontenc. For details, see Frequently loaded packages: Differences between pdfLaTeX and XeLaTeX.

\documentclass{minimal}

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{german}

\begin{document}
Das "`s"' in "`daß"' muß (Achtung, "`muss"' schreibt man normal so) einsam bleiben,
könntest Du auch "`welches"' schreiben.
\end{document}
8
  • 2
    babel can actually be used, at least for German and Austrian German, although polyglossia is probably better.
    – egreg
    Sep 14, 2011 at 19:14
  • @egreg: Normally, I don't use XeLaTeX, so I wanted to stick to Phillip's advice (in the "reference" Q+A).
    – lockstep
    Sep 14, 2011 at 19:15
  • 2
    It's very important also to save the files in UTF-8 encoding! But from Marcel's output it seems that encoding was actually used.
    – egreg
    Sep 14, 2011 at 19:25
  • 1
    thanks for your answer! Maybe I'm to stupid, but now I get the error message "! Package fontenc Error: Encoding file `eu1enc.def' not found. (fontenc) You might have misspelt the name of the encoding."
    – Marcel
    Sep 14, 2011 at 20:59
  • @Marcel: (Assuming your comment is not about Mico's answer) Try to delete all auxiliary files and then compile again.
    – lockstep
    Sep 14, 2011 at 21:01
6

I think the real problem in your MWE is that you're using the T1 font encoding, whereas one should use EU1 for xe(la)tex -- and EU2 for lua(la)tex. If you change this parameter to EU1, the \ss instances in your MWE will compile just fine: if EU1 is specified, xetex will automatically load the "latin modern" fonts for you. If you're OK with this font choice, you needn't load the fontspec package explicitly.

An entirely separate issue: you still need to load either babel or, better yet, polyglossia in order to obtain language-appropriate forms of the quotation marks.

2
  • thank you - should work, but I get the same error message as i just posted (! Package fontenc Error: Encoding file `eu1enc.def' not found. (fontenc) You might have misspelt the name of the encoding.)
    – Marcel
    Sep 14, 2011 at 21:00
  • 3
    Which version of the Latin Modern fonts and of the fontspec package, are you using? fontspec 2.2 was released just a few days ago; it contains a lot of improvements relative to version 2.1. Page 55 of the fontspec manual has the reference to the EU1 and EU2 encoding schemes and notes that "Now that XETEX can find fonts in the texmf tree, the Latin Modern OpenType fonts can be used as the defaults." I suppose this means that if you don't have the Opentype version of the latin modern fonts, you'll need to to the \usepackage{fontspec} route detailed in the answer by @lockstep.
    – Mico
    Sep 14, 2011 at 21:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .