# cross-references for previous lemmas and theorems

I'm new with LaTeX and I'm having trouble with the enumeration given when I cross-reference, It doesn't match the one given by the section.

\documentclass[10pt,letterpaper]{book}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsthm}
\usepackage{enumerate}

\author{My name}
\title{Title}

\theoremstyle{definition}

\begin{document}
\maketitle

\chapter*{Introducción}

\chapter{Conceptos preliminares}

\newtheorem{cont}[section]{Definición}
\begin{cont}
def
\end{cont}

\chapter{The Theorem}
\newtheorem{ext}[section]{Definición}
\begin{ext}
def
\end{ext}

\newtheorem{clocc}[section]{Definición}
\begin{clocc}
def
\end{clocc}

\newtheorem{tm}[section]{Teorema}
\begin{tm}
thrm
\begin{proof}
proof
\end{proof}
\end{tm}

\newtheorem{arcoord}[section]{Definición}
\begin{arcoord}
def
\end{arcoord}

\newtheorem{l1}[section]{Lema}
\begin{l1}
lemma \label{l1}
\begin{proof}
proof
\end{proof}
\end{l1}

\newtheorem{l4}[section]{Lema}
\begin{l4}
lemma
\begin{proof}
Lema \ref{l1}
\end{proof}
\end{l4}

\end{document}


Apart from the 'usefulness' of using numbers as part of the environment name (or using l1 as label name), there are some issues here:

• Just use one \newtheorem for each theorem type, i.e. a Lema or a Theorem or Example etc.

• Reusing \newtheorem for each new lema would lead to environments all being numbered as 1 or 1.1, etc. -- this is awkward.

• I don't think that section should be a shared counter here, but the resetting counter, i.e. [section] belongs to end of the theorem definition, not in between (but this is a guess only)
• \ref without a previous label won't work (apart from giving ? as output!, i.e. the\label{l1} must be specified before!

\documentclass{article}

\usepackage{amsthm}

\newtheorem{l1}{Lema}[section]

\begin{document}
\section{Foo}

\begin{l1}
This is a lemma. \label{l1}
\end{l1}
\begin{proof}
The proof is left to the reader
\end{proof}

\begin{l1}
This is another lemma.
\end{l1}
\begin{proof}
The result follows from Lemma \ref{l1}.
\end{proof}

\end{document}


• Thank you! The label is working fine now, though I still don't understand the "newtheorem" proper usage. – 416333 Jul 26 '16 at 19:54
• I edited my question trying to post only a "skeleton" of my work to see where I'm going wrong – 416333 Jul 26 '16 at 19:56
• @ElDinosaurio: As I told you already: You don't need to define a \newtheorem for each Defnicion etc. The definition is exactly meant to have them available at any place later on. You need different \newtheorem calls for different types only, i.e. Lema, Definicion etc. Ideally, ,\newtheorem` should be used in the preamble only – user31729 Jul 27 '16 at 3:14