# Changing numbers font features while changing shape

I am writing a document with the main font set up with old numbers, but I would like to have the "normal" style in the tables. This works but one particular table has some of the numbers in italic and somehow I cannot find a way of changing the font feature for these.

It turns out that the table is irrelevant and using \itshape or \em or \textit{} in normal text give the same result:

\documentclass[preview,border=2px,12pt]{standalone}

\usepackage{fontspec}
\setmainfont [Numbers = {Proportional,OldStyle}]{Linux Libertine O}

\begin{document}

2189 89283 98239 8098 2983 098023 \textit{1392843902984u29830} {\itshape 1981987092183749280}

{
2189 89283 98239 8098 2983 098023 \textit{1392843902984u29830} \itshape 1981987092183749280
}

\end{document}


Any idea what I am doing wrong? Or have I hit a bug?

-

With XeLaTeX I get the warning

*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
*
* OpenType feature 'Numbers=Lining,Monospaced' (+tnum) not available for font
* 'Linux Libertine O/BI' with script 'Latin' and language 'Default'.
*************************************************


that's probably the cause for this. I get the expected result by defining a new font family, instead of adding features on the fly:

\documentclass[varwidth,border=2pt,12pt]{standalone}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont [Numbers = {Proportional,OldStyle}]{Linux Libertine O}
\newfontfamily{\libertinelf}{Linux Libertine O}

\begin{document}

2189 89283 98239 8098 2983 098023 \textit{1392843902984u29830} {\itshape 1981987092183749280}

{\libertinelf
2189 89283 98239 8098 2983 098023 \textit{1392843902984u29830} \itshape 1981987092183749280
}

\end{document}


-
thanks @egreg, I am not getting any such messages with LuaLaTeX, and XeLaTeX for me does not work (can't find the font, but that is a completely different issue). Your solution works though. – ArTourter Dec 5 '12 at 0:35

Fontspec has some issues with lnum and tnum when already using Oldstyle numbers. One of the easiest ways to resolve this is by using the latest libertine package:

\documentclass[preview,border=2pt,12pt]{standalone}

\usepackage{libertine}

\begin{document}

2189 89283 98239 8098 2983 098023 \textit{1392843902984u29830} {\itshape 1981987092183749280}

\liningnums{%
2189 89283 98239 8098 2983 098023 \textit{1392843902984u29830} \itshape 1981987092183749280
}
\end{document}


Monospaced numbers also work (except for italic numbers):

-

Use libertine.sty:

\usepackage{libertine}
\begin{document}
2189 89283 98239 8098 2983 098023 \textit{\libertineLF 1392 84390 29842 9830}
\end{document}

-
For this to be a usable answer you need to make this in to a complete working document (e.g. there is no document class and \libertineLF is not defined in the set-up I tried) and perhaps tell us which tex engine is to be used. – Andrew Swann Dec 6 '12 at 16:01
@AndrewSwann: \libertineLF is defined in the latest version of the libertine package (in fact \liningnums —which my answer uses— is defined as \DeclareTextFontCommand{\liningnums}{\libertineLF}). You might want to update. – Silke Dec 6 '12 at 16:15
@AndrewSwann: If you have a recent libertine package installed, \libertineLF will work with any of the LaTeX engines. – user22108 Dec 6 '12 at 16:27
@Silex I confess, it has gone at least 3 days since I updated my distribution on this machine. Adding \documentclass{article} is now sufficient to make the above code run. – Andrew Swann Dec 6 '12 at 16:33