I am new in the LaTeX world, so I don't understand everything about it, especially about the use of fonts.
I installed Linux Libertine font on my distribution (I use Gentoo, so I installed the package media-fonts/libertine-ttf
), and it works fine using WYSIWYG programs, like LibreOffice. I can use the Linux Libertine O
, Linux Libertine O C
etc.
But, using XeTeX, it doesn't work. I set in my header
\setmainfont[Mapping=tex-text,Ligatures={Contextual, Common, Historical, Rare, Discretionary}]{Linux Libertine O}
But when I compile with xelatex
, it says
(/usr/share/texmf-dist/tex/latex/carlisle/scalefnt.sty)kpathsea: Invalid fontname `Linux Libertine O', contains ' ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! fontspec error: "font-not-found" ! ! The font "Linux Libertine O" cannot be found. ! ! See the fontspec documentation for further information. ! For immediate help type H . !...............................................
When I remove the O
in Linux Libertine O
, it says:
fontspec warning: OpenType feature 'Ligatures=Contextual' (+clig) not availabl e (fontspec) for font 'Linux Libertine', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Ligatures=Contextual' (+clig) not availabl e (fontspec) for font 'Linux Libertine', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Ligatures=Contextual' (+clig) not availabl e (fontspec) for font 'Linux Libertine', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Ligatures=Contextual' (+clig) not availabl e (fontspec) for font 'Linux Libertine/B', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Ligatures=Contextual' (+clig) not availabl e (fontspec) for font 'Linux Libertine/B', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Ligatures=Contextual' (+clig) not availabl e (fontspec) for font 'Linux Libertine/I', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Ligatures=Contextual' (+clig) not availabl e (fontspec) for font 'Linux Libertine/I', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Ligatures=Contextual' (+clig) not availabl e (fontspec) for font 'Linux Libertine/BI', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Ligatures=Historical' (+hlig) not availabl e (fontspec) for font 'Linux Libertine/BI', (fontspec) with script 'Latin', and language 'Default'. fontspec warning: OpenType feature 'Letters=SmallCaps' (+smcp) not available (fontspec) for font 'Linux Libertine/BI', (fontspec) with script 'Latin', and language 'Default'. LaTeX Font Warning: Font shape `OT1/LinuxLibertine(0)/m/n' undefined (Font) using `OT1/cmr/m/n' instead on input line 26.
What is wrong with my code (shown below)?
\documentclass[12pt]{lettre}
\usepackage{xunicode}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{lmodern}
\usepackage{eurosym}
\usepackage[frenchb]{babel}
%\setromanfont[Mapping=tex-text, Numbers=OldStyle, Ligatures=Historical]{Linux Libertine}
\setmainfont[Mapping=tex-text,Ligatures={Contextual, Common, Historical, Rare, Discretionary}]{Linux Libertine}
\begin{document}
\begin{letter}{Régie Trouduc'\\42, rue de tes fesses\\69007 Lyon}
\name{Lenny Baralair}
\address{Georges Dupont\\42, rue du chariot d'or\\69001 Lyon\\
{\addfontfeature{Letters=SmallCaps} Numéro de référence locataire : 654654654} }
\lieu{Paris}
\telephone{06 42 42 42 42}
\nofax
\conc{pouet}
\opening{Madame, Monsieur,}
Ceci est ma lettre que je ne veux pas rendre public sur ce site.
\closing{Je vous prie d'agréer,
Madame, Monsieur,
l'expression de mes salutations distinguées.}
\end{letter}
\end{document}
Best Answer
First, a font does not necessarily support all types of ligatures. Linux Libertine supports only (checked here)
Ligatures={Common,Rare,Discretionary}
.The OpenType variant of Linux Libertine shipped with
media-fonts/libertine-ttf
works on an up-to-date Gentoo with TeX Live 2011. Another option is to install thedev-texlive/texlive-fontsextra
package, which also contains the font. To use it and to be able to select it by name, run this command after installation:This will allow all programs to access fonts installed in the TeX Live
texmf
tree.Then this code will work as expected:
Note: This was tested on TeX Live 2011. Gentoo has TeX Live 2010 as the stable version. If you keep experiencing problems, try upgrading to the newer version of TeX Live.