# setting section number, etc with counter

Originally, I have these types of numbering:

\newtheorem{theorem}{Theorem}[section]
\newtheorem{definition}[theorem]{Definition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{example}[theorem]{Example}

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}


Now because of the box theorem function, I modified them to below:

\newboxedtheorem[boxcolor=orange, background=blue!5, titlebackground=blue!20,titleboxcolor = black]{theorem}{Theorem}{mycounter}
\newboxedtheorem[boxcolor=orange, background=blue!5, titlebackground=blue!20,titleboxcolor = black]{definition}{theorem}{mycounter}
\newboxedtheorem[boxcolor=orange, background=blue!5, titlebackground=blue!20,titleboxcolor = black]{lemma}{theorem}{mycounter}
\newboxedtheorem[boxcolor=orange, background=blue!5, titlebackground=blue!20,titleboxcolor = black]{proposition}{theorem}{mycounter}
\newboxedtheorem[boxcolor=orange, background=blue!5, titlebackground=blue!20,titleboxcolor = black]{corollary}{theorem}{mycounter}
\newboxedtheorem[boxcolor=orange, background=blue!5, titlebackground=blue!20,titleboxcolor = black]{example}{theorem}{mycounter}

\renewcommand{\themycounter}{\arabic{section}.\arabic{mycounter}}

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}


My numbering system is now messed up.

For example: Hope I am right in explaining like this: Originally, before I add in the function that will "box theorem" I have the following numbering system: Chapter I, Section 1, Theorem 1 will be identified as Theorem 1.1. If you use eqnarray then it will be listed as I.1.1. For subsection, there is no effect, the theorem number will just move on like Theorem 1.2, Theorem 1.3 and so forth but once I have new section, the cycle will restart, in other words Theorem 2.1, Theorem 2.2, etc and when using eqnarray, I will have I.2.1, I.2.2
Now in the second chapter, the theorem will be II.1.1 for Chapter 2, Section 1, Theorem 1, and so forth.

But now after I add in the "box theorem" function, my numbering messed up in other words the theorem just move on like. 1.1, 1.2, 1.3 then 2.4, 2.5, 2.6 rather than 2.1, 2.2, 2.3.

\documentclass[11pt,a4paper,twoside]{report}
\usepackage{t1enc,mathrsfs,latexsym,amsmath,amsxtra,amsthm,amssymb,makeidx,graphics}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
%\usepackage{arabtex}
%\pagestyle{plain}
\usepackage{graphicx}
\usepackage{color, fontenc, titlesec,amsfonts}


\documentclass[11pt,a4paper,twoside]{report}
\usepackage{t1enc,mathrsfs,latexsym,amsmath,amsxtra,amsthm,amssymb,makeidx,graphics}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
%\usepackage{arabtex}
%\pagestyle{plain}
\usepackage{graphicx}
\usepackage{color, fontenc, titlesec,amsfonts,boiboites}

• Welcome to TeX.SX! Can you turn those code snippets into a minimal example? – egreg Apr 16 '12 at 13:49
• Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. – Marco Daniel Apr 16 '12 at 13:52
• @sandra: A "minimal example" would be a LaTeX file that actually generates the problems or issues you're encountering. The code snippets you've posted, by themselves, aren't really sufficient to generate the problem behavior. A "minimal example", then, would include a \documentclass command, the loading of all relevant packages and the set-ups of all macros you're using for the case at hand (including a definition of the counter "mycouner"), plus a \begin{document} [some commands that generate the problems] \end{document}. – Mico Apr 16 '12 at 13:54
• What's the package that provides \newboxedtheorem? – egreg Apr 16 '12 at 14:04
• Have you tried putting \numberwithin{mycounter}{section} instead of \renewcommand{\themycounter}{\arabic{section}.\arabic{mycounter}? You have to load package amsmath or mathtools to make it work. – yo' Apr 16 '12 at 14:05

A shot in the dark

I asked Google about the comment \newboxedtheorem and found the following page:

Nice boxes for your theorems with LaTeX using tikz

There the unsupported package boiboites can be found. The code is very transparent and you can see that the command \newboxedtheorem doesn't support the manipulation of counters like \netheorem. You can set only one counter. The default usage is:

\newboxedtheorem{defi}{Definition}{thCounter}


\newboxedtheorem[]{example}{theorem}{mycounter}


because you have to many arguments.

To allow the possibility of \newtheorem you have to change the code of boiboites.sty.

As discussed in the chat the package has no license information and must be classified as non-free. So you can download the code and use but I don't know whether we can manipulate this code here.

• Hi Marco, I am a newbie in tex, so I don't know how to change the code. Can we edit style file? – Sandra Apr 16 '12 at 14:13
• @sandra: Please see my edit (last lines). You can have a look at the package tcolorbox. – Marco Daniel Apr 16 '12 at 14:22

You should put

\numberwithin{mycounter}{section}


\renewcommand{\themycounter}{\arabic{section}.\arabic{mycounter}

You have to load package amsmath or mathtools to make it work.
If you want the numbering of your theorems to go back to zero whenever you enter a new section in your document, you should use this option in the \newboxedtheorem macro:
thcounter=section
\renewcommand{\themycounter}{\arabic{section}.\arabic{mycounter}}