0

I'd like to get only the second subsection of this photo

Theorems Proof

such that its code is this:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{thmtools}
\usepackage{amsmath}
\usepackage{chngcntr}

\newcommand{\newsubsectheorem}[2]{%
  \newtheorem{#1}{#2}[subsection]%
  \counterwithin{#1}{subsection}}

\newsubsectheorem{theorem}{Theorem}
\newsubsectheorem{proposition}{Proposition}
\newsubsectheorem{lemma}{Lemma}
\begin{document}

\chapter{Theorem Proof}
\section{Introduction}
See these Theorems:
\subsection{These Theorems}
\newsubsectheorem{First}{First Theorem}
\begin{First}
Theorem with Its Proof.
\end{First}
\newsubsectheorem{Second}{Second Theorem}
\begin{Second}
Theorem with Its Proof.
\end{Second}
\hrule
\setcounter{subsection}{0}
\subsection{These Theorems}
\textbf{First Theorem 1.1.1.1} \textit{Theorem with Its Proof.}\vspace{3mm}\\
\textbf{Second Theorem 1.1.1.2} \textit{Theorem with Its Proof.}
\end{document}

I hope in you help, thank you so much

5
  • Please, add some details: do you want all theorems to be numbered according to the subsection and you want some theorems to have “nonstandard names”? You certainly don't want to issue \newsubsectheorem inside the document.
    – egreg
    Jul 23 at 12:31
  • Sorry, don't get what your current code is, how your current result looks like (screenshot) and how it should differ (graphical sketch) ...
    – MS-SPO
    Jul 23 at 12:46
  • First subsection is not manually-made, instead the second one (even if keeps the same numbering as the first one) is manually. I'd like to have a tex code that makes the second subsection with this number theorem: chapter.section.subsection.theoremnumber. How Must I do? Thank you and Sorry if my question has not been so clear. Now is it clear?
    – Puck
    Jul 23 at 13:03
  • @egreg I proofed with \newsubsectheorem but the result is not good...
    – Puck
    Jul 23 at 13:04
  • @Puck You didn't answer my question.
    – egreg
    Jul 23 at 13:41
2

I'm not sure that you want to number theorems in general according to the subsection number, which requires very strict subdivisions of your document and makes for clumsy references. And I hope you don't really want to number propositions and lemmas independently of theorems.

Anyway, the following code should be what you want.

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{thmtools}
\usepackage{amsmath}

\newtheorem{theorem}{Theorem}[subsection]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}

\newcommand{\namedtheoremname}{}
\newtheorem{namedtheoreminner}[theorem]{\protect\namedtheoremname}
\newenvironment{namedtheorem}[1]
 {%
  \renewcommand{\namedtheoremname}{#1}%
  \begin{namedtheoreminner}%
 }
 {\end{namedtheoreminner}}

\begin{document}

\chapter{Theorem Proof}

\section{Introduction}
See these Theorems:

\subsection{These Theorems}

\begin{namedtheorem}{First Theorem}
Theorem with Its Proof.
\end{namedtheorem}

\begin{namedtheorem}{Second Theorem}
Theorem with Its Proof.
\end{namedtheorem}

\subsection{Another}

\begin{theorem}
Theorem with Its Proof.
\end{theorem}

\end{document}

enter image description here

I'm also not sure why loading thmtools without using any of its features.

1
  • Thank you so much, is thmtools inuseful?
    – Puck
    Jul 23 at 14:45

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.