# How to unset default Ligatures=TeX for main font? (TexLive2015)

As of TexLive2015 (as opposed to TexLive2013) fontspec predefines Ligatures=TeX. This results in double quotes being replaced by curly quotes. How can I disable this behavior?

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}

\begin{document}
force "x y Fx Fy"
\end{document}


In comment to the question handling of -- in minted egreg mentioned using \defaultfontfeatures{} before defining the font, but in the case above it has no effect. There is the selnolig package (Any suggestions/requests for features for a new package that allows disabling ligatures for (pre)selected words?), but I haven't found a command to disable TeX-"ligatures".

The work-around I've found was to edit the file '/usr/local/texlive/2015/texmf-dist/tex/latex/fontspec/fontspec.cfg', deleting the line {Ligatures=TeX}. I'd prefer a solution that avoids touching the installation.

Is there any \defaultfontfeatures{Ligatures=NoTeX}?

• Welcome! Even if you did need to alter the .cfg file, you ought not change that one. You ought not modify stuff in the main TEXMF tree because, other considerations aside, it will simply be liable to erasure when you update the installation. – cfr Nov 27 '15 at 0:08
• I suppose one could use the selnolig package to disable -- (en-dash) and --- (em-dash) "ligatures". (It would seem overkill, though, to use the package for this purpose.) However, AFAICT the package can not be used to keep TeX from converting "straight" (single and double) quote characters to equivalent "smart" quote characters. – Mico Dec 9 '15 at 23:38

## 3 Answers

Section 6.1 of the manual tells how to set the features for specified families declared with \setmainfont or \setsansfont:

\documentclass{article}
\usepackage{fontspec}

\defaultfontfeatures[\rmfamily,\sffamily,\ttfamily]{}
\setmainfont{Linux Libertine O}

\begin{document}

force "x y Fx Fy"

-- ---

 ''
\end{document}


To disable TeX-type ligatures, you could pass the option RawFeature=-tlig to the instructions \setmainfont, \setsansfont, etc. (tlig is short for "TeX-style ligatures"; -tlig disables the "tlig" font feature.) No need to do this for \setmonofont as TeX-style ligatures aren't enabled by default for monospaced fonts.

\documentclass{article}
\usepackage{fontspec}
\setmainfont[RawFeature=-tlig]{Linux Libertine O}
\setsansfont[RawFeature=-tlig]{Calibri}

\begin{document}
"  -- ---

\textsf{"  -- ---}
\end{document}

• This will only work in LuaLaTeX btw – Will Robertson Dec 9 '15 at 23:07
• @WillRobertson - In a broader sense, it's unfortunate that that the fontspec package currently permits setting Ligatures=TeX but doesn't permit setting Ligatures=NoTeX. This asymmetry is surprising, given that the pairs Common/NoCommon and Rare/NoRare work fine for enabling and disabling certain ligatures. – Mico Dec 9 '15 at 23:42
• Good point! I don't know whether that's possible in XeTeX at the moment but I'll investigate: github.com/wspr/fontspec/issues/221 – Will Robertson Dec 10 '15 at 3:29

If you just wish to disable the curly quotes "sometimes," then you can do the following (works with LuaLaTeX, fontspec; I don't know about XeTeX):

\defaultfontfeatures{} % complete removel
\def\straightquote{{\addfontfeature{Ligatures=ResetAll}'}}
\def\straightdblquote{{\addfontfeature{Ligatures=ResetAll}"}}


Be sure to do that after you have defined all other fonts, so that removing all default font features does not propagate to later-defined fonts.

Then, in the body of your document, use \straightquote and \straightdblquote as needed. You will need to follow the usual TeX rule about following a macro with a space or {} to be gobbled.