Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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).

share|improve this question
1  
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
2  
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

2 Answers 2

up vote 8 down vote accepted

I have something working for this now in the biber 0.9.8 beta which you can get from SourceForge:

https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/development/

You will also need to be using a slightly hacked biblatex 1.7 .sty from:

https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/testfiles/biblatex.sty

Then, define your entries as normal but you can use the new "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.

This interface isn't finalised - I haven't spoken to the biblatex maintainer about incorporating this yet but since it re-directs the citations at a fairly low level, I think it's probably safe. Haven't done too much testing though so please log a bug on the biber SourceForge tracker if you find a problem. Please don't log a bug on the biblatex tracker as it's not official yet.

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.

share|improve this answer
    
Great news -- the biblatex/biber combo keeps getting better and better! –  lockstep Dec 8 '11 at 23:13
2  
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
2  
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>}:

enter image description here

\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}",
  address = "New York",
  year    = 1954,
  publisher = "Ballantine Books"
}
share|improve this answer
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.