Is this something that I can do with bibtex? I have a few different manuscripts with some other collaborators and it would be easier for me if I could make \cite{foo} and \cite{bar} point to the same thing. Of course there are ways to work around this by changing \cite{foo} to \cite{bar} everywhere in the manuscripts, or by duplicating bibtex entries in the .bib file, but I would rather not do these things.


I'm not aware of any possibility to remap keys in a .bib file; if this is true (and I think it is) then this is really a shortcoming.

So my solution is based on doing the remapping in the LaTeX preamble, and as often these days I use the prop datatype of LaTeX3 as that is really useful in such circumstances.

The basic idea is to use a property list that stores the citation keys as keys and the target keys as values. Then whenever a citation command is run we look up the key and if there is a mapping we use the mapping instead. This way the .aux file will end up having only the remapped keys in it and BibTeX will only find those.



\prop_new:N \g_cite_map_prop
\tl_new:N \l_citekey_result_tl

\cs_new:Npn \mapcitekey #1#2 {
  \clist_map_inline:nn {#2}
       {  \prop_gput:Nnn  \g_cite_map_prop  {##1} {#1}   }

\cs_new:Npn \getcitekey #1 {
   \prop_get:NoN \g_cite_map_prop{#1}  \l_citekey_result_tl
   \quark_if_no_value:NF \l_citekey_result_tl
       {  \tl_set_eq:NN #1  \l_citekey_result_tl  }

\cs_new:Npn \showcitekeymaps {\prop_show:N  \g_cite_map_prop }

This gives us \mapcitekey with two arguments: the first is our major key that we want to use with BibTeX and the second is the alternate key that we want to remap. In fact the second argument can also be a comma separated list, e.g.,



This will give us

The property list \g_cite_map_prop contains the pairs (without outer braces):
>  {world}  =>  {hello}
>  {bar}  =>  {foo}
>  {baz}  =>  {foo}
>  {foobar}  =>  {foo}.

Now to look things up we have \getcitekey and what remains to be done is to patch the citation commands to make use of this key. I have done this below for \cite and \nocite from standard LaTeX. If some other citation package such as natbib is used one needs to patch its citation commands. Basically you need to look for the places where the command \citation is being written to the .aux file and the command that is used in the argument to \citation is the one that holds the key needs to be changed.

So here are the patches necessary:

\patchcmd{\@citex}{\if@filesw}{\getcitekey\@citeb \if@filesw}%
    {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
\patchcmd{\nocite}{\if@filesw}{\getcitekey\@citeb \if@filesw}%
    {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

With those definitions and the remapping above, the input

\cite{foo} \cite{bar} \cite{world} \cite{baz}

will give us the following citations in the aux file:


By the way, duplicating BibTeX entries with different keys is not going to work (as suggested in the question). That would result in getting the same reference twice.


You could switch to biblatex. There exists an entry field IDS which does exactly what you want.

  IDS = {da},
  author    = {Vorname Nachname AND Maximilian Mustermann},
  title     = {Dies ist ein testtitel},
  journal   = {Testjournal},
  year      = {2001},
  timestamp = {2018-01-08},

Now you can cite this entry as \cite{hier} as well as as \cite{da}.

(no idea if the as as part is proper English, but it sounds sound.)

  • This also works with a biber backend. – fiedl Aug 12 '18 at 16:36

This is a bit of a hack, it might work for you.

\newcommand\OurCite[2]{\cite{#1}}% In the source for author 1


\newcommand\OurCite[2]{\cite{#2}}% In the source for author 2

and in the document :

(...) see e.g.{} \OurCite{foo}{bar}
  • 1
    the OP is looking for a a way to remap from the outside and not to change all the different manuscripts he received (and perhaps get in a different version later again). If he does what you suggest then he would be easier of just to replace the cite keys directly. – Frank Mittelbach Mar 18 '12 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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