8

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}
3
  • 3
    According to p. 7 of the libertine/biolinum user manual, your method is exactly what one should do to get proportionally-spaced lining/uppercase numbers. There seems to be no ready-made option at the package's load time in order to achieve this effect. If this method seems "ugly" to you, you could always encase it in a command and execute it in the document's preamble...
    – Mico
    Nov 17, 2011 at 4:35
  • I was afraid that might be the case. I was hoping there was a generic way to do this in pdfLaTeX in the same way that there is in XeTeX.
    – Paul M.
    Nov 17, 2011 at 15:33
  • 1
    @Mico Would you turn your comment into an answer?
    – egreg
    Dec 3, 2011 at 22:34

2 Answers 2

9

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 (or osf) for old-style figures
  • lining (or nf or lf) for lining figures
  • proportional (or p) for varying-width figures
  • tabular (or t) for fixed-width figures

These apply to the entire document. Of course, it only makes sense to specify either oldstyle or lining, and either proportional or tabular. Example:

\usepackage[oldstyle, proportional]{libertine}

\fontfamily{…} – local effect

This way is not described in the libertine documentation.

  • proportional oldstyle figures: \fontfamily{LinuxLibertineT-OsF}\selectfont 123
  • proportional lining figures: \fontfamily{LinuxLibertineT-LF}\selectfont 123
  • tabular oldstyle figures: \fontfamily{LinuxLibertineT-TOsF}\selectfont 123
  • tabular lining figures: \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:

123 tabular lining figures (default) up to here
\fontfamily{LinuxLibertineT-LF}\selectfont
123 proportional lining figures from now on

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:

123 tabular lining figures (default), but then \oldstylenums{123
(still tabular) oldstyle figures} and back to 123 tabular lining
figures
2
  • Great update. Thanks! What's the accepted etiquette re: accepted answers when the correct solution changes? Lockstep's answer was correct at the time I posed my question, but yours is the better answer now.
    – Paul M.
    Sep 3, 2016 at 18:30
  • @PaulM. Hard to say. Generally, the accepted answer is very much up for the OP’s subjective opinion. But I don’t know if it’s supposed to be temporally bound. One point to consider is that users coming from search engines see the accepted answer first and might not scroll beyond that. But then again, this isn’t one of these problems with 100k+ views and lots of “lazy” readers. There are some discussions about accepted answer policies on TeX - LaTeX Meta, perhaps also about this question. Otherwise, you could ask.
    – doncherry
    Sep 4, 2016 at 9:13
4

As Mico has commented, "[t]here seems to be no ready-made option at the package's load time in order to achieve this effect." However, if you want to put your specification in the preamble, you have use \AtBeginDocument{\usefont{T1}{fxlf}{m}{n}\selectfont}. Another possibility is to redefine libertines internal commands:

\documentclass[12pt]{article}

\usepackage[T1]{fontenc}
\usepackage{libertine}

\makeatletter
  \def\libertine@param{fxlf}% comment / uncomment to see the difference
  \def\biolinum@param{fxbf}
\makeatother

\begin{document}

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}
1
  • It seems like this solution doesn’t work with anymore with the current libertine.
    – doncherry
    Sep 2, 2016 at 18:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .