Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have two definitions defined as follows:

\newtheorem{definition_1}{Definition 1}[chapter]
\begin{definition_1}
    \label{def:def_1}
    Definition 1 text here.
\end{definition_1}

\newtheorem{definition_2}{Definition 2}[chapter]
\begin{definition_2}
    \label{def:def_2}
    Definition 2 text here.
\end{definition_2}

With references to them as

Definition~\ref{def:def_1}
Definition~\ref{def:def_2}

Both give me the same definition number (3.1). I have enabled the associated package:

\usepackage{amsthm}

How do I fix this?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

You needn't define a new environment at each use:

\documentclass[a4paper]{book}
\usepackage{amsthm}
\newtheorem{definition}{Definition}[chapter]

\begin{document}
\mainmatter
\chapter{Definitions}

\begin{definition}\label{defa}
Text of the definition
\end{definition}

\begin{definition}\label{defb}
Text of the second definition
\end{definition}

\ref{defa} and \ref{defb}
\end{document}

All theorem-like environment are declared before \begin{document}.

share|improve this answer
    
Thanks, that worked perfectly. –  Josh Jul 5 '11 at 20:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.