
Я хотел бы иметь буквы в качестве поднумерации длянекоторыйтеоремы, аналогичноэтот вопрос, но я хотел бы иметь две подтеоремы «отдельно», чтобы иметь возможность включать что-либо между ними.
Я нашел подход, который использовал newcounter
в качестве ответа на немного другой вопрос, и попытался изменить его, чтобы он делал то, что мне нужно, но я не могу заставить его работать. Вот что я попробовал:
\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newtheorem{theorem2}{Theorem}
\newcounter{pretheorem}
\counterwithin{theorem2}{pretheorem}
\renewcommand\thetheorem{\arabic{pretheorem}\alph{theorem2}}
\newcommand{\theoremgroup}{\refstepcounter{pretheorem}}
\begin{document}
\begin{theorem}
This should be Theorem 1.
\end{theorem}
\theoremgroup
\begin{theorem2}
This should be Theorem 2a.
\end{theorem2}
\begin{theorem2}
This should be Theorem 2b.
\end{theorem2}
\begin{theorem}
This should be Theorem 3.
\end{theorem}
\end{document}
решение1
Методом проб и ошибок я нашел способ. Оказывается, Latex не любит, если название теоремы заканчивается на цифру в этом случае.
\newtheorem{theorem}{Theorem}
\newtheorem{theoremgrp}{Theorem}
\newcounter{subtheorem}
\counterwithin{theoremgrp}{subtheorem}
\renewcommand\thetheoremgrp{\arabic{theorem}\alph{theoremgrp}}
\newcommand{\theoremgroup}{\refstepcounter{subtheorem}\refstepcounter{theorem}}
Использование
\begin{theorem}
Lorem ipsum
\end{theorem}
для нормальных теорем с одним числом, и
\theoremgroup
\begin{theoremgrp}
Lorem ipsum
\end{theoremgrp}
\begin{theoremgrp}
Lorem ipsum
\end{theoremgrp}
...
для многочастных теорем. Нумерация обычная, например 1, 2a, 2b, 2c, 3...
Я все еще не знаюПОЧЕМУэто работает, так что любые объяснения приветствуются!