2

I want:

  • my document to be rendered in the Libertine (or Libertinus) typeface with all the default ligatures enabled (including Th and Qu);
  • use guillemets (»«) and other special characters directly in the text;
  • those guillemets to be rendered properly (and not as some resized ≪);
  • to compile my document with PDFLaTeX.

My best attempt at this is:

\documentclass[border=3pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[OT1]{fontenc}
\usepackage{libertine}

\begin{document}
»Thesaurus frisst Quastenflosser!«
\end{document}

This produces the desired result, except for using fake guillemets, instead of Libertine’s:

Product of the above source

What I want is:

Goal

How can I achieve this? I tried combinations of different options (such as T1) for fontenc or disabling it and babel to no avail.

There are several similar questions, but the solutions all use macros for the guillemets or XeLaTeX, which I am well aware of but cannot or do not want to use.

7
  • 1
    Why are you using OT1 and not T1? The latter will usually tell latex that the various font parts are available in the font and shouldn't need to be constructed – daleif Oct 27 '20 at 12:23
  • @daleif I think it's about the ligatures: libertine cheats a bit and sneaks the Th and Qu ligatures in the OT1 encoding. This is not possible with T1. – campa Oct 27 '20 at 12:24
  • well you could define the quotes to switch encoding, but be aware that while you gain ligatures with OT1 you loose copy& paste (and search) for umlauts. – Ulrike Fischer Oct 27 '20 at 12:28
  • @campa then one your probably use a proper font instead. – daleif Oct 27 '20 at 12:30
  • 1
    @daleif I wasn't necessarily agreeing with the purpose but only explaining the reason behind the choice... – campa Oct 27 '20 at 12:35
3

Sadly, T1 encoding and Libertine ligatures do not work together when using pdftex. Using the OT1 encoding will give you the nice ligatures but will suppress hyphenation and break kerning in any word containing an umlaut or a ß, and will prevent any possibility of copy/pasting or searching for text in the final PDF document. Note also that not all automatic ligatures are meaningful, and you might need to break some of them manually: for example, OT1 Libertine has a "fb" ligature which in most cases is not desired.

This being said, it is relatively easy to achieve what you want, and

\documentclass{article}

% \usepackage[OT1]{fontenc} % is the default anyway
\usepackage[utf8]{inputenc} % not really necessary since 2018
\usepackage{libertine}

\usepackage[ngerman]{babel}

\usepackage{newunicodechar}
\newunicodechar{»}{{\fontencoding{T1}\selectfont\guillemotright}}
\newunicodechar{«}{{\fontencoding{T1}\selectfont\guillemotleft}}

\begin{document}

»Thesaurus frisst Quastenflosser!«

\end{document}

will give the desired output

enter image description here

However, I must remark again that the drawbacks of using an OT1 encoded font are enormous when writing in German. Since I don't think that the Th and Qu ligatures are soooo common in a normal text, I would rather use the T1 encoding and define a macro for the desired ligature, e.g. something like

\newcommand*{\Qu}{{\fontencoding{OT1}\selectfont Qu}}
2
  • Using \usepackage{libertine} without explicitly loading fontenc implies OT1, right? – Wrzlprmft Oct 27 '20 at 14:17
  • @Wrzlprmft In this case yes, though this might not always be true: some font packages force T1. – campa Oct 27 '20 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.