0

I would like to have something that looks like this: enter image description here

I don't want to add Box 1 to the definition environment each time. And this also goes for properties, lemmas, and theorems of the environment

\documentclass[12pt,a4paper]{report}
\usepackage[french]{babel} 
\usepackage[a4paper,margin=0.5in]{geometry}
\usepackage{amsmath, amssymb, amsthm, amsfonts}
\usepackage[Glenn]{fncychap}
\frenchbsetup{StandardLists=true}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheoremstyle{defn-break}%
{\topsep}{\topsep}
{\normalfont\itshape}{0pt}
{\bfseries}{}
{\newline}{}
% Switch to the newly-defined theorem style
\theoremstyle{defn-break} 
% Define 'definition' as an unnumbered theorem-like environment:
\newtheorem*{definition}{\textbf{Définition}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheorem*{Theorem}{Théorème}
\newtheorem*{propriete}{\textbf{Propriété}}
\newtheorem*{exemples}{\textbf{Exemples}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Box1
\usepackage{tcolorbox}
\tcbuselibrary{theorems, breakable, skins}
\newtcolorbox{Box1}[1][0]
{enhanced, % tcolorbox styles
    attach boxed title to top center={yshift=-2.5mm},
    colback=white, colframe=black, colbacktitle=white, coltitle=black,
    boxed title style={size=small,colframe=white},
    fonttitle=\bfseries,
    sharp corners=all,
    title={#1},
    breakable
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Box1
\usepackage{tcolorbox}
\tcbuselibrary{theorems, breakable, skins}
\newtcolorbox{Box2}[1][0]
{enhanced, % tcolorbox styles
    attach boxed title to top center={yshift=-2.5mm},
    colback=white, colframe=black, colbacktitle=white, coltitle=black,
    boxed title style={size=small,colframe=white},
    fonttitle=\bfseries,
    rounded corners=all,
    title={#1},
    breakable
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{}
\section{Nombres Pairs et Nombres Impaires}

\begin{Box1}[]
    \begin{definition}[Nombres Pairs et Nombres Impaires]
        Tout nombre entier naturel \textit{multiple de} $2$ (\textit{divisible par} $2$) est appelé nombre \textbf{pair}
        \begin{itemize}
            \item $a$ est un nombre \textbf{pair} signifie que: 
            $a=2k$ où $k$ est un nombre entier naturel.
            \item $a$ est un nombre \textbf{impair} signifie que: 
            $a=2k+1$ où $k$ est un nombre entier naturel, ou    $a=2k^{'}-1$ où $k^{'}$ est un nombre entier naturel.
        \end{itemize}
    \end{definition}
\end{Box1}
\section{}
\begin{Box2}[]
    \begin{Theorem}[Nombres Pairs et Nombres Impaires]
        Tout nombre entier naturel \textit{multiple de} $2$ (\textit{divisible par} $2$) est appelé nombre \textbf{pair}
        \begin{itemize}
            \item $a$ est un nombre \textbf{pair} signifie que: 
            $a=2k$ où $k$ est un nombre entier naturel.
            \item $a$ est un nombre \textbf{impair} signifie que: 
            $a=2k+1$ où $k$ est un nombre entier naturel, ou    $a=2k^{'}-1$ où $k^{'}$ est un nombre entier naturel.
        \end{itemize}
    \end{Theorem}
\end{Box2}
\end{document}
1
  • For this case a minipage with a \fbox with an adjusted separation and thickness, like here, seems more than enough. No need to load the heavy tikz machinery.
    – Fran
    Sep 5, 2022 at 4:40

1 Answer 1

0

The tcolorbox has a theorems library that you're already loading. (See chapter 18 of its documentation for details.) The most natural thing, I think, would be to use its \newtcbtheorem command isntead of using amsthm's theorem definition commands.

Here's an example for Theorem that gives you results similar to what you were getting (The starred version Theorem* is used for unnumbered theorems.)

\documentclass[12pt,a4paper]{report}
\usepackage[french]{babel} 
\usepackage[a4paper,margin=0.5in]{geometry}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage[Glenn]{fncychap}
% more compact lists
\usepackage{enumitem}\setitemize{nolistsep}
\frenchbsetup{StandardLists=true}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tcolorbox}
\tcbuselibrary{theorems, breakable, skins}
\newtcbtheorem{Theorem}{Théoréme}%
    {
    enhanced, % tcolorbox styles
        %attach boxed title to top center={yshift=-2.5mm},
        colback=white, colframe=black, colbacktitle=white, coltitle=black,
        boxed title style={size=small,colframe=white},
        fonttitle=\bfseries,
        rounded corners=all,
        toptitle=1ex, top=0.5ex, % a little extra space at top, a little less before content
        titlerule=-1ex, % get rid of separator rule
        title={#1},
        fontupper=\itshape, % make theorem content italics
        description delimiters parenthesis, % parentheses around theorem title
        description font=\normalfont,% no bold for theorem title
        separator sign none,% no punctuation after theorem name
        breakable
    }{th}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{}
\section{Nombres Pairs et Nombres Impaires}
\begin{Theorem*}{Nombres Pairs et Nombres Impaires}
    Tout nombre entier naturel \textit{multiple de} $2$ (\textit{divisible par} $2$) est appelé nombre \textbf{pair}
    \begin{itemize}
        \item $a$ est un nombre \textbf{pair} signifie que: 
        $a=2k$ où $k$ est un nombre entier naturel.
        \item $a$ est un nombre \textbf{impair} signifie que: 
        $a=2k+1$ où $k$ est un nombre entier naturel, ou    $a=2k^{'}-1$ où $k^{'}$ est un nombre entier naturel.
    \end{itemize}
\end{Theorem*}
\end{document}

newtcbtheorem example

I'll let you figure out how to do the same for definitions, lemmas, properties, etc.

But if for some reason you were wedded to using amsthm and your current definitions, you could define the Theorem environment as a new environment as a wrapper around Box2 and an innerTheorem environment this:

\documentclass[12pt,a4paper]{report}
\usepackage[french]{babel} 
\usepackage[a4paper,margin=0.5in]{geometry}
\usepackage{amsmath, amssymb, amsthm, amsfonts}
\usepackage[Glenn]{fncychap}
% more compact lists
\usepackage{enumitem}\setitemize{nolistsep}
\frenchbsetup{StandardLists=true}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheoremstyle{defn-break}%
{\topsep}{\topsep}
{\normalfont\itshape}{0pt}
{\bfseries}{}
{\newline}{}
% Switch to the newly-defined theorem style
\theoremstyle{defn-break} 
% Define 'definition' as an unnumbered theorem-like environment:
\newtheorem*{definition}{\textbf{Définition}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheorem*{innerTheorem}{Théorème}
\newtheorem*{propriete}{\textbf{Propriété}}
\newtheorem*{exemples}{\textbf{Exemples}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tcolorbox}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Box2
\tcbuselibrary{theorems, breakable, skins}
\newtcolorbox{Box2}[1][0]
{enhanced, % tcolorbox styles
    attach boxed title to top center={yshift=-2.5mm},
    colback=white, colframe=black, colbacktitle=white, coltitle=black,
    boxed title style={size=small,colframe=white},
    fonttitle=\bfseries,
    rounded corners=all,
    title={#1},
    breakable
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NewDocumentEnvironment{Theorem}{o}{
    \begin{Box2}[]
    \begin{innerTheorem}[#1]

}{
    \end{innerTheorem}
    \end{Box2}
}

\begin{document}
\chapter{}
\section{Nombres Pairs et Nombres Impaires}

\begin{Theorem}[Nombres Pairs et Nombres Impaires]
    Tout nombre entier naturel \textit{multiple de} $2$ (\textit{divisible par} $2$) est appelé nombre \textbf{pair}
    \begin{itemize}
        \item $a$ est un nombre \textbf{pair} signifie que: 
        $a=2k$ où $k$ est un nombre entier naturel.
        \item $a$ est un nombre \textbf{impair} signifie que: 
        $a=2k+1$ où $k$ est un nombre entier naturel, ou    $a=2k^{'}-1$ où $k^{'}$ est un nombre entier naturel.
    \end{itemize}
\end{Theorem}
\end{document}

innerTheorem example

Again I'll let you figure out how to do the same for definitions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .