# Latex errors with \begin{theorem}

I am trying to create a new theorem in a tex document, but I keep getting an error. Here is the code I am currently using

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{hyperref}
\usepackage{enumerate}
\usepackage{wasysym}
\usepackage{lipsum}
\usepackage{amssymb}
\usepackage{amsthm}

\setlength{\oddsidemargin}{.25in}
\setlength{\evensidemargin}{.25in}
\setlength{\textwidth}{6in}
\setlength{\topmargin}{-0.4in}
\setlength{\textheight}{9.5in}

\newtheorem{theorem}[Theorem]

\begin{document}

\begin{theorem}
My Tex doesn't work
\end{theorem}

\end{document}

When I try to compile this, I get three errors.

Paragraph ended before \@ynthm was complete.

Environment theorem undefined. \begin{theorem}

\begin{document} ended by \end{theorem}. \end{theorem}

I am assuming the last error is a direct consequence of \begin{theorem} not being recognized, so if I can solve the first two errors, I think I will be okay.

I have tried changing \newtheorem{theorem}[Theorem] to \newtheorem{theorem}{Theorem}[Theorem] to no avail, and changed \begin{theorem} to \begin{theorem}[Theorem] again with no positive result.

Any ideas would be very helpful, thanks!

• Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – user31729 Jul 20 '16 at 15:52
• Also don't set \oddsidemargin etc. directly. Use the geometry package for this! – user31729 Jul 20 '16 at 15:52

The syntax of \newtheorem can be confusing:

See the amsthm documentation for more detailled explanation but in short it's like this:

Use

• \newtheorem{theorem}{Theorem} if theorem shall be the counter (it's defined then, and Theorem is the environment name.)
• \newtheorem{theorem}{Theorem}[foo] if Theorem should be the environment name and foo is an existing counter that shall be used as the reset driver
• \newtheorem{theorem}[foobar]{Theorem} if foobar is a different counter that already exists and should be used for counting.

In any case: \newtheorem{theoremenvironment}{Environmentname} is mandatory. This was missing in the OP.

The precise behaviour depends on the position of the optional argument (or if it is used at all ;-))

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{enumerate}
\usepackage{wasysym}
\usepackage{lipsum}
\usepackage{amssymb}
\usepackage{amsthm}

\usepackage{hyperref}

%\setlength{\oddsidemargin}{.25in}
%\setlength{\evensidemargin}{.25in}
%\setlength{\textwidth}{6in}
%\setlength{\topmargin}{-0.4in}
%\setlength{\textheight}{9.5in}

\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}
My Tex does work now
\end{theorem}

\end{document}
• This worked perfectly! Once the minimum time has elapsed, I will accept this answer. Thanks so much! – Sean English Jul 20 '16 at 15:59
• Perhaps better to explain that \newtheorem{theorem}{Theorem} generates a new counter, theorem that can then be used in other \newtheorem declarations \newtheorem{lemma}[theorem]{Lemma} – daleif Jul 20 '16 at 15:59
• @daleif: See my additions right at the top ;-) I was posting it while you were 'complaining' ;-) – user31729 Jul 20 '16 at 16:00
• I would remove the \newcounter stuff from the MWE, as it will confuse more users than it will help – daleif Jul 20 '16 at 16:07
• the documentation for amsthm (texdoc amsthm) has a pretty cogent explanation of how the arguments in braces and brackets are supposed to work. that is, if you have the documentation that was totally rewritten in 2015. – barbara beeton Jul 20 '16 at 21:55