3

I'm writing an essay in Latex and I want to do the following thing, which I'll explain with an example. Suppose that I have a theorem 1.1 and inside it I have to specify an equation. Is there a way in which I can label automatically the equation as 1.2 and such that the subsequent theorem is labelled 1.3? Furthermore, is it possible to do this with any kind of proposition (like examples, lemmata etc.)?

Thank you very much!!

2

Simply enumerate the theorem like environment within equation counter. Note the position of the [equation] (in front of the environment name {theorem}.

\documentclass{report}  
\usepackage{amsmath,amsthm}
\newtheorem{theorem}[equation]{Theorem}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{theorem}
    content...
    \begin{equation}
    content...
    \end{equation}
\end{theorem}

\lipsum[2]

\begin{equation}
content...
\end{equation}

\begin{theorem}
    content...
    \begin{equation}
    content...
    \end{equation}
\end{theorem}

\end{document}

enter image description here

4

Try with the following.

\documentclass{article}
\usepackage{amsmath,amsthm}

\numberwithin{equation}{section}
\newtheorem{theorem}[equation]{Theorem}
\newtheorem{lemma}[equation]{Lemma}

\begin{document}
\section{Section}
\begin{theorem} This is a theorem \end{theorem}
\begin{equation} Equation \end{equation}
\begin{lemma} This is a lemma \end{lemma}
\end{document}

You need the combination of two commands:

  1. \numberwithin{equation}{section} tells LaTeX to number equations with the style sectionnumber.equationnumber.

  2. \newtheorem{theorem}[equation]{Theorem}: you probably already use newtheorem; the middle argument in square brackets tells LaTeX to reuse an existing counter for the theorem numbers rather than defining a new one. Typically one uses it like \newtheorem{theorem}{Theorem} and then \newtheorem{lemma}[theorem]{Lemma}, so that lemmas and theorems share numeration, but the same command works also in this less traditional use case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.