3

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}

item labels with osf

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

mafp
  • 19,096
  • Sorry for messing with the bold formatting, but my guess is still that your question has nothing to do with [tag:bibtex] and a lot to do with the [tag:libertine] font. – lockstep Feb 08 '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 08 '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 08 '13 at 13:15

3 Answers3

1

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.

mafp
  • 19,096
0

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

\AtBeginBibliography{\renewcommand{\makelabel}[1]{\addfontfeatures{Numbers = Lining}#1}}

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

Ruud
  • 1,423
0

Since this is the first question that showed up for me when I searched how to do this with BibLaTeX, the easiest way to use lining figures in labels (both when cited and in the bibliography), is to redefine the labelalpha field like this:

\DeclareFieldFormat{labelalpha}{\liningnums{#1}}

\liningnums{...} is the command provided by the libertine package. Different font packages provide different commands (like \textlf{...} in xcharter) or none at all. If no command to switch to lining figures is provided, a new one can be defined similar to mafp's answer.

Erik
  • 83
  • 4