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
\addto\extrasenglish{\languageshorthands{ngerman}\useshorthands{"}}
\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}
\addto\extrasenglish{\languageshorthands{ngerman}\useshorthands{"}}
\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) Error Alert Error Alert
(selnolig) ------------------------------------------
(selnolig) The selnolig package *requires* the
(selnolig) 'fontspec' package, but it hasn't been
(selnolig) loaded. Exiting now.
(selnolig) ===========================================.
MWE without setmainfont
\documentclass{article}
\usepackage[ngerman,english]{babel}
\usepackage{fontspec}
\usepackage[english]{selnolig}
\addto\extrasenglish{\languageshorthands{ngerman}\useshorthands{"}}
\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
\addto\extrasenglish{\languageshorthands{ngerman}\useshorthands{"}}
% 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
?
selnolig
should be loaded afterbabel
. The load ordering doesn't affect the issue described here, but it can matter in other circumstances."|
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.