[Tex/LaTex] Numbering a “new theorem”

amsthmframednumberingtheorems

I have a (simple?) question. I use the ams theorem environment for most of my theorems, but I want to box my definitions and find here a nice way to do it, simpler for me than mdframed. My problem is I want the numbering of the theorems to be consistent with each other.

More precisely, here is my preamble about the theorem :

\newtheorem{thm}{Th\'eor\`eme}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lemme}[thm]{Lemme}
\theorembodyfont{\rmfamily}
\newboxtheorem{lem}[thm]{Lemme}
\newboxedtheorem[thcounter=thm,titleboxcolor = white]{defn}{D\'efinition}{thcounter}

Then I tried to change the counter thcounter to thm, or similar, but it didn't work.

Does anybody have any idea of how I can do so that the numbering of my definitions follows the ones of my theorems, lemma…

Best Answer

After following your link I notice the following about what you're trying to do.

  • The first optional argument seems to be used for setting and defining tikZ styles for the theorem box.
  • The first argument is not where you define a new counter. You can define a new counter in the 4th argument.

So the arguments seem to be as follows:

  • The first is optional and used for setting tikZ parameters and styles.

  • the second is for assigning the environment name.

  • The third is for setting the name of the environment: i.e., Theorem, Definition, Corollary etc.

  • The 4th argument is for creating a counter specific to the named environment.

So to get something like what you want try:

\documentclass{article}
\usepackage{amsmath,amsthm}
\usepackage{boiboites}
\pagestyle{empty}
\newboxedtheorem[boxcolor=orange, 
                 background=orange!15, 
                 titlebackground=orange!5,
                 titleboxcolor = black]
                 {theo}{Theorem}{thm}

\newboxedtheorem[boxcolor=blue, 
                 background=blue!15, 
                 titlebackground=blue!5,
                 titleboxcolor = black]
                 {defn}{Definition}{thm}

\newboxedtheorem[boxcolor=red, 
                 background=red!15, 
                 titlebackground=red!5,
                 titleboxcolor = black]
                 {coro}{Corollary}{coro}

\begin{document}
  \begin{theo}[Title for the theorem]
        \TeX\ is obsure.
  \end{theo}

  \begin{defn}[Title for the definition]
        \LaTeX\ is fun.
  \end{defn}

  \begin{coro}[Title for the corollary]
        \LaTeX\ is fun.
  \end{coro}

\end{document}

enter image description here

I'm not entirely sure what you mean by the numbering of my definitions follows the ones of my theorems,... What I've done above is made the defn environment use the same counter as theo. Is that what you want?