6

I found the following example of how one should be able to avoid numbering in theorems. However for me this is not working. Here is some code ( I wanted to test if the non numbering works for Propostion):

\documentclass{amsart}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage[pdftex,citecolor=green,linkcolor=red]{hyperref}
\usepackage{listings}
\usepackage{nameref}


\usepackage{amssymb}
\usepackage{amsmath,amssymb,amsfonts,mathrsfs,datetime}
\usepackage{listings}

\theoremstyle{definition}
\newtheorem{thm}{Theorem}[section]
\newtheorem*{prop*}[thm]{Proposition}

\theoremstyle{definition}
\newtheorem{definition}[thm]{Definition}
\newtheorem{example}[thm]{Example}

\theoremstyle{remark}

\newtheorem{remark}[thm]{Remark}

\numberwithin{equation}{section}

\newcommand{\R}{\mathbf{R}}  % The real numbers.

\usepackage{Sweave}
\begin{document}

\definecolor{mygreen}{HTML}{4C886B}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}

\title{Big doc}

\begin{abstract}
test1
\end{abstract}

 \maketitle
\section{Introduction}
Test2
\end{document}

I get the following error message:

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...   

So what is going wrong in my example?

m. th
  • 777

1 Answers1

11

It is well known that the *-form of the \newtheorem command does not take any optional argument. The following code illustrates the correct usage:

\documentclass{amsart}
% Removed all irrelevant/superfluous/twice-loaded packages.

\theoremstyle{definition}
\newtheorem{thm}{Theorem}[section]
\newtheorem*{prop*}{Proposition}

\begin{document}

\title{Big doc}
\author{Some One}

\begin{abstract}
    Some text.
\end{abstract}

 \maketitle
\section{Introduction}
Text above.
\begin{prop*}
    This is the claim.
\end{prop*}
Text in the middle.
\begin{thm}
    A numbered theorem.
\end{thm}
Text below.
\end{document}

The error occurs because TeX tries to typeset the optional argument as if it were text belonging to the document; but such text is not allowed before \begin{document}.

GuM
  • 21,558