# How to use selnolig package together with default lualalatex font?

Edit: Included different variants to show that everything seems to work fine.

I'd like to use selnolig with the default font used by lualatex. The reason is that I write a paper using the Simplified LNCS Template (which is based on Springer LNCS conference template). The template uses the default latex font. When the workshop organizers publish on CEUR-WS.org (as we do in the ZEUS workshop), we do not need to double-check with Springer.

## Introduction into selnolig

selnolig works fine when using fontspec. Here an example with "TeX Gyre Termes: "workflow" has a ligature and "dwarflike" not.

\documentclass{article}
\usepackage[ngerman,english]{babel}
\usepackage{fontspec}
\usepackage[english]{selnolig}
% hint by http://tex.stackexchange.com/a/321066/9075 -> enable "= as dashes
\setmainfont{TeX Gyre Termes}
\begin{document}
\noindent
workflow -- ligature is correct here\\
dwarflike -- no ligature (automatically)\\
dwarf{\breaklig}like -- no ligature (manually, using selnolig)\\
dwarf"|like -- no ligature (manually, using babel)
\end{document}


## MWE without fontspec

\documentclass{article}
\usepackage[ngerman,english]{babel}
\usepackage[english]{selnolig}
\begin{document}
\noindent
workflow -- ligature is correct here\\
dwarflike -- no ligature (automatically)\\
dwarf{\breaklig}like -- no ligature (manually, using selnolig)\\
dwarf"|like -- no ligature (manually, using babel)
\end{document}


Result

! Package selnolig Error: ==========================================
(selnolig)                ------------------------------------------
(selnolig)                The selnolig package *requires* the
(selnolig)                'fontspec' package, but it hasn't been
(selnolig)                ===========================================.


## MWE without setmainfont

\documentclass{article}
\usepackage[ngerman,english]{babel}
\usepackage{fontspec}
\usepackage[english]{selnolig}
\begin{document}
\noindent
workflow -- ligature is correct here\\
dwarflike -- no ligature (automatically)\\
dwarf{\breaklig}like -- no ligature (manually, using selnolig)\\
dwarf"|like -- no ligature (manually, using babel)
\end{document}


Result

## MWE with fontspec and switching back to lmodern manually

From the documentation:

If the selnolig package is run under LuaLaTeX but the fontspec package isn’t loaded by the time the \begin{document} statement is encountered, selnolig will terminate with an error message.

So, I tried to set an arbitrary font and then switch back to the default font:

\documentclass{article}
\usepackage[ngerman,english]{babel}
\usepackage{fontspec}
\usepackage[english]{selnolig}
% hint by http://tex.stackexchange.com/a/321066/9075 -> enable "= as dashes
% hint by https://tex.stackexchange.com/a/24998/9075 -> switch back to latin modern
\setmainfont{TeX Gyre Cursor}
\renewcommand\rmdefault{lmr}
\renewcommand\sfdefault{lmss}
\renewcommand\ttdefault{lmtt}
\begin{document}
\noindent
workflow -- ligature is correct here\\
dwarflike -- no ligature (automatically)\\
dwarf{\breaklig}like -- no ligature (manually, using selnolig)\\
dwarf"|like -- no ligature (manually, using babel)
\end{document}


The result is as follows.

## Question

Are there any issues in just loading fontspec and not to use setmainfont?

• your question isn't very clear, in the title you ask about latin modern (the default lualatex font) but in the body of the question you ask about computer modern, using a 7bit font with luatex is technically possible but seems a bit odd? (it certainly disables fontspec completely) Mar 8, 2018 at 23:32
• as I tried to show in my answer below your code is not "switching back" it is switching to a completely different font technology, a classic tex 7bit tfm font rather than the default opentype latin modern Mar 9, 2018 at 0:04
• Off-topic: As a general rule, selnolig should be loaded after babel. The load ordering doesn't affect the issue described here, but it can matter in other circumstances.
– Mico
Mar 9, 2018 at 0:25
• Are you sure that use of LuaTeX is permitted?
– cfr
Mar 9, 2018 at 0:33
• The issue of how much whitespace (if any) should be inserted in order to create a visible gap between "f" and f/i/l is strongly font-dependent. babel's "| method not only breaks up the ligature but also inserts 0.03em of whitespace. This setting seems to have been arrived at for the Computer/Latin Modern Roman font face and, in particular, the f-l ligature case. Inserting whitespace is actually not at all necessary for the f-f and f-i cases. With Times Roman, in contast, 0.03em is not sufficient for the f-l case. And, for EB Garamond, one would have to insert 0.11em to create a gap. Argh.
– Mico
Mar 9, 2018 at 0:51

The question is not very clear but I think you are looking for

\documentclass{article}
\usepackage{fontspec}
\usepackage[english]{selnolig}
\usepackage[ngerman,english]{babel}

• @cfr one bad box yes, I just edited and removed the spurious \\  sorry copied it from the OP's example:-) Mar 9, 2018 at 0:34
• @koppor as Mico explained the fact that there is extra space inserted by babel 's "| is expected, the code above is showing selnolig breaking ligatures with the default latin modern font which is what you asked in the question. Mar 9, 2018 at 9:04