# fontspec with Helvetica breaks quotes

The usual quoting with  and '' doesn't work anymore after including this (which also changes the engine to XeTeX):

\usepackage{fontspec}
\setmainfont{Helvetica}


They are just printed verbatim in the output. Same with double- and triple dashes which are no longer converted to en/em dashes.

-
Alan told you how to get the ligatures. My advice is to avoid all "ligatures" if e.g. later on you want to switch to lualatex they can break. Use the real chars e.g. through the csquotes package instead. –  Ulrike Fischer Dec 11 '11 at 11:50
@UlrikeFischer Ligatures can be enabled in the same way with lualatex AFAIK. Are there some known differences in the way the two engines handle them that we should know about? (My quick look at the fontspec docs didn't seem to show any.) –  Alan Munn Dec 11 '11 at 16:35
At the begin of october Khaled announced on lualatex-devel the newest (unstable) version of luaotfload. Beside others he said "In this update too the support for non-standard features were dropped, namely tlig & trep (AKA TeX ligatures) ... ". Also remember this discussion: tex.stackexchange.com/questions/20580/…. The "faked" ligatures are much less reliable in lualatex than in xelatex. –  Ulrike Fischer Dec 11 '11 at 16:54
@UlrikeFischer Oops. That's embarrassing. I'd forgotten about that entirely. Thanks for the reminder. –  Alan Munn Dec 11 '11 at 21:05

## 1 Answer

XeLaTeX solution

The fontspec package doesn't enable ligatures by default. To turn them on you can use:

\defaultfontfeatures{Ligatures=TeX}


Or add it when you load the font:

\setmainfont[Ligatures=TeX]{Helvetica}


LuaLaTeX

However, as discussed here How to enable ligatures for emdash/endash in LuaTeX ? (and noted in the comments by Ulrike Fischer) with LuaLaTeX it's probably not the best idea to use this method with LuaLatTeX (even though it works fine with XeLaTeX).

This means that converting existing documents to LuaLaTeX may give rise to problems. For new documents, it will mean adapting your regular methods to methods that are useable with LuaLaTeX.

Equivalents of the TeX ligatures

The standard TeX ligatures are:

 '' -- --- ! ? << >>


These combinations get turned into:

“ ” – — ¡ ¿ « »

Adapting to not using ligatures in either XeLaTeX or LuaLaTeX

The simplest solution is to simply type the actual characters in your source code. This is a simple solution for the en-dash, em-dash, ¡ and ¿, but is somewhat annoying for the quotation marks since most of us are not used to typing “ and ” in our source code. There are two possible solutions to this problem.

An editor based solution

With a good editor, it's easy to bind e.g. the " key to automatically insert “ ” for you as you type.

A LaTeX based solution

Alternatively, you can use the csquotes package, which allows for very sophisticated quoting mechanisms. This may be overkill for many users, however. csquotes allows you to define an active quote character so that it will automatically insert the correct quote characters. Alternatively, you can use explicit markup with the \enquote command. (The csquotes package has many other sophisticated capabilities; this is just a basic example.)

If you are using multiple languages with different quoting conventions, this can be quite useful. Here's a simple example:

\documentclass{article}
\usepackage{fontspec}
%\usepackage[french,english]{babel} % if using lualatex
\usepackage{polyglossia} % if using xelatex
\setmainlanguage{english} % if using xelatex & polyglossia
\setotherlanguage{french} % if using xelatex & polyglossia
\usepackage[autostyle=true,english=american,french=guillemets]{csquotes}
\MakeOuterQuote{"}
\begin{document}
"This is \enquote{some} text".

\enquote{This is \enquote{some} text}.

\begin{otherlanguage}{french}
"Une exemple en français."

\enquote{Une exemple en français.}
\end{otherlanguage}
\end{document}


This is made somewhat more complicated with LuaLaTeX, because depending on the language you are using, babel is not fully supported by LuaLaTeX, and polyglossia, which is used with XeLaTeX cannot be used with LuaLaTeX. See the following question for some discussion.

What is the implication of the warning in the fontspec manual with respect to babel and LuaTeX?

-
Thanks for a great answer. It seems \setdefaultfontfeatures option is not supported any more. –  djhurio Dec 30 '12 at 15:47
@djhurio Thanks for the comment. The correct command should be \defaultfontfeatures. I've updated the answer. –  Alan Munn Dec 30 '12 at 17:37