# How to use \theorem?

I don't know why this doesn't work:

I'm a beginner in LaTeX and I'm trying a lot to understand this.

The code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{amsthm}

\begin{document}
\begin{theorem}
Given two line segments whose lengths are $a$ and $b$ respectively there
is a real number $r$ such that $b=ra$.
\end{theorem}

\begin{proof}
To prove it by contradiction try and assume that the statemenet is false,
proceed from there and at some point you will arrive to a contradiction.
\end{proof}
\end{document}


The log:

! LaTeX Error: Environment theorem undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.8 \begin{theorem}
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
LaTeX Font Info: External font cmex10' loaded for size
(Font) <7> on input line 9.


Remark 1: I've installed Texmaker and Texlive with sudo apt-get install texlive-full

Remark 2: My OS is Ubuntu and my latex editor is Texmaker.

Remark 3 I'm studying using this site but I used also the documentation of the package amsthm. (in the documentation we should use lem instead of lemma command)

Thanks

• Welcome to TeX.SX! Please help us to help you and add a full minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. You might also want to add to your question how you're including the pdfs etc. – Aradnix Sep 19 '14 at 3:00
• @Aradnix it's in the picture. – user26832 Sep 19 '14 at 3:01
• @user26832: Please add your code as real text, not as an image. Users here hardly can extract it from the image, unless tediously typing int as Aradnix asked of you already. – user31729 Sep 19 '14 at 3:03
• Well is a quite difficult to read on my 17" screen. You could copy the code and paste it below your question, if you indent four times or press Ctrl + K you can set the code view. Meanwhile read this, after read how to create a MWE in the link above, could be useful. – Aradnix Sep 19 '14 at 3:03
• @ChristianHupfer ok, I'll do that. – user26832 Sep 19 '14 at 3:03

amsthm is a package to create theorems and theorem-related environments. It does not do this by default. So, you could issue

\newtheorem{theorem}{Theorem}


to define the theorem environment:

\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
Test
\end{theorem}
\end{document}

• The detail here is that you have to define previously in your preamble each and every one of the kinds of statements you want to use i.e.a theorem, proof, corollary, lemma, etc. – Aradnix Sep 19 '14 at 3:19
• it's highly recommended to read the amsthm documentation (texdoc amsthm` if you're on a tex live installation). it's only 5 pages long, and contains other useful hints. – barbara beeton Sep 19 '14 at 13:32