无论它是像定理这样的注释,还是像定理这样的定义,或者任何其他的,我怎样才能做出相同的编号declaredtheorem
。
这就是我所拥有的:
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[name=Definición, numberwithin=chapter, style=definition]{defn}
\declaretheorem[name=Teorema, numberwithin=chapter]{teo}
\declaretheorem[name=Ejemplos, numberwithin=chapter]{ej}
\declaretheorem[name=Lemma, numberwithin=chapter]{lem}
\declaretheorem[name=Proposición, numberwithin=chapter]{prop}
\declaretheorem[name=Corolario, numberwithin=chapter]{cor}
\declaretheorem[name=Nota, style=remark, numberwithin=chapter]{nota}
\declaretheorem[name=Comentario, style=remark, numberwithin=chapter]{com}
我尝试使用 numberlike,例如
\declaretheorem[name=Definición, numberwithin=chapter, style=definition]{defn}
\declaretheorem[name=Teorema, numberlike=defn]{teo}
但它不起作用。
这是一个简短的例子
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[name=Definición, numberwithin=chapter, style=definition]{defn}
\declaretheorem[name=Teorema, numberwithin=chapter]{teo}
\begin{document}
\section{First}
\begin{defn}
First definition.
\end{defn}
\begin{teo}
First theorem
\end{teo}
\begin{defn}
Second definition (with numbering of definitions).
\end{defn}
\begin{teo}
Second theorem (I would like it to be number 4)
\end{teo}
\end{document}
编辑:
Numberlike 工作正常。使用thmtools
package with cleverref
package 时出现问题。
答案1
也许这就是你想要实现的:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{cleveref}
\declaretheorem[name=Teorema,numberwithin=section]{teo}
\declaretheorem[name=Definición,style=definition,numberlike=teo]{defn}
\begin{document}
\section{First}
\begin{teo}\label{testteo}
example theorem
\end{teo}
\begin{defn}\label{testdefn}
First definition.
\end{defn}
\cref{testteo} \cref{testdefn}
\end{document}
请注意,numberlike
可以使用共享计数器来计数teo
和。由于文章没有章节,因此dfn
我也用替换了。我还提供了包和一些示例来演示其工作原理。numberwithin=chapter
numberwithin=section
cleveref
\label
\cref