If I use the Libertine fonts from within XeLaTeX I can specify the use of proportional numbers/figures by including it as an option when I set the main font like so:
\setmainfont[Numbers={Lining,Proportional}]{Linux Libertine O}
However, I'm also interested in being able to using proportional numbers when using pdfLaTeX. Below is a MWE that shows one way to do this. My "solution" seems awfully ugly though. Is there a better way to accomplish this?
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\begin{document}
% this seems necessary to get proportional numbers in Libertine
% when using pdflatex. Comment / uncomment to see the difference
\usefont{T1}{fxlf}{m}{n}\selectfont
I would like the following numbers to be proportional so that 11,
doesn't take up as much space as 17. See what I mean?
\end{document}
Best Answer
Here’s an answer for the current
libertine
version of 2014/11/25, since lockstep’s answer doesn’t work anymore with this current version (probably due to the changes in maintainer and conception since 2011).Generally, Linux Libertine’s digits are either proportional (different widths) or tabular (same widths), and either oldstyle (different heights) or lining (same heights):
By default, i.e. if you don’t change anything,
libertine
uses tabular lining figures.You can specify the style of numbers in three different ways, which have different ranges.
Package options – global effect
oldstyle
(orosf
) for old-style figureslining
(ornf
orlf
) for lining figuresproportional
(orp
) for varying-width figurestabular
(ort
) for fixed-width figuresThese apply to the entire document. Of course, it only makes sense to specify either
oldstyle
orlining
, and eitherproportional
ortabular
. Example:\fontfamily{…}
– local effectThis way is not described in the
libertine
documentation.\fontfamily{LinuxLibertineT-OsF}\selectfont 123
\fontfamily{LinuxLibertineT-LF}\selectfont 123
\fontfamily{LinuxLibertineT-TOsF}\selectfont 123
\fontfamily{LinuxLibertineT-TLF}\selectfont 123
These commands are placed in the document body, not in the preamble, and they change the font starting at the point where they’re placed. For more details on how to use these commands, have a look at the LaTeX answer to How do I use a particular font for a small section of text in my document?. Example:
Macro – small, selective effect
\oldstylenums{123}
\liningnums{123}
\proportionalnums{123}
\tabularnums{123}
These macros only change the style of the numbers in the argument. Example: