2

I have a repository with one document, but I think of splitting it into two documents, whereas I want to cross-reference from one to eachother.

Is there a way, to "rewrite" \ref to automatically expand to the chapter number (or whatever) if the current document contains the label, or to expand to something like "<chapter name> in the document \someDocumentNameConstant" and if yes, how to?

All document names can be retreived via variables/constants.


Of course you cannot \ref to a chapter number in another document, as the chapter number gets generated. I also know that the chapter name of the referenced chapter wouldn't be in the current translation unit, but maybe someone knows a trick to do this kind of setup!

I hope this question isn't to dumb!

  • 3
    xr package allows you to \ref labels in other documents. It doesn't automatically detect whether the definition is in another document though. – David Carlisle Mar 23 '14 at 16:24
  • @DavidCarlisle Make an answer, please. No, it's not emberrassing to explain one's own package. Otherwise this question here will be in the unsanswered list, although it has been answered. – Keks Dose Mar 23 '14 at 17:59
  • @KeksDose well as I said in the comment it isn't clear xr is an answer. – David Carlisle Mar 23 '14 at 18:03
  • There is also hyperref, assuming you are producing pdf. In this case you will have to replace \ref with \href or \hyperlink, but that is what "change all" was made for. – John Kormylo Mar 24 '14 at 17:38

Your Answer

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

Browse other questions tagged or ask your own question.