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}
9
  • 5
    Set the Ligatures=TeX feature for the font: \setmainfont[Ligatures=TeX]{Arial} Commented Feb 6, 2014 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
    Commented Feb 6, 2014 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
    Commented Feb 6, 2014 at 18:44
  • @JosephWright Yes, I installed texlive. Should be up to date.
    – aardvarkk
    Commented Feb 6, 2014 at 20:47
  • @aardvarkk No, I mean did you install TeX Live from TUG ('stand alone') or using the Ubuntu package system?
    – Joseph Wright
    Commented Feb 6, 2014 at 20:48

4 Answers 4

10

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

1
  • Thanks for such a great answer! Exactly what I was looking for!
    – aardvarkk
    Commented Feb 7, 2014 at 15:33
3

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

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

As of October 2021, but the fontspec package has done like this for a long time, the given example works as expected.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
``Quote me!''
\end{document}

enter image description here

The \setmainfont and \setsansfont declarations inherit \defaultfontfeatures{Ligatures=TeX} unless countermanded before issuing the commands.

0

The above didn't work for me, but the following bit did the trick:

\defaultfontfeatures{Ligatures=TeX}
2
  • Welcome to TeX.SE!
    – Mensch
    Commented Oct 20, 2021 at 12:58
  • The given example works for me out of the box.
    – egreg
    Commented Oct 20, 2021 at 13:09

You must log in to answer this question.

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