Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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...

share|improve this question
    
Could you include a MWE. I don't know what packages your working with. –  A.Ellett Jan 23 '13 at 3:20
add comment

1 Answer

up vote 3 down vote accepted

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?

share|improve this answer
    
Is it possible to do this but give an input flag for black and white boxes for b&w printing? –  masfenix Jan 23 '13 at 3:49
    
@masfenix. "input flag"? I'm not sure what you mean. Do you want the color, but if printed to black-and-white a different setting? You can always use a gray-scale instead of colors. And I think using xcolor you can define your own color scheme. Using xcolor and some conditionals you should be able to switch from color to a black-gray-white output. –  A.Ellett Jan 23 '13 at 3:52
    
@masfenix. Personally, I find the colors distracting. That's not to say I don't use them, I do. But only when I'm modeling something that my students see it their textbooks. –  A.Ellett Jan 23 '13 at 3:55
    
Awesome, thanks a lot for your answer, that's indeed exactly what I wanted. My mistake was to put the name of the counter inside the "options" of the command \newboxedtheorem[thcounter=thm,titleboxcolor = white]{defn}{D\'efinition}{thcounter} –  antoine Jan 23 '13 at 9:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.