1

I'm writing a paper, which roughly looks like this:

\documentclass[a4paper]{paper}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\newtheorem{defn}{Definition}
\newtheorem{prop}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{exmp}{Example}

\begin{document}

\section{Test}

\section{My Section}

\subsection{My Subsection}

\begin{defn}
My definition: 
\begin{equation}
 Y^2 + X^3 = 0,
\end{equation}
\end{defn}

\end{document}

So basically, the definition is displayed as Definition 1, whereas it is written inside subsection 2.1, and hence I want the definition to be written as Definition 2.1.1. Also the equation is denoted as (1), whereas I want it to be denoted as (2.1), since it is the first equation of section 2. Any ideas how to achieve this?

4
  • Usually statements are numbered just within sections: are you sure every statement is in a subsection?
    – egreg
    Commented Mar 6, 2018 at 16:53
  • What if the definition is inside section 2, but before subsection 2.1 has started?
    – egreg
    Commented Mar 6, 2018 at 17:03
  • My question was: how do you want them to be numbered in that case?
    – egreg
    Commented Mar 6, 2018 at 17:11
  • @egreg Since, all my definitions are inside subsections, this is not a concern for me.
    – pixel
    Commented Mar 6, 2018 at 17:13

1 Answer 1

1

this is for an article unusual demand. however, it can be establish with:

\documentclass[a4paper]{paper}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\newtheorem{defn}{Definition}[subsection]% <--- for definitions
\newtheorem{prop}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{exmp}{Example}
\numberwithin{equation}{subsection} % <--- for equations

\begin{document}
\section{Test}
\section{My Section}
\subsection{My Subsection}

\begin{defn}
My definition:
\begin{equation}
 Y^2 + X^3 = 0,
\end{equation}
\end{defn}
\subsection{My Subsection}

\begin{defn}
My definition:
\begin{equation}
 Y^2 + X^3 = 0,
\end{equation}
\end{defn}

\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .