I have a problem with my theorem and examples/definitions numbering. For my theorem environment I used the mdframed packages but for my definitions/examples I used \newtheorem{}{}
. Here you can see that my theorem is numbered 3.5.1 but also my example is numbered as 3.5.1!
How can I get a numeration like Theorem 3.5.1 and Example 3.5.2 and so on?
Here there is my code:
\usepackage[framemethod=TikZ]{mdframed}
\newcounter{theo}[section]
\setcounter{theo}{0}
\renewcommand{\thetheo}{\arabic{chapter}.\arabic{section}.\arabic{theo}}
\theoremstyle{definition}
\newtheorem{definizione}{Definizione}[section]
\newtheorem{esempio}[definizione]{Esempio}
\newtheorem{algoritmo}[definizione]{Algoritmo}
\newtheorem{osservazione}[definizione]{Osservazione}
\theoremstyle{plain}
\newtheorem{corollario}[definizione]{Corollario}
\newtheorem{proposizione}[definizione]{Proposizione}
\newenvironment{theo}[2][]{%
\refstepcounter{theo}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=black!20]
{\strut Teorema~\thetheo};}%
}%
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=black!20]
{\strut Teorema~\thetheo~(#1).};}%
}%
}%
\mdfsetup{innertopmargin=10pt,linecolor=black!30,%
linewidth=2pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax}
\begin{mdframed}[backgroundcolor=gray!10]\relax\label{#2}}{\end{mdframed}%
}