# How to use lining figures in bibliography item labels?

This is similar to How to change the appeareance of bibliography item labels in amsrefs?, but aiming at standard BibTeX styles.

I have a document that uses old style figures in the main text. I also have a bibliography with the alpha style. Most references have more than one author, so the item labels consist of capital letters, and the year, abbreviated. The old style figures look displaced in those labels because of the many capital letters.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[osf]{libertine-type1}
\usepackage{url,natbib}

\begin{document}
\cite{LaTeXbase,armtex}

\bibliographystyle{alpha}
\bibliography{minitoc} % bibtex/bib/minitoc/minitoc.bib
\end{document}

How can I change to lining figures inside those bibliography item labels?

-
Sorry for messing with the bold formatting, but my guess is still that your question has nothing to do with bibtex and a lot to do with the libertine font. –  lockstep Feb 8 '13 at 10:24
@lockstep I disagree humble. OsF can come from any font, libertine is just an example here. And the {bibtex} and {natbib} tags are there because I want that specific setup (maybe I should have mentioned that?!), I'm afraid I get a biblatex solution otherwise. –  mafp Feb 8 '13 at 10:32
It didn't occur to me that "bibtex" meant "not biblatex" in this case. As for libertine being only an example: I'm afraid there's no standard way to switch from oldstyle numbers (if provided) to lining numbers. Would you be interested in solutions involving mathpazo or cfr-lm? –  lockstep Feb 8 '13 at 13:15

I had the same problem, but with biblatex and fontspec. The solution by mafp, redefining \@biblabel, did not work for me. The following did:

It is not necessary to change the way the labels are formatted, just select the correct font feature when the labels are written.

-

First we set up a macro for switching the font to proportional lining figures. This depend of course on the used typeface.

\usepackage[osf]{libertine-type1}
\newcommand{\switchtoPLF}{\fontfamily{LinuxLibertineO-LF}\selectfont}

% \usepackage[osf]{mathpazo}
% \newcommand{\switchtoPLF}{\fontfamily{ppl}\selectfont}

% \usepackage{cfr-lm}
% \newcommand{\switchtoPLF}{\plstyle}

When using natbib, switching the citation, resp. the reference item to the lining figures is as simple as

\renewcommand{\bibnumfmt}[1]{[\switchtoPLF{}#1]}    % switch reference item
\renewcommand{\citenumfont}[1]{{\switchtoPLF{}#1}}  % switch citation item

Without natbib, the following works:

\usepackage{etoolbox}
\makeatletter
\renewcommand{\@biblabel}[1]{[\switchtoPLF{}#1]}        % switch reference item
\patchcmd{\@citex}%
{\csname b@\@citeb\endcsname}%
{\switchtoPLF\csname b@\@citeb\endcsname}{}{}  % switch citation item
\makeatother

Both approaches work with hyperref, and also work with numbered bibliography styles like plain, or plainnat.

-