# Can't get theorems in an appendix

I get the error

\begin{document} ended by \end{theorem}. \end{theorem} and Environment theorem undefined. \begin{theorem}

when trying to compile this latex document.

Here is the problematic code:

\documentclass[a4paper, 12pt, notitlepage]{report}

\usepackage{amsfonts} % if you want blackboard bold symbols e.g. for real numbers
\usepackage{graphicx} % if you want to include jpeg or pdf pictures
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{float}

\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{Def}[thm]{Definition}
\newtheorem{cond}[thm]{Condition}
\newtheorem{rem}[thm]{Remark}
\newtheorem{conj}[]{Conjecture}
\newtheorem*{post}{Postulate 1}
\newtheorem*{post2}{Postulate 2}
\newtheorem*{ex}{Exercise}
\newtheorem{exa}[thm]{Example}

\title{An Introduction to Geometric Measure Theory} % change this
\author{x} % change this
\date{\today} % change this

\numberwithin{equation}{subsection}

\begin{document}

\appendix
\chapter{Covering Theorems}

\begin{theorem}
Let $X$ be boundedly compact metric space and $\mathcal{B}$ a family of closed      balls in $X$ such that
$$sup\{d(B):B \in \mathcal{B}\}$$
\end{theorem}

\end{document}

• When asking questions it is better to provide a full minimal working example (MWE) both in order to demonstrate what you are trying to do and to help others help you. The MWE should like like \documentclass...\begin{document}...\end{document}, it should compile and contain close to the minimal amount of code needed to explain/demonstrate what you are asking. This saves a lot of time for everyone.
– user30471
Oct 19 '14 at 11:47
• Btw, you can highlight code blocks in your posts either by indenting them by 4 spaces or by using the '{}' on the gui.
– user30471
Oct 19 '14 at 11:48
• Apologies was not aware of this Oct 19 '14 at 12:07
• The problem is that the theorem environment is not defined in preamble – only a thm, which displays ‘theorem’. Replacing theorem with thm compiles perfectly. Oct 19 '14 at 12:15
• You get the Environment theorem undefined error; always look at the first error message, not the last one. Oct 19 '14 at 12:24

When you type

\newtheorem{thm}{Theorem}[section]


it means that it will number by sections, write "Theorem" and you refer to it using the environment name thm.

You need to write

\begin{thm}
Let $X$ be boundedly compact metric space and $\mathcal{B}$ a family of closed      balls in $X$ such that
$$sup\{d(B):B \in \mathcal{B}\}$$
\end{thm}


or you can obtain same result

{\thm
Let $X$ be boundedly compact metric space and $\mathcal{B}$ a family of closed      balls in $X$ such that
$$sup\{d(B):B \in \mathcal{B}\}$$
}

• If you use {\thm <statement>} in your own documents, fine. But it's very wrong and it shouldn't be even told to newbies. And you shouldn't use it, I add: the result is definitely not the same and it's not the only reason for declaring this wrong. Oct 19 '14 at 16:11