I am writing up lecture notes for a class and it gets quite long and has many theorems, lemmas, etc. I would like to know how to get the numbering of these environments to reset at the start of each section. As it is now, these environments are getting numbered in the hundreds at it looks bad. Below are all the relevant parts of my preamble. I have looked into this a non-trivial amount and asked the professor whose class the notes came from for help and the best we got is including "\numberwithin{equation}{section}" in the preamble. This did not solve the problem unfortunately. Is there a simple fix so that theorems in section n are numbered n.1, n.2, etc.?
\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{preamble}
\usepackage{listings}
\usepackage{enumitem}
\geometry{tmargin=.75in, bmargin=.75in, lmargin=.75in, rmargin = .75in}
\title{Ma 121a Lecture Notes}
\author{Instructor: Dr. Professor\\ Notes written by Me}
\date{Academic Year 2019-2020}
\numberwithin{equation}{section}
\begin{document}
\maketitle
\vspace{.25in}
\section*{Lecture 1}
\addtocounter{section}{1}
\begin{definition}
This is Definition 1.1.
\end{definition}
\begin{definition}
This is definition 1.2.
\end{definition}
\section*{Lecture 2}
\addtocounter{section}{1}
\begin{theorem}
This is Theorem 2.3. But I would like it to be Theorem 2.1.
\end{theorem}
The above is a MWE. What follows below is the preamble I load in separately as a .sty file using \usepackage{preamble}. The MWE will not work without the preamble.
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{wasysym}
\usepackage{verbatim}
\usepackage{bbm}
\usepackage{graphics}
\usepackage{geometry}
\usepackage{latexsym}
\usepackage{epsfig}
\usepackage{bm}
\usepackage{xspace}
\usepackage{times}
\usepackage{listings}
\usepackage{color}
\usepackage{tikz}
\usetikzlibrary{graphs,graphs.standard}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{conjecture}[theorem]{Conjecture}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\usepackage{preamble}line I get that\geometryis undefined. I haven't bothered to try anything else after that. --- GOM – Peter Wilson Jul 01 '20 at 17:28\numberwithin{equation}{section}and\newtheorem{theorem}{Theorem}[section]do seem like they should produce the desired behaviour (as far as I have understood it). Perhaps you could manually typeset some minimal desired output so that we can see exactly what you mean (like here)? The MWE should also include some minimal text body, not just the preamble. – dwolfeu Jul 02 '20 at 06:33preamble.stybut you have shown no code for the body of the document --- no\section, no theorems, lemmas, etc. Your MWE should start with\documentclass...and end with\end{document}that we can process that shows your problem. We can make wild guesses as to what you have done, but they will be wild and probably nothing to do with what you have actually done. – Peter Wilson Jul 02 '20 at 17:36\section*{title}and\addtocounter{section}{1}! Use\sectionif there is numbering involved. At least use\stepcounter{section}. – Donald Arseneau Jul 02 '20 at 23:56