This question led to a new package:

I want to reference to citations from other file. Similar to what xr package does to labels, but I want to apply it for the bibliography.

If I'm able to do \cite{someone} in the main file, and it creates let say the number [4], I want to do the same \cite{someone} in a second file, and also create the same number [4]. Similar to what xr does with the labels.

By the way, I tried to add the main.bbl file from the main file. However, that adds all the references to the end of the second file. I want to avoid this.

Is there any package that accomplish this?


Save the following in your working directory as xc.sty:

         [2011/09/02 v0.1 eXternal Citations (DPC+EG)]

    \PackageWarning{xc}{^^JNo file #1^^JLABELS NOT IMPORTED.^^J}%
    \PackageInfo{xc}{IMPORTING LABELS FROM #1}%
  \read\@inputcheck to\XC@line

%% End of file `xc.sty'.

Then say, in your derived.tex document,


(where main.tex is the document you are taking the citations from). Now


in derived.tex will do what you want.

The interface is just the same as xr's: you can also specify a prefix


and use \cite{A-xyz} in derived.tex.

The xc.sty file has been obtained from xr.sty with some very simple transformations:

  1. xr -> xc
  2. XR -> XC
  3. \externaldocument -> \externalcitedocument
  4. \newlabel -> \bibcite
| improve this answer | |
  • Thank you so much. That worked like charm. Why this isn't a default package? It's great! :) – adn Sep 2 '11 at 12:04
  • 3
    A package (called xcite) is on its way to CTAN – egreg Sep 2 '11 at 13:22
  • 2
    The xcite package is on CTAN, waiting for TeX Live to add it, too. – egreg Sep 3 '11 at 20:56
  • 1
    Are there plans to make this work with hyperref (similar to xr-hyper)? – Joachim Breitner Oct 24 '17 at 3:16
  • @JoachimBreitner It appears that xr-hyper is provided by hyperref. In fact, hyperref contains some code that complements xr-hyper. – Spherical Triangle Mar 29 '19 at 5:29

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.