Generalamsthm | Counters for Theorem Environments cause Problems

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
itatitl
Posts: 13
Joined: Thu Mar 24, 2011 8:20 am

amsthm | Counters for Theorem Environments cause Problems

Post by itatitl »

To achieve a common numbering for my theorems, lemmas and propositions while using the amsthm package, I used the \newtheorem{prop}[thm], etc commands. However this leads to the "missing \begin{document}" error. If I put \begin{document} before \newtheorem{prop}[thm], it prints [thm], etc in the first page. What is the solution?

Code: Select all

\documentclass[12pt,twoside,A4]{report}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{theoremref}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}[section]
\newtheorem{lem}[thm]{Lemma}[section]
\newtheorem{cor}[thm]{Corollary}[section]
\begin{document}
test
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

amsthm | Counters for Theorem Environments cause Problems

Post by localghost »

You cannot use two optional counter resets for a theorem definition.

Code: Select all

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{theoremref}

\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}

\begin{document}
  Test
\end{document}
For details see Section 3 of the amsthm manual.


Thorsten
itatitl
Posts: 13
Joined: Thu Mar 24, 2011 8:20 am

Re: amsthm | Counters for Theorem Environments cause Problem

Post by itatitl »

Thanks for the reply. I see that the [section] and [thm] arguments are mutually exclusive. But is there any way to achieve this ( common numbering for theorems and lemmas but with section number prepended)? Is it possible to do this via running sections as different files of a single project.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

amsthm | Counters for Theorem Environments cause Problems

Post by localghost »

itatitl wrote:[…] But is there any way to achieve this ( common numbering for theorems and lemmas but with section number prepended)? […]
Then those two have to be given the same numbering scheme.

Code: Select all

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{theoremref}

\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}{Lemma}[section]
\newtheorem{cor}[thm]{Corollary}

\begin{document}
  \chapter{Foo}
    \section{Bar}
      \begin{thm}
        Theorem
      \end{thm}
      \begin{lem}
        Lemma
      \end{lem}

\end{document}
itatitl wrote:[…] Is it possible to do this via running sections as different files of a single project.
This does not depend on whether the document is split into several files or not.
itatitl
Posts: 13
Joined: Thu Mar 24, 2011 8:20 am

Re: amsthm | Counters for Theorem Environments cause Problem

Post by itatitl »

Thanks for the reply. This clarifies it. I need not put [section] on lemma, prop, etc as I had already declared them to be [thm] and want to follow a common numbering scheme.
Post Reply