7

Using XeLaTeX the following document produces the correct result if \setmainfont{Arial} is never called (the quotation marks are proper left- and right-quotation marks). Once I try to set a font (even if it has the proper glyphs!) the output appears improperly as ``Quote me!''.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
``Quote me!''
\end{document}
  • 4
    Set the Ligatures=TeX feature for the font: \setmainfont[Ligatures=TeX]{Arial} – Gonzalo Medina Feb 6 '14 at 18:34
  • Interesting: this solves the problem in Windows TeXstudio where I created the example, but on my Ubuntu machine I get the error: ! Package xkeyval Error: 'TeX' undefined in families 'Ligatures'. – aardvarkk Feb 6 '14 at 18:38
  • 1
    Do you have an up-to-date TeX system (e.g. TeX Live) or are you using the one that comes with Ubuntu? – Joseph Wright Feb 6 '14 at 18:44
  • @JosephWright Yes, I installed texlive. Should be up to date. – aardvarkk Feb 6 '14 at 20:47
  • @aardvarkk No, I mean did you install TeX Live from TUG ('stand alone') or using the Ubuntu package system? – Joseph Wright Feb 6 '14 at 20:48
9

Set the Ligatures=TeX feature for the font:

\setmainfont[Ligatures=TeX]{Arial}

with old versions of fontspec you should use

\setmainfont[Mapping=tex-text]{Arial}

instead. The later with also work with newer versions, but the former is recommended for better compatibility with LuaTeX documents.

A sample code:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Arial}
\begin{document}
``Quote me!''
\end{document}

produces

enter image description here

  • Thanks for such a great answer! Exactly what I was looking for! – aardvarkk Feb 7 '14 at 15:33
3

Try using \setmainfont[Mapping=tex-text]{Arial}, which should work on older versions as well.

  • 2
    It should be Ligatures=TeX, with newer versions of fontspec – egreg Feb 7 '14 at 1:13

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.