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
\documentclass{article}
\newtheorem{thm}{Theorem}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}[thm]{Lemma}
\begin{document}
\begin{lem}\label{lem2}
This is the 1st lemma (2nd 'theorem') I write, but it clarifies the proof of the theorem below, so I place it above.
\end{lem}
\begin{proof}
The proof of lemma.
\end{proof}
\begin{thm}\label{thm1}
This is the 1st theorem I write.
\end{thm}
\begin{proof}
The proof of theorem using Lemma \ref{lem2}.
\end{proof}
\end{document}
Best Answer
If I understand it correctly, your problem is that you have some
\label
s 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: