I cannot switch on ligatures for emdash (---) and endash (--) in LuaLaTeX. Here is my test file:
% !Mode:: "TeX:UTF-8"
\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Cambria}
\setsansfont[Mapping=tex-text]{Calibri}
\usepackage{ifluatex,ifxetex}
\begin{document}
\ifxetex
This is XeTeX
\else\ifluatex
This is LuaTeX
\fi\fi
\section{rmfamily}
\rmfamily
\begin{enumerate}
\item <<double quote>> by ligatures \verb|<<ligatures>>|
\item «double quotes» by symbols \verb|«double quotes»|
\item en--dash by ligatures \verb|en--dash|
\item em---dash by ligatures \verb|em---dash|
\item en–dash by symbol \verb|en–dash|
\item em—dash by symbol \verb|em—dash|
\end{enumerate}
\section{sffamily}
\sffamily
\begin{enumerate}
\item <<double quote>> by ligatures \verb|<<ligatures>>|
\item «double quotes» by symbols \verb|«double quotes»|
\item en--dash by ligatures \verb|en--dash|
\item em---dash by ligatures \verb|em---dash|
\item en–dash by symbol \verb|en–dash|
\item em—dash by symbol \verb|em—dash|
\end{enumerate}
\end{document}
When it is compiled with XeLaTeX, \sffamily
loaded with the obsolete option Mapping=tex-text
\setsansfont[Mapping=tex-text]{Calibri}
activates the ligatures ---
and --
, but in LuaTeX this options seemed to be equivalent to Ligatures=TeX
, so that I don't know how to restore default (in LaTeX) behavior of these two ligatures.
Is it bug or a feature, introduced in a recent version of the
fontspec
package?
I've checked that the ligatures still work as expected under LuaTeX if I don't set OTF fonts by the commands
\setmainfont{Cambria}
\setsansfont[Mapping=tex-text]{Calibri}
xunicode
package to get em-dash working. Maybe you're missing that?\usepackage{xunicode}
.lualatex-doc.pdf
the packagexunicode
should not be used withlualatex
: Package xunicode’s main feature is to ensure that the usual control sequences for non-ASCII characters (such as \’e) do the right thing in a Unicode context. It could probably work with LuaTEX, but explicitly checks for X ETEX only. However, fontspec uses a trick to load it anyway. So, you can’t load it explicitly, but you don’t need to, since fontspec already took care of it.