# Having several keys refer to the same bibliography entry

Is it possible to have several keys referring to the same bibliography entry (using biblatex+Biber)?

For example, I'd like \cite{Tolkien:1954:LordOfTheRings} and \cite{lotr} to have exactly the same effect when used in a document (and produce only a single bibliography entry, when both are used in the same document).

-
Assuming that lotr is defined in your bibliography and you want to use Tolkien:1954:LordOfTheRings, try \makeatletter \expandafter\def\csname b@Tolkien:1954:LordOfTheRings\endcsname{\b@lotr} \makeatother in your document preamble? – Werner Dec 5 '11 at 22:54
@Werner: But wouldn't one have to use \cite{\csname b@Tolkien:1954:LordOfTheRings\endcsname} in the main text? – lockstep Dec 6 '11 at 0:06
@lockstep: AFAIK, \cite{<stuff>} checks for the existence of \b@<stuff> via a construction. So you should just be able to use \cite{Tolkien:1954:LordOfTheRings}. – Werner Dec 6 '11 at 0:10
@Werner: I'd love to see a MWE using this trick. :-) – lockstep Dec 6 '11 at 0:12
I'm looking into this for biber 0.9.8. Probably something like this @BOOK{key1, IDS={key2,key3, ... keyn}, ...} where you can cite by either the main key or any of the secondary IDs. I need a little bit of biblatex support to deal with citations of the same entry via different keys as this can't be dealt with entirely in biber. – PLK Dec 7 '11 at 16:56

With newer versions of biblatex (≥2.0) and biber (≥0.9.8) you can define your entries as normal and use the "IDS" field for extra citations keys:

@BOOK{key,
IDS = {key2, key3, ..., keyn},
.
.
}


You can then cite by any of the keys, you can cite by any of them mixed in the same section and and you can use \nocite{*} too - it won't duplicate entries in the bibliography. In fact, the other keys are just aliases to the main key which owns the entry in the .bbl and are redirected to the main key before any label generation etc. happens.

It will also detect if you use a key as a primary key and also an alias elsewhere, in which case it will disable the alias. It also notices duplicate aliases as well as keys now.

-
Great news -- the biblatex/biber combo keeps getting better and better! – lockstep Dec 8 '11 at 23:13
We have some pretty significant features coming. I wonder if it would be possible to have somewhere on here to announce and request comments and suggestions for them - Community wiki perhaps? The problem is that the new features are not so visible and so problems are often reported a long time after they were introduced when someone discovers the features in the biblatex Release file. – PLK Dec 9 '11 at 12:27
Is there some update about official support for this from the biblatex side? – Caramdir Mar 20 '12 at 17:04
Good question. I have an unofficial biblatex 1.7 patch for this but the biblatex maintainer seems to have disappeared temporarily for about six months and I don't know how to contact him. – PLK Mar 21 '12 at 7:58
Seems still to be an issue: I get Undefined control sequence \keyalias. So are any update on this by now? Still biblatex person not available? @PLK: can you say what slightly hacked means? I mean is there a patch to see the actual difference? The link to the biblatex.sty seems outdated. – math Oct 18 '13 at 8:22

The following, taken from "Alias for BiBTeX Keys" on comp.text.tex, provides \bibalias{<alias>}{<source>} and should use \acite{<citation>} instead of \cite{<citation>}:

\documentclass{article}
\usepackage{biblatex}% http://ctan.org/pkg/biblatex
\bibliography{references}

\makeatletter
% \bibalias{<alias>}{<source>} makes \cite{<alias>} equivalent to \cite{<source>}
\newcommand\bibalias[2]{%
\@namedef{bibali@#1}{#2}%
}

\newtoks\biba@toks
\newcommand\acite[2][]{%
\biba@toks{\cite#1}%
\def\biba@comma{}%
\def\biba@all{}%
\@for\biba@one:=#2\do{%
\@ifundefined{bibali@\biba@one}{%
\edef\biba@all{\biba@all\biba@comma\biba@one}%
}{%
\PackageInfo{bibalias}{%
Replacing citation \biba@one' with \@nameuse{bibali@\biba@one}'
}%
\edef\biba@all{\biba@all\biba@comma\@nameuse{bibali@\biba@one}}%
}%
\def\biba@comma{,}%
}%
\edef\biba@tmp{\the\biba@toks{\biba@all}}%
\biba@tmp
}
\makeatother

\bibalias{Tolkien:1954:LordOfTheRings}{lotr}

\begin{document}
The reference~\acite{Tolkien:1954:LordOfTheRings} is
exactly the same as~\acite{lotr}.

\bibstyle{plain}
\printbibliography
\end{document}


where references.bib resembles:

@book{lotr,
author  = "J.R.R. Tolkien",
title   = "{The Lord of the Rings}",
year    = 1954,
publisher = "Ballantine Books"
}

-
I've packed it up at absatzen.de, but I don't remember why it's v0.2 anymore. (Also, it's quite possible that it will not work with more advanced syntactic forms of \cite. I think it'll accept anything that has a comma-separated list of labels as the first mandatory argument and pretty arbitrary stuff between the command and that argument.) – Ulrich Schwarz Dec 6 '11 at 7:41
This seems to work well. I would have preferred something that is completely transparent in the actual document (i.e. everything is defined in the .bib file), but that doesn't seem to be possible. – Caramdir Dec 6 '11 at 19:11
I'll accept this until biber/biblatex directly supports multiple keys. – Caramdir Dec 8 '11 at 19:58

Pure-bibtex answer:

Put this in the preamble and then use \bibalias{new key}{old, long, and cumbersome key}. It is the original LaTeX \cite macro, modified only by the two unindented "magic" lines.

% Bib aliases
\makeatletter
\def\@citex[#1]#2{\leavevmode
\let\@citea\@empty
\@cite{\@for\@citeb:=#2\do
{\@citea\def\@citea{,\penalty\@m\ }%
\edef\magic##1{\let##1\expandafter\noexpand\csname bibalias@\@citeb\endcsname}%
\magic\tmp \ifx\tmp\relax\else \let\@citeb\tmp\fi
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
\@ifundefined{b@\@citeb}{\hbox{\reset@font\bfseries ?}%
\G@refundefinedtrue
\@latex@warning
{Citation \@citeb' on page \thepage \space undefined}}%
{\@cite@ofmt{\csname b@\@citeb\endcsname}}}}{#1}}
\def\bibalias#1#2{\expandafter\def\csname bibalias@#1\endcsname{#2}}
\makeatother

-
Does this work together with biblatex? – moewe Feb 11 at 16:54
It probably does (although tbh I don't know what a biblatex is). It works by tweaking the lowest level of LaTeX's \cite, so probably works with anything that does not touch that command; else, adapting it should be fairly trivial! – Circonflexe Feb 12 at 14:53
I had the feeling that it probably wouldn't work with biblatex since that uses a new way to implement the \cite macros and indeed, it didn't work for me just now. (To be fair, I cannot say for sure that I dibn't do something wrong, I just copied the code, wrote a \bibalias and expected it to work with \cite.) Maybe you want to warn people that your solution will not work with biblatex out of the box (the question is specifically about biblatex`). I assume the "trivial" modifications will lead to something like in Werner's answer? – moewe Feb 12 at 16:58