This question already has an answer here:

For a manuscript I need to include theorem proofs as supplementary material. So I mention the theorem in the main file and I need to re-print the theorem in the supplementary material with the same theorem number and then provide the proof.

For this purpose I define the theorem in the main.tex file as follows:

  Sample theorem. 

  Refer to supplementary material.

Then in my supplementary material file supp.tex I use the xr package and refer to my main document as


But I am not able to refer to the theorem as such


It gives the following error message

Undefined control sequence.

marked as duplicate by Ignasi, Phelype Oleinik, user156344, Raaja, Sebastiano Feb 19 at 13:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.