# Layout Problems due to Using the Libertine Font in Beamer

Using Linux Biolinum as the sans font in beamer leads to layout problems for several themes. This seems to be related to a bug in the font, since it does not provide the right x-value, see here. I am just wondering if there exists a work-around. I am using MikTeX and the latest libertine fonts.

Here is a MWE.

\documentclass{beamer}
\usetheme{CambridgeUS}
\usepackage{libertineotf}
\begin{document}
\section{Beamer}
\begin{frame}{Beamer}
\begin{enumerate}
\item test
\end{enumerate}
\end{frame}
\end{document}


Maybe these pictures help to clearify my problem. Without the libertine package everything is exactly where it should be.

But with libertine the header, footer are misplaced and the enumeration symbol is too small.

-
I don't encounter any surprises or bugs when I run your MWE under either xelatex or lualatex; I use TeXLive2011 and the latest version of the Libertine/Biolinum fonts (see ctan.org/tex-archive/fonts/libertine for the latest version). Which TeX distribution, and which version of the Libertine/Biolinum fonts do you have on your system? –  Mico Dec 22 '11 at 15:05
Where is precisely the problem? I don't see anything strange. –  egreg Dec 22 '11 at 15:05
Which version of the libertineotf package are you using? I'm unable to replicate the behavior you're illustrating when I run your MWE under xelatex (TeXLive2011, w/ latest versions of the Libertine fonts and of the libertineotf package). However, the problem does surface when running the MWE under lualatex. –  Mico Dec 22 '11 at 16:21
I can reproduce it here, the font have a very small os2_xheight value: 101 while it should be 432 at least, an this results in wrong \fontdimen5 calculation. No idea how to fix it though, apart from editing the cached font(s) under ~/.texlive2011/texmf-var/luatex-cache/generic/fonts/otf/, but this will get overwritten when the font changes (e.g. new version). I suggest you report this to Linux Libertine authors. –  Khaled Hosny Dec 22 '11 at 17:32
@Mico, you are absolutely right. This problem only comes up, when compiling with luatex. –  maetra Dec 23 '11 at 21:21

Use the libertine package (libertine.sty 2012/10/19 - 0.03: Font Libertine/Biolinum - Herbert Voss)

i.e.

\usepackage{libertine}


\usepackage{libertineotf}

-

(This solution only applies to the T1 fonts available via libertine v5.1.2 dated 2011/06/06, and therefore does not properly address the posted question. If a moderator feels this answer should be deleted, please feel free to do so. At the moment I'm just leaving it here in case someone is still hanging on to v5.1.2 to be able to use Libertine and Biolinum in pdflatex.)

I asked the same question to comp.text.tex a couple of months back, and an interim solution was provided by Ulrike Fischer and Robin Fairbairns, by resetting the ex value in the .fd files.

The following was copies from my blog post summarising what I did:

Locate the Biolinum .fd files, which should be in $TEXMF/tex/latex/libertine/. I usually work with T1 encoding, so I homed in on the files t1fxb.fd, t1fxbf.fd, t1fxbj.fd, t1fxbjo.fd and t1fxbo.fd. (All these files, because sometimes I want the old-style numbers fonts.) I then added for each m-n series-shape: \DeclareFontShape{T1}{fxb}{m}{n}{ <-> \fxl@@scale fxbr-t1 }{\fontdimen5\font=\fontcharht\font\x}  I didn’t bother with the \DeclareFontShape of other series-shapes, as the above seems to have fixed the problem for me. - Ah. I knew I had seen such a question but had forgetting where ;-). But maetra is using libertineotf which indicates xelatex or lualatex and otf fonts and so this solution can't be used directly. – Ulrike Fischer Dec 22 '11 at 16:01 @UlrikeFischer Oof, I didn't see the otf in the package name! Sorry for being so remiss. Should I just delete this answer then? – LianTze Lim Dec 22 '11 at 16:07 Thanks a lot for the help, but your solutions does not seem to work in my case. I am not able to find the mentioned files. In my libertine folder in $TEXMF/tex/latex/libertine/ there are only two .sty and four .inc files. Doing a search on t1fxb.fd did not provide any results. –  maetra Dec 22 '11 at 16:13
@maetra I think you have the latest version, while mine is still 1 version behind. The latest version dropped support for the T1 fonts, hence the .fd files are no longer available. I don't think I can offer more help now; I can't update my packages at the moment... –  LianTze Lim Dec 22 '11 at 16:17
@maetra Try the new libertine-legacy package. –  lockstep Dec 22 '11 at 16:59

If one wants to use libertine-otf or fontspec, there is the possibility, as Khaled Hosny suggested, to edit the cached config file temp-linbiolinum-r.lua. This file can be found for TeXLive in ~/.texlive2011/texmf-var/luatex-cache/generic/fonts/otf/ and for MiKTeX in Miktex\luatex-cache\generic\fonts\otf. Quite at the end of that file is the entry os2_xheight=101, that needs to be replaced by os2_xheight=432,. When the cached config file is rebuild, this has to be repeated.

-

I still have the same problem, using xelatex and the default libertine packages coming with Ubuntu 13.10. My workaround was to install the Graphite-Version and using the following code to set the font:

\usefonttheme{professionalfonts}
\usepackage{xltxtra}
\setsansfont{Linux Biolinum G}
`

I am not sure, if all three lines are nessessary or correct, but at least I got the font and bullets working.

-