[Tex/LaTex] German quotation marks are broken in XeLaTeX

babelpunctuationxetex

Although I known nothing about German, I have to complie some German TeX documents. The German quotation marks "' or \grqq and "' or \grqq in my document are replaced by cmr font and the PDF file is not copyable near the quotation marks. A warning message says

font shape `OT1/TeXGyrePagella(0)/m/n' undefined, using `OT1/cmr/m/n' instead for symbol `glqq' on line 9.

The following is my minimal example:

% !TEX program = xelatex
% !Mode:: "TeX:UTF-8"
\documentclass[12pt]{article}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{TeXGyrePagella}
\begin{document}
These are German \glqq quotation marks\grqq.
\end{document} 

Best Answer

Never use babel with XeLaTeX. For internationalization support use polyglossia instead. Besides, in this case it's not even needed. You can enter the quotation marks either using ASCII symbols or direct UTF-8:

\documentclass{article}

\usepackage{fontspec}

\setmainfont[Ligatures = TeX]{TeX Gyre Pagella}

\begin{document}

<< >> ,, ``

« » „ “

\end{document}

polyglossia also has some babel shorthand support to ease the transition from babel.

Related Question