Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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} 
share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

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.

share|improve this answer
    
Simply great answer! –  Ma Ming Apr 29 '11 at 23:37
add comment

Think you’d better use polyglossia instead of babel:

% !TEX program = xelatex
% !Mode:: "TeX:UTF-8"
\documentclass[12pt]{article}
\usepackage{polyglossia}
    \setmainlanguage[spelling=new,babelshorthands=true]{german}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Times New Roman}
\newcommand\glqq{"`}
\newcommand\grqq{"'}
\begin{document}
Thess are German \glqq quotation marks\grqq.
Thess are German "`quotation marks"'.
\end{document}

(I changed the font …)

share|improve this answer
    
Yes, I known such a package and advise. I've tryed it but not succeed. My code was essential the same with yours, the error msg says !missing number, treated as zero <to be read again>\l@german... –  Ma Ming Apr 29 '11 at 23:33
    
@Ma “essential the same” means not identical, right? Could you provide the minimal example that gives this error? Maybe it’ll help to update your TeX-system first. –  Tobi Apr 30 '11 at 8:38
    
@Ma Ming: an error is normal during the first run of XeLaTeX after you change from babel to polyglossia. It's caused by an annotation in the .aux file and is to be ignored; it won't happen any more. –  egreg Apr 30 '11 at 10:35
    
@Tobi Finally I figure out I need etoolbox to support polyglossia. –  Ma Ming May 20 '11 at 19:51
    
@Ma Do you mean, that polyglossia requires etoolbox? –  Tobi May 20 '11 at 20:57
show 2 more comments

babel is not recommended if you use non-western scripts as it will confuse the font encodings but with german it will work fine with xelatex. You are not getting the quote because xunicode doesn't provide the necessary definitions. It is easy to add them. E.g.

\documentclass[12pt]{article}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{TeXGyrePagella}

\DeclareUTFcharacter[\UTFencname]{x201C}{\grqq}
\DeclareUTFcharacter[\UTFencname]{x201E}{\glqq}

\begin{document}
These are German \glqq quotation marks\grqq.
\end{document}

Also take a look at the package csquotes

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.