# Switching off ligatures in LuaLaTeX

In order to switch off ligatures for a whole document using LuaLaTeX, I put the following lines into the preamble:

\usepackage{fontspec}
\defaultfontfeatures{Ligatures={NoRequired, NoCommon, NoContextual}}


However, the output document still shows ligatures. I also tried this command:

\usepackage{fontspec}
\defaultfontfeatures{
Ligatures={-Required, +NoRequired, -Common, +NoCommon, -Contextual, +NoContextual,
-TeX, -Rare, -Historic}}


but with the same result.

Any ideas why switching off ligatures is not working?

EDIT: The anser to my question is hidden in one of the comments on Patrick's answer: It is necessary to explicitly select a font via one of the fontspec commands afterwards, in order to have the Ligaturessetting take effect. For example:

\usepackage{fontspec}
\defaultfontfeatures{Ligatures={NoRequired, NoCommon, NoContextual}}
\setmainfont{Latin Modern Roman}

-
LuaTeX is at version 5? –  Simurgh12 May 5 '12 at 9:09
5.1 is at least the number my MieKTeX Package Manager mentions for the Lua binaries (miktex-lua51-bin-2.9). –  Dieter May 5 '12 at 9:56
that would be lua not LuaTeX. Your distribution will come with a version of the lua compiler (as in a compiler of the lua programming language) and this is what you describe. LuaTeX is currently at version 0.70.something –  ArTourter May 5 '12 at 10:22
You should provide a MWE. Without that (see the comments) we can only guess what you're trying to do. –  topskip May 5 '12 at 17:38

You have three choices to instruct fontspec to suppress ligatures:

The first is to name the default font features that are valid for the next font assignments:

\documentclass{article}
\usepackage{fontspec}
\begin{document}
\defaultfontfeatures{Ligatures={NoRequired, NoCommon, NoContextual}}
\setmainfont{Linux Libertine O}
I eat  -- the fluffiest ? fish''.
\end{document}


You can also add font features to the current font:

\documentclass{article}
\usepackage{fontspec}
\begin{document}
\setmainfont{Linux Libertine O}
I eat  -- the fluffiest ? fish''.
\end{document}


Or you can instruct fontspec to load a font with the given features:

\documentclass{article}
\usepackage{fontspec}
\begin{document}
\setmainfont[Ligatures={NoRequired, NoCommon, NoContextual}]{Linux Libertine O}
I eat  -- the fluffiest ? fish''.
\end{document}


All of these result in:

-
For me that means that I need to set again the default font, whatever that is, because I use LuaLaTeX as a rendering engine for a .NET application. Therefore, I do not know which font is actually the default one on the current system. Is there a command that I can use inside the \setmainfont{} command to advise it to use the current mainfont? –  Dieter May 5 '12 at 10:07
@Dieter you can use \addfontfeatures{Ligatures={NoRequired, NoCommon, NoContextual}} for that purpose. –  topskip May 5 '12 at 10:55
if you use fontspec without specifying the fonts, luatex should default to Linux Modern. Without fontspec it should behave like any other latex compiler and use CM (unless you specify a fontencoding. –  ArTourter May 5 '12 at 10:58
@ArTourter It should be "Latin Modern". –  egreg May 5 '12 at 14:04
\documentclass[]{article} \usepackage{fontspec} \addfontfeatures{Ligatures={NoRequired, NoCommon, NoContextual}} \begin{document} I eat -- the fluffiest ? fish''. \end{document} –  Dieter May 5 '12 at 16:47
show 6 more comments