[Tex/LaTex] Font problem with XeLaTeX

fontsfontspeclibertinexetex

When trying to compile my .tex file using the xelatex command in TeXmaker (with MiKTeX), I get this error message:

! fontspec error: "font-not-found"
!
! The font "Linux Libertine O" cannot be found.
!
! See the fontspec documentation for further
information.

I have looked at the fontspec documentation, but haven't found anything helpful.

My .tex file looks like this:

\documentclass[11pt]{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\begin{document}
\section{Unicode support}

\subsection{English}
All human beings are born free and equal in dignity and rights.

\subsection{Íslenska}
Hver maður er borinn frjáls og jafn öðrum að virðingu og réttindum.

\section{Ligatures}
\fontspec[Ligatures={Common, Historical}]{Linux Libertine O Italic}
Questo è strano assai!

\section{Numerals}
\fontspec[Numbers={OldStyle}]{Linux Libertine O}Old style: 1234567\\
\fontspec[Numbers={Lining}]{Linux Libertine O}Lining: 1234567

\end{document}

Does anyone have an idea of how I could fix this problem?

Best Answer

Choosing the right name for a font is sometimes hard. The specification

\setmainfont[Ligatures=TeX]{Linux Libertine O}

should work if you have the font among the system fonts. However XeTeX is able to use also fonts that reside in the TeX tree and are not in the system fonts.

In the case of Linux Libertine, the call should be something like

\setmainfont
      [ Ligatures = TeX,
        Extension = .otf,
        SmallCapsFeatures={Letters=SmallCaps},
        UprightFont    = *_R,
        ItalicFont     = *_RI,
        BoldFont       = *_B,
        BoldItalicFont = *_BI,
      ] {LinLibertine}

The package libertine frees you from this burden. Check the package documentation to see what options can be passed to the call

\usepackage[...]{libertine}

where ... stands for zero or more option, such as oldstyle or lining to choose between the two styles for figures.