9

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
  • 1
    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
  • related: tex.stackexchange.com/questions/103238/… – matth May 12 at 20:03
12

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}
\addfontfeatures{Ligatures={NoRequired, NoCommon, NoContextual}}
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:

enter image description here

  • 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
  • 1
    @Dieter you can use \addfontfeatures{Ligatures={NoRequired, NoCommon, NoContextual}} for that purpose. – topskip May 5 '12 at 10:55
  • 1
    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
0

In case you only want to suppress the "bad" ligatures, you can go for the selnolig package. Be aware that one has to use the fontspec package then.

English:

\usepackage[english]{selnolig}

German:

\usepackage[ngerman]{selnolig}

More information: New package, selnolig, that automates suppression of typographic ligatures

Discussion regarding fontspec and lualatex: Can we stop recommending fontspec as first choice in case lualatex is used?

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.