2

In a beamer document with the serif font scheme, I would like to use the "Libertine Display" font as a lighter alternative to the standard "Libertine Regular" (see http://www.linuxlibertine.org/index.php?id=86&L=1 --> Styles).

But the \libertineDisplay command from the libertine package does have no effect. The embedded font, as reported in the document properties of my viewer, is the same whether \libertineDisplay is enabled or not.

This is my MWE:

\documentclass{beamer}

\usefonttheme{serif}

\usepackage{libertine}
\libertineDisplay %doesn't change anything

\usepackage{kantlipsum}

\begin{document}
\begin{frame}{Introduction}
\kant[1]
\end{frame}
\end{document}
4

The libertine package has no provision for making Linux Libertine Display the main text font.

The command \libertineDisplay is a font switch, similar to \sffamily.

You can make “Display” the main font with a hack:

\documentclass{beamer}
\usefonttheme{serif}

\usepackage{libertine}
\usepackage{etoolbox}
\makeatletter
\patchcmd\libertine@family{Libertine}{LibertineDisplay}{}{}
\makeatother

\usepackage{kantlipsum}

\begin{document}

\begin{frame}{Introduction}

\kant[1]

\end{frame}

\end{document}

Be warned that the font is only available in upright shape: no italic and no boldface.

If you just want to change the font for medium weight and normal shape, you can copy the file

OT1LinuxLibertineT-TLF.fd

in the working directory and change

 66 \DeclareFontShape{OT1}{LinuxLibertineT-TLF}{m}{n}{
 67       <-> \LinuxLibertineT@@scale LinLibertineT-tlf-ot1
 68 }{}

into

 66 \DeclareFontShape{OT1}{LinuxLibertineT-TLF}{m}{n}{
 67       <-> \LinuxLibertineT@@scale LinLibertineDisplayT-tlf-ot1
 68 }{}

(line numbers just for reference; 2017/03/20 release).

You can use a different strategy if you use XeLaTeX or LuaLaTeX and fontspec

\usepackage{fontspec}

\setmainfont{LinLibertine_}[
  Extension=.otf,
  UprightFont=*DR,
  ItalicFont=*RI,
  BoldFont=*RB,
  BoldItalicFont=*RBI,
  % other features
]
  • Thank you. But "Libertine Regular" isn't bold/italic/typewriter etc. too. Those shapes are separate fonts, activated by the corresponding font switch commands. I just want to substitute the regular roman for main text with "Libertine Display". Does your hack achieve this? – AlexG Mar 31 '17 at 8:53
  • @AlexG No, it doesn't. I don't think you really want it. Are you using regular pdflatex or XeLaTeX? – egreg Mar 31 '17 at 8:56
  • Currently pdflatex. – AlexG Mar 31 '17 at 8:57
  • 1
    @AlexG You should make a copy of OT1LinuxLibertineT-TLF.fd in your working directory and change the entry for {m}{n} to have LinLibertineDisplayT instead of LinLibertineT. – egreg Mar 31 '17 at 9:17
  • This works very well! Thanks! I just wonder why we couldn't place the command in question, \DeclareFontShape{OT1}{LinuxLibertineT-TLF}{m}{n}{..}, directly into the header of the document source file? – AlexG Mar 31 '17 at 10:02

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.