我正在使用thmtools
作为前端,amsthm
并且我有一个如下的定义环境。
\declaretheorem[
style=mydefinitionstyle,
name=Definition,
numberwithin=chapter
]{definition}
我想要的是另一个环境,比如说称为definitionAlt
,它将用于给出刚刚给出的定义的另一个定义,即,它使用与刚刚给出的定义相同的数字/计数器,但添加了“a”(或“b”或其他),而不增加计数器,并且交叉引用仍然有效。
\begin{definition}
\label{def:main_definition}
This is a definition which is numbered 1.1
\end{definition}
\begin{definitionAlt}
\label{def:alt_definition}
This is an alternative definition to the preceding one, which is automatically numbered 1.1a
\end{definitionAlt}
我见过类似的问题,例如 当编号完全是手动的时候,排版定理等的最直接的方法是什么?
它进行一些手动定理编号,但我找不到完全符合我要求的答案。
有人有什么建议吗?
答案1
\documentclass{report}
\usepackage{thmtools}
\declaretheorem[
style=mydefinitionstyle,
name=Definition,
numberwithin=chapter
]{definition}
\declaretheorem[
style=mydefinitionstyle,
name=Definition,
numberwithin=definition,
]{definitionAlt}
\renewcommand\thedefinitionAlt{\thedefinition\alph{definitionAlt}}
\begin{document}
\chapter{Testing Alternate Definitions Counter}
\begin{definition}
\label{def:main_definition}
This is a definition which is numbered 1.1
\end{definition}
\begin{definitionAlt}
\label{def:alt_definitiona}
This is an alternative definition to the preceding one, which is automatically numbered 1.1a
\end{definitionAlt}
\begin{definitionAlt}
\label{def:alt_definitionb}
This is an alternative definition to the preceding one, which is automatically numbered 1.1b.
\end{definitionAlt}
\begin{definition}
\label{def:another_main_definition}
This is a definition which is numbered 1.2.
\end{definition}
And, of course, I can refer to my second alternate definition, the definition \ref{def:alt_definitionb} and my another definition, the definition \ref{def:another_main_definition} quite well!
\begin{definitionAlt}
\label{def:new_alt_definitiona}
This is an alternative definition to the preceding one, which is automatically numbered 1.2a.
\end{definitionAlt}
begin{definition}
\label{def:yet_another_main_definition}
This is a definition which is numbered 1.3.
\end{definition}
\end{document}
谢谢马可·丹尼尔感谢他的帮助!
输出
下面是: