# How to have consecutive numbering of Theorems, definitions and so on using thmtools [closed]

How can I make the same numeration regardless it is a remark like Theorem or a definition like Theorem or any other declaredtheorem.

This is what I have:

\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}


I tried using numberlike, for example

\declaretheorem[name=Definición, numberwithin=chapter, style=definition]{defn}
\declaretheorem[name=Teorema, numberlike=defn]{teo}


but it didn't work.

Here is a short example

\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}


# Edit:

Numberlike works just fine. The problem arises when using thmtools package with cleverref package.

## closed as unclear what you're asking by user31729, Bobyandbob, Stefan Pinnow, Troy, TeXnicianFeb 25 '18 at 10:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Could you post a minimal, yet complete, example code demonstrating the problem? (B.t.w., is your user name linked to Charlie Parker?) – Bernard Jan 25 '18 at 2:08
• @Bernard There it is. Somewhat, it is related to Art Blakey ;) – Jrnm Jan 25 '18 at 2:48
• The example I wrote worked just fine. Also, I was able to modify it using numberlike to solve my issue. What caused all the trouble was the use of cleverref package. – Jrnm Jan 25 '18 at 3:14
• You say numberwithin=chapter, but your document uses article -- that won't work – user31729 Jan 25 '18 at 6:54

Maybe this is what you want to achieve:

\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}


Please note the option numberlike to use a shared counter for teo and dfn. I have also replaced numberwithin=chapter by numberwithin=section as articles don't have chapters. I have also included the cleveref package and some \label \cref examples to demonstrate how it works.