[Tex/LaTex] Linux Libertine package and fonts not working anymore (fall 2012)

fontslibertinepackages

So in the last couple of weeks I've had some issues with the Linux Libertine font and
package, both don't seem to work anymore on a completely up-to-date version of MacTeX (which is equivalent to TeX Live 2012). The issues don't appear on a Ubuntu 12.04
box which is running TeX Live 2009; I work on both computers regularly so
it would be nice if any solution would work on both systems.

I'm compiling my files with pdflatex.

As I have two problems (one with the package and one with the font itself) I'll
split this question in two parts.

Libertine Package

I've always been using the libertine package like this:

\documentclass{article}
\usepackage[osf]{libertine}
\usepackage[T1]{fontenc}
\begin{document}
The quick brown fox jumps over the sleazy dog, 0123456789.
\end{document}

This however gives me the following warning and error:

LaTeX Warning: You have requested package `libertine-type1',
               but the package provides `LinuxLibertineO'.


! LaTeX Error: Unknown option `osf' for package `libertine-type1'.

When I ignore it, the output seems to be fine:
Linux Libertine

Libertine font

I've also been using this font directly in other documents, like this (cf. How do I use a particular font for a small section of text in my document?):

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
\fontfamily{fxlj}\selectfont
The quick brown fox jumps over the sleazy dog, 0123456789.
\end{document}

This gives the following warning:

LaTeX Font Warning: Font shape `OT1/fxlj/m/n' undefined
(Font)              using `OT1/cmr/m/n' instead on input line 3.

And shows the following output:

Not Linux Libertine

Best Answer

The Linux Libertine fonts recently switched from libertine-legacy to libertine-type1 in TeX Live. This resulted in many documents not working any more, especially with old-style-figures.

Libertine Package

Old-style-figures are default in the latest version, so just use:
\usepackage{libertine} or \usepackage[oldstyle]{libertine}.

The fact that the osf option doesn't work seems to be a bug, as they list it in the documentation (nf is also broken).

If you don't want old-style-figures, use: \usepackage[lining]{libertine}

The options oldstyle and lining won't work with the old package - so it's kind of a shame that osf and nf are broken. As of (at least) 2012-10-30 libertine has support for osf and nf again.

Libertine font

The packages and font-names have changed, now you can use one of the following:

\fontfamily{LinuxLibertineO-OsF}\selectfont
\fontfamily{LinuxLibertineO-LF}\selectfont

The first is for old-style figures. Remember: you should always import the package the font comes with, even if you only use it in titles. If you don't, you might have to select the font weight and shape manually (after the font-family) with:

\fontseries{m} % Choose from m (medium), b (bold) and sb (semibold)
\fontshape{i}  % Choose from n (normal), it (italic) and sc (small-caps)

There are many more shapes, the rest is listed in the documentation.

Compatibility

If you want to make your document work on both TeX Live 2012 and 2009, I recommend defining a command for it:

\IfFileExists{libertine-type1.sty}{ % Check for libertine-type1 package
    \newcommand\libertine{LinuxLibertineO-OsF}
}{
    \newcommand\libertine{fxlj}
}

And use the following in your document:

\fontfamily{\libertine}\selectfont

If you want to add options to the libertine package, you can do this in the same way:

\IfFileExists{libertine-type1.sty}{ % Check for libertine-type1 package
    \usepackage[oldstyle]{libertine}
}{
    \usepackage[osf]{libertine}
}

This will work with both the old and the new package. It is also nice to know that the new libertine package also does the \usepackage[T1]{fontenc} for you.

Example

In the following example I've tried to apply as much as possible:

\documentclass{article}
\usepackage{lipsum} % For dummy text

\IfFileExists{libertine-type1.sty}{ % Check for libertine-type1 package
    \newcommand\libertine{LinuxLibertineO-OsF}
    \usepackage[oldstyle]{libertine}
}{
    \newcommand\libertine{fxlj}
    \usepackage[osf]{libertine}
    \usepackage[T1]{fontenc}
}

\begin{document}
\section{\fontfamily{\libertine}\fontseries{b}\fontshape{sc}\selectfont Lorem ipsum dolor sit amet}
\lipsum[2]
\end{document}

With MacTeX 2012:

Lorem ipsum, 2012

With TeX Live 2009:

Lorem ipsum, 2009

It's not exactly the same, but acceptable.