This might seem like a really obvious question to some of you but I am having a bit of trouble.

I use Theorem (and Lemma etc.) environments in my documents and reference them in the proof of others - pretty standard.

The trouble I am having is what to call my theorems - the ones without names anyway.

An obvious way is to number them the same way they appear in the document, but if I then go back and add or remove theorem environments this all goes kablooey.

Does anyone have a nice logical system for doing this?

Minimal Working Example




    This is the 1st lemma (2nd 'theorem') I write, but it clarifies the proof of the theorem below, so I place it above.
    The proof of lemma.

    This is the 1st theorem I write.
    The proof of theorem using Lemma \ref{lem2}.
  • And do remember to use proper theorem constructions, not "homemade" ones.
    – daleif
    Commented Apr 25, 2017 at 13:50
  • 2
    Can you please show us a minimal but working example (MWE) that illustrates your problem referencing theorems? Such a MWE should begin with \documentclass and end with \end{document}. Commented Apr 25, 2017 at 13:53
  • Theorems and lemmas always have a meaning, so you can give them logical names even if they are not named in the printed document. You should not use numbers for \label. But even if you do so, you don't need to change the \label if you reorder, add or delete something. If your editor does not assist in finding labels you can use a package like showkeys. Commented Apr 25, 2017 at 13:58
  • OTOH, remembering what you labeled theorem 3 could be more work than renaming them. I've never found a better system, but boy can I use Replace All! Commented Apr 25, 2017 at 22:34

2 Answers 2


If I understand it correctly, your problem is that you have some \labels in some document and want to refer to them using \ref in a separate (as in "compiled separately") document.

This is a job for the xr package:

If one document needs to refer to sections of another, say aaa.tex, then this package may be loaded in the main file, and the command \externaldocument{aaa} given in the preamble. Then you may use \ref and \pageref to refer to anything which has been given a \label in either aaa.tex or the main document. You may declare any number of such external documents.


Try naming the theorems as per convenience and then label them using preassigned suitable names. For example, \label{Continuity}, \label{date11.1.19} etx

  • 1
    Better would be to use \label{thm:Continuity} etc.
    – Mensch
    Commented Feb 4, 2019 at 21:06
  • Ya. That is better. Commented Feb 6, 2019 at 7:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .