1

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}

MWE1

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

MWE2

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.

MWE3

Question

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

18
  • 1
    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) Commented Mar 8, 2018 at 23:32
  • 2
    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 Commented Mar 9, 2018 at 0:04
  • 3
    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
    Commented Mar 9, 2018 at 0:25
  • 1
    Are you sure that use of LuaTeX is permitted?
    – cfr
    Commented Mar 9, 2018 at 0:33
  • 1
    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
    Commented Mar 9, 2018 at 0:51

1 Answer 1

3

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

enter image description here

\documentclass{article}
\usepackage{fontspec}
\usepackage[english]{selnolig}
\usepackage[ngerman,english]{babel}
\addto\extrasenglish{\languageshorthands{ngerman}\useshorthands{"}}
\begin{document}
workflow\\
dwarflike\\
dwarf"|like
\end{document}
8
  • Shoulcn't that give you bad boxes?
    – cfr
    Commented Mar 9, 2018 at 0:30
  • 1
    @cfr one bad box yes, I just edited and removed the spurious \\ sorry copied it from the OP's example:-) Commented Mar 9, 2018 at 0:34
  • 1
    @koppor no your example in the question (even after several edits) is still breaking fontspec and selnolig (and most luatex features) by switching to classic tfm fonts rather than using opentype. Commented Mar 9, 2018 at 8:54
  • 2
    @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. Commented Mar 9, 2018 at 9:04
  • 1
    @koppor with luatex you (almost) never want to use OT1 or T1 encoding, certainly you can never use those encodings with fonts loaded via fontspec, but I am repeating myself Commented Mar 9, 2018 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .