19

I am having trouble to understand the ligatures behaviour of the Linux Libertine font.

I want to use all ligatures that are possible to have (Ligatures={TeX}) but would like to disable single cases. I would have expected that babel would do that for me. When playing around with this, I found out that I am able to get three different fl ligatures but not a real space between those two letters. What is happening here? Am I doing something wrong? Or shouldn't I separate that two letter completely, even when they belong to different word parts.

See here what happens for the German word "Auflage":

Edit: I insert all mentioned solutions, too. They are differing in the distance between f and l but all are still collisioning. The line break possibilities are differing, too.

Edit 2: I switched from \\ to blank lines between the different cases due to this post. Now it shows the actual hyphenation possibilities for each case in the first picture.

% arara: lualatex
\documentclass[ngerman]{article}

\usepackage[final]{microtype}
\usepackage{fontspec}
\usepackage{luatextra}
\defaultfontfeatures{%
    ,Ligatures={TeX}
    ,Scale=MatchLowercase
}
\setmainfont[Mapping=tex-text]{Linux Libertine O} 
\usepackage{showhyphens}
\usepackage{babel}

\begin{document}
Auflage

Auf{l}age

Auf"-lage

Auf\/lage

Auf"|lage

{\addfontfeatures{Ligatures=NoCommon}Auflage}
\end{document}

enter image description here

Without showhyphens the missing separation is more visible.

enter image description here

2
  • 1
    There are no three different variants of the fl-ligatures in the font. And even if they were variants: why should commands like "| choose them? The f in libertine has simply a quite large side bearing, it comes quite near to following characters. Check it eg with an a. Btw: Why do you load fontenc? That's quite senseless in your document. Nov 17, 2013 at 18:30
  • Hi, you are right. I should have been talking about "headnuts" and not ligatures. The first one is the ligature and the last two are just touching. But why in different distance? Wouldn't that be a matter of kerning of the font? In my eyes, letters shouldn't touch each other, when not wanted. PS: The fontenc is a mistake. Normally I use fontspec. But in this case both can be left away.
    – LaRiFaRi
    Nov 17, 2013 at 18:38

4 Answers 4

23

Let's walk through all cases:

  • Au{f}lage (or Auf{l}age or Auf{}lage})

    ligature (I)

    This does not break up the ligature at all in luatex, and in fact (contrary to widespread belief) has never reliably done so even in pre-luatex engines (eg. pdftex, tex).

  • Auf"-lage

    broken ligature - no kerning (II)

    This shortcut from German babel inserts a hyphenation point allowing hyphenation in the rest of the word. The side effect is that the ligature is broken up, but there is no kerning between the letters, because even if kerning for this pair were defined in the font it would be inhibited by what has been inserted.

  • Auf\/lage

    (result same as II)

    This primitive, meant for italic correction, will insert a kern of 0pt, also resulting in the breaking up of the ligature, but (well...) no kerning. A negative side effect is that there will be no hyphenation in the remainder of the word.

  • {\addfontfeatures{Ligatures=NoCommon}Auflage} or (to not disable ligatures in the whole word) even Au{\addfontfeatures{Ligatures=NoCommon}fl}age

    (result same as II)

    Disabling ligatures by means of fontspec, but again no kerning (which tells us that kerning is indeed not defined for this pair in the font). And too much typing anyway.

  • Auf"|lage

    broken ligature - kerning (III)

    This shortcut, again from German babel, was actually designed for cases like this. It will break up the ligature, allowing hyphenation in the rest of the word, and insert a kerning of 0.03em, which for this font, however, is simply not enough to completely separate the letters. The kerning amount is hardwired in the language definition file -- you may still change it, though: see below.

So there are three different results: (I) ligature, (II) ligature broken up, but no kerning, and (III) ligature broken up, with a small amount of kerning.

The last case is surely the best approach so far. Now, to change the amount of kerning you could redefine the existing shortcut (after loading babel, surrounded by \makeatletter/\makeatother):

\declare@shorthand{ngerman}{"|}{%
  \textormath{\penalty\@M\discretionary{-}{}{\kern.07em}% <- originally 0.03em
              \allowhyphens}{}}

Or you could even create a new one, to be exclusively used for the fl ligature:

\declare@shorthand{ngerman}{"/}{%
  \textormath{\penalty\@M\discretionary{-}{}{\kern.07em}%
              \allowhyphens}{}}

and then write Auf"/lage.

Another possibility has already been mentioned: the selnolig package. This would surely be the best solution as it doesn't require any effort whatsoever on the part of the user. Unfortunately, however, selnolig will also only break up the ligature and not insert any kerning. It would be a feature request for @Mico to make this customisable, ideally font and glyph-dependent.


Finally, not quite related: Did you notice that there is no hyphenation point after Auf- in the cases of intact ligatures? This is not a bug in the German hyphenation patterns, but rather in luaotfload, see here. It can be solved by loading the font with Renderer=Basic. Of course, in this case it won't matter, but it would with a word like auffliegen.

5
  • Thank you very much for your time. A nice article. I've got the feeling that {\addfontfeatures{Ligatures=NoCommon}Auflage} has even more kerning than Auf"|lage but maybe I am seeing that wrong. Your last paragraph is very related. That's why I inserted the showhypens image. Thanks for that, too. I will do feature requests to libertine for some default kerning and to @Mico for his package (which I should try out the next time)
    – LaRiFaRi
    Nov 18, 2013 at 8:40
  • Using \addfontfeatures{Ligatures=NoCommon} is not "too much typing". It is in fact far less typing than having to redefine babel's shorthand. Another problem is that it's recommended to use polyglossia, and not babel, when compiling with XeLaTeX and LuaLaTeX, which is what the OP is using.
    – Sverre
    Nov 18, 2013 at 12:22
  • 4
    Thanks for "advertising" the selnolig package. :-) I've also been pondering the issue of what to do with unsightly f-i, f-j, and f-l collisions, and I've come to the conclusion that inserting font-dependent amounts of extra space isn't great from a typographical point of view, because doing so tends to create noticeable (and hence distracting) visual "holes" in the words for which these ligatures are suppressed. I'm working on an alternative solution which dispenses with the need for extra kerning entirely, because it uses special short-arm f glyphs provided by the font families in use.
    – Mico
    Nov 18, 2013 at 13:33
  • @Sverre Thanks for your comment. But this would disable all common ligature which I don't want at all. For just a single correction "| is much shorter and easier to understand for lectors. You are right about polyglossia but I kind of got stuck to babel and as long as it works...
    – LaRiFaRi
    Nov 18, 2013 at 14:15
  • @LaRiFaRi \addfontfeatures modifies font features only within the domain you specify, so it does not disable any ligatures outside of that domain, as exemplified in my answer. If you only need to disable a ligature once, then I definitely prefer {\addfontfeatures{Ligatures=NoCommon}fl} to that big chunk of code to create or redefine an internal babel macro.
    – Sverre
    Nov 18, 2013 at 15:33
9

There are a couple of possible answers.

One is to use {} to encase the second letter of the (not to be made into a) ligature pair, in this case: Auf{l}age, Suf{f}rage. OOPS, I JUST NOTICED: this solution doesn't work under LuaLatex. Instead, try the explicit correction for italics, Auf\/lage.

A second possible approach is the selnolig (selective no ligature) package. It's described as providing extensive rules for the selective suppression of so-called common ligatures for English and Ger­man language doc­u­ments. The package can be used in German by invoking: \usepackage[ngerman]{selnolig}.

6
  • Welcome to TeX.SX! A tip: You can use backticks ` to mark your inline code as I did in my edit.
    – Tobi
    Nov 17, 2013 at 18:29
  • Hi, thanks for your answer. The first solution does not work, as you just edited. The second yields the same as my third example. Didn't try selnolig yet, but I think, the result will be the same. The two letters are just touching in this font.
    – LaRiFaRi
    Nov 17, 2013 at 18:40
  • For what it's worth, I was wondering if microtype was impacting the result, but it doesn't seem to make a difference, whether present or disabled. Nov 17, 2013 at 18:43
  • 1
    It would seem that the italic correction example (Auf\/lage) should work. And it does if one uses the type1 fonts in pdflatex. It would seem that this either the font is wrong or luatex is getting this wrong.
    – Dan
    Nov 17, 2013 at 20:52
  • 1
    A quick comment on what the selnolig package does: It serves to suppress "common" ligatures (mostly f-ligatures) for German language texts, and both "common" and "rare" ligatures for English language texts. Examples of "rare" ligatures are ct, st, and sp.
    – Mico
    Nov 18, 2013 at 13:03
8

Activate the option Ligatures = NoCommon. See the fontspec manual under 10.1.

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures={TeX,NoCommon}]{Linux Libertine O}
\begin{document}
Auflage
\end{document}

enter image description here

To turn off ligatures for "single cases" (if I understand you correctly when you use that phrase), you can add the Ligatures = NoCommon option at will with \addfontfeatures, see the fontspec manual under 7.2.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\begin{document}
Auflage {\addfontfeatures{Ligatures=NoCommon}Auflage}
\end{document}

enter image description here

If you want to push the two characters in the fl sequence further apart, you can add \kern when you disable the ligature:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newcommand{\fl}{f{\kern0.075em}l}
\begin{document}
Auflage Au\fl{}age
\end{document}

enter image description here

I personally wouldn't kern more than 0.075em, because I think the stems and feet of the two characters otherwise are separated too much, which in my view is esthetically inferior. There is, after all, a reason why the fl ligature is commonplace in non-monospaced fonts.

As mico suggests, you can use an f with a shorter arm. That way that f and the l don't collide:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newcommand{\fl}{{\char"E0E0}l}
\begin{document}
Auflage Au\fl{}age
\end{document}

enter image description here

7
  • 1
    Unfortunately, this will remove any and all ligatures (AFAIU); OP needs only fl to separate. Nov 17, 2013 at 19:42
  • Thanks, that is looking best until know. But: It is still not really separated and it is a lot of typing to correct all this cases. I am now having 4 different types of conjuncted "fl"s. Really confusing. I will post all of them in my OP.
    – LaRiFaRi
    Nov 17, 2013 at 20:38
  • 1
    @SeanAllred No, with \addfontfeatures you can disable whatever ligature you want on an individual basis. @LaRiFaRi Your OP actually only asked for how to disable the ligature. The reason why fonts have the fl ligature in the first place is because those two characters otherwise collide. What you want is to use kerning to push the two characters further apart. You can easily add that to the code I suggested - I've added an example to my answer.
    – Sverre
    Nov 18, 2013 at 12:14
  • 2
    In your example with the additional kerning, (1) activating NoCommon is redundant, as the ligature will already be broken up by the kern, and (2) you inhibit hyphenation both of the (non-)ligature as well as in the rest of the word.
    – Robert
    Nov 18, 2013 at 15:56
  • 4
    A really ingenious definition of the \fl macro! However, I think one may be better off defining a macro, called \f, as \newcommand{\f}{{\char"E0E0}\-\hspace*{0pt}}, and then using it in \Au\f{}lage, drau\f{}legen, and rei\f{}lich: Doing so would preserve TeX's ability to insert hyphenation points after \f as well as in the word fragment that follows \f{}.
    – Mico
    Nov 18, 2013 at 18:00
8

The following is really just a lengthy follow-up comment on some of the issues discussed in the earlier answers that address the OP's questions. Because this comment is too long to fit in an ordinary-comment space, I'm posting it as a separate answer.

I believe the OP raises two separate issues:

  • How to break up the fl-ligature in a word such as "Auflage" -- while not suppressing all fl-ligatures, let alone all f-ligatures, globally; and
  • How to assure that the now-separate f and l glyphs don't "collide" visually.

The other answers have already mentioned various TeX- and babel-based methods for suppressing an fl-ligature on a case-by-case basis. A quick comment on the method that relies on inserting an "italic correction," viz., \/ (an "explicit kern" in TeX jargon) to break up a ligature: In my view, this method may produce a reasonable result (for some, but not necessarily) all font families, if it's used on upright-shape and normal-weight letters. Unfortunately, it tends to produce awful-looking results if the words in question are set in italic and/or bold letters. If you don't use the selnolig package for the purpose of suppressing typographic ligatures, I would strongly recommend either employing the babel shortcut "| method or the insertion of an "implicit kern", such as \kern0pt or \hspace{0pt}.

For what it's worth, the selnolig package -- which, by the way, requires use of the LuaLaTeX format -- employs an entirely different approach to suppressing typographic ligatures: It inserts so-called "whatsits" during the phase of the typesetting process when LuaTeX converts various character pairs and triples (such as ff, fi, fl, ffi, ffl, ft, fft, etc.) into single glyphs. Once the ligatures are suppressed, the "whatsits" disappear and therefore do not affect further phases, such as the hyphenation stage, of the paragraph building process.

Regarding the second issue: I think that adding a non-zero (implicit) kern between f and l for words whose fl ligature should be broken up is not ideal from a typographical point of view. This issue is particularly acute for fonts in which the f glyph has a long "arm" -- as is the case with Linux Libertine. While inserting a kern of sufficient width will indeed succeed in separating the f and l glyphs visually, it comes at the cost of creating a noticeable (and hence distracting) visual hole in words such as "Auflage", "drauflegen", "reiflich", and so on.

In my view, a better solution involves selective replacement of the ordinary "long-arm" f character -- if followed by i, j, l (or any other character that might create an unsightly collision) -- with a "short-arm" f glyph from the same font family. The good news is that quite a few Opentype font families offer such "short-armed" f glyphs. The bad news is that it takes some work to perform this character substitution. In the next version of selnolig, which I hope to release in the next couple of weeks, this method is implemented for the font family EB Garamond, which features short-armed versions of both f and ff. I'm currently investigating possibilities for implementing the long-arm-f to short-arm-f substitution for Linux Libertine as well. Stay tuned...

9
  • Thank you very much. I agree completely. Looking forward very much to the next version. Happy hacking and hopefully good luck with finding a "short-arm" f in Libertine.
    – LaRiFaRi
    Nov 18, 2013 at 13:45
  • 1
    @LaRiFaRi Libertine's f with a short arm is not "hidden" :). See my updated answer for a solution using an f with a short arm.
    – Sverre
    Nov 18, 2013 at 15:39
  • 1
    The short-f solution would of course be perfect! However, I would still say that adding a small kern can make it easier for the reader to recognise the boundaries between the partial words. So as long as it is not too much (hence distracting), it might indeed be typographically better than no kerning at all. Therefore it would be great if you could still consider this request for a future version.
    – Robert
    Nov 18, 2013 at 16:29
  • @Robert - Thanks for providing this feedback. I agree that, depending on the shape of the "short-arm f" glyph, a little bit of extra kerning may still be desirable from a typographical perspective. This may be true, for instance, for Linux Libertine, where the "arm" of the "short-arm f" glyph isn't all that short and thus still has the potential to collide with a subsequent "l". I may decide to provide an extra package option to let users specify an extra bit of kerning between unligated "f" and "l" characters.
    – Mico
    Nov 18, 2013 at 18:10
  • @Robert - I've given your suggestion to provide an option to the selnolig package to insert a bit of space at the non-ligation points quite some thought. I think having such an option would be nice for some (but probably not all) f-ligatures. However, it wouldn't be as good for most rare ligatures (ct, st, sp, sk, ll, etc). Moreover, the optimal amount of white-pace that should be inserted between an f and a trailing b, h, i, j, k, or l (but probably not r or t) will depend on the precise shape and overhang of the "arm" of the f letter. So much still to think about...
    – Mico
    Nov 29, 2013 at 21:12

You must log in to answer this question.

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