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?




lmrthe rightrmdefaultthen? I updated the code: Same result. My guess is thatselnoligfetches the font metrics from the font set bysetmainfontand does not update its internal metrics whenrenewcommandon fonts is used. However, I wonder, why selnolig has to use font metrics at all. Maybe, it establishes a hook when the font is used. – koppor Mar 09 '18 at 00:03selnoligshould be loaded afterbabel. The load ordering doesn't affect the issue described here, but it can matter in other circumstances. – Mico Mar 09 '18 at 00:25"|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 09 '18 at 00:51babelinserts0.03emwhitespace when"|is encountered. (Note thatrmlig,delig, etc) don't actually insert whitespace; instead, they insert"|. The tacit assumption is thatbabelwill know what to do with"|.)0.03emappears to be appropriate for breaking up f-l ligatures if the document uses the CM or LM Roman font face. But0.03emis too much forf-fandf-iligature boundaries if CM/LM Roman is in use, and it's not appropriate either if CM/LM italic or sans-serif font faces are used. – Mico Mar 09 '18 at 08:55shelfful. (Let's also agree that it's not correct to use anffligature and hence that the ligature should be suppressed.) If CM/LM Roman is used, in my opinion no extra whitespace is needed (in addition to breaking up the ligature). Hence,shelf"|fulis not as good as whatselnoligdoes. Same forWasserstoff"|ionenandauf"|isst. A separate problem arises if the document uses a font face with a "long-armed"f-glyph. In such cases,0.03emis not enough to create a gap betweenf&l. Lots more to think about! – Mico Mar 09 '18 at 09:08\setmainfont{Latin Modern Roman},\setsansfont{Latin Modern Sans}, and\setmonofont{Latin Modern Mono}. Instead, you deploy a triplet of\renewcommanddirectives. What are you trying to achieve by not using\set....fontdirectives? – Mico Mar 09 '18 at 12:35microtypecontextin them, which does not work at my side - see https://tex.stackexchange.com/questions/419288/microtypecontext-with-lualatex – koppor Mar 09 '18 at 12:48