I would like to create the following box and title without using minipage With :

  • small box before Title
  • Title with counter

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsthm,fancybox}
\usepackage{enumitem}
\newtheorem{test}{Test}
\usepackage[margin=1cm]{geometry}
\begin{document}

Comment rechercher l'ordre d'un élément d'un groupe 

\shadowbox{
\begin{minipage}[c]{7in}
\subsubsection{Méthode1.3}-Soit G un groupe, noté multiplicativement, et soit $a\in G$. Pour déterminer l'ordre de l'élément $a$, on peut:
\begin{itemize}
\item Calculer les puissances successives de l'élément $a$ jusqu'à l'obtention de l'élément neutre.
\item Trouver une propriété qui montre qu'aucune puissance de $a$  ne peut être le neutre.
\end{itemize}
\end{minipage}
}
\end{document}

Here is another attempt :

    \documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\usetikzlibrary{shadows}
\usepackage{pifont}
\newcounter{exa}

\tcbset{
myexample/.style={
  enhanced,
  colback=white,
  colframe=black,
  fonttitle=\bfseries,
    breakable,
  drop shadow={black,opacity=1},
  sharp corners,
  titlerule=0pt,
  title={\refstepcounter{exa}\ding{111} Methode~\theexa.},
  title style={fill=white},
  coltitle=black,
  drop shadow,
  highlight math style={reset,colback=white,colframe=black}
  }
}

\newtcolorbox{EducBox}{myexample}

\begin{document}

\begin{EducBox}
\centering
Soit G un groupe, noté multiplicativement, et soit $a\in G$. Pour déterminer l'ordre de l'élément $a$, on peut:
\begin{itemize}
\item Calculer les puissances successives de l'élément $a$ jusqu'à l'obtention de l'élément neutre.
\item Trouver une propriété qui montre qu'aucune puissance de $a$  ne peut être le neutre.
\end{itemize}
\end{EducBox}

\end{document}

which produces :

enter image description here

up vote 8 down vote accepted

With tcolorbox and its tcbtheorems is not too difficult.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[margin=1cm]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}
\usepackage{bbding}

\tcbset{
    methstyle/.style={
        enhanced,
        theorem style=plain,
        sharp corners,
        colframe=black,
        colback=white,
        coltitle=black,
        fonttitle=\bfseries\upshape,
        drop shadow={black,opacity=1},
        separator sign dash,
        before title=\SquareShadowBottomRight\ ,
    }
}

\newtcbtheorem[number within=section]{Methode}{Méthode}{methstyle}{Met}


\begin{document}

Comment rechercher l'ordre d'un élément d'un groupe 

\section{Methodes}

\begin{Methode}{A new méthode}{anm}
Soit $G$ un groupe, noté multiplicativement, et soit $a\in G$. Pour déterminer l'ordre de l'élément $a$, on peut:
\begin{itemize}
\item Calculer les puissances successives de l'élément $a$ jusqu'à l'obtention de l'élément neutre.
\item Trouver une propriété qui montre qu'aucune puissance de $a$  ne peut être le neutre.
\end{itemize}
\end{Methode}

\end{document}

enter image description here

  • 1
    Just to forward the comment @BambOo has made on my tcolorbox post: "You can also add opacity=1 to the drop shadow option to get a bit closer to the OP's demand :)". But great answer, +1. – TeXnician Aug 10 at 10:03
  • Yes, I agree with @TeXnician for opacity thing. +1 very nice work Thank you – Educ Aug 10 at 10:07
  • @TeXnician Done. Thank you for pointing it. – Ignasi Aug 10 at 10:19
  • could you replace the \quare with a square with shadows like the picture That I post I try '\shadowbox' but with no luck I used pifont pakcage too but with no sucess – Educ Aug 10 at 10:21
  • 1
    @Edut I've found something similar in bbding. If you don't like, try to find something else in The Comprehensive LaTeX Symbol List list – Ignasi Aug 10 at 10:41

Here's a starter with tcolorbox. I do not have your section and subsection styles, so this is with default styles. Please note that the tcolorbox manual is no quick read, it requires some patience.

In the code example the box is drawn with optional arguments, but feel free to use \newtcolorbox instead if your original aim was to shorten the code.

box

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[most]{tcolorbox}

\begin{document}
\begin{tcolorbox}[enhanced, sharp corners, colback=white, colframe=black, drop shadow={black,opacity=1}]
\subsubsection{Méthode1.3}
Soit G un groupe, noté multiplicativement, et soit $a\in G$. Pour déterminer l'ordre de l'élément $a$, on peut:
\begin{itemize}
\item Calculer les puissances successives de l'élément $a$ jusqu'à l'obtention de l'élément neutre.
\item Trouver une propriété qui montre qu'aucune puissance de $a$  ne peut être le neutre.
\end{itemize}
\end{tcolorbox}
\end{document}
  • Thank you but where is small box before title 'Methode' – Educ Aug 10 at 8:55
  • Where is also counter ? – Educ Aug 10 at 8:55
  • @Texnician, you can also add opacity=1 to the drop shadow option to get a bit closer to the OP's demand :) – BambOo Aug 10 at 9:00
  • @Educ You do not provide your sectioning style (you're using a styled subsubsection for the picture as it seems), so I don't attempt to replicate it. As you are using a different setup to create the picture in your question than your MWE produces, I only try to give you a starter on the box you've asked for. – TeXnician Aug 10 at 9:00
  • @BambOo Thanks, totally forgot that. – TeXnician Aug 10 at 9:01

Quick and dirty implementation of your box without any packages:

\documentclass[]{article}

\usepackage{duckuments}

\newsavebox\customboxbox
\newlength\customboxOuterWidth
\newlength\customboxOuterHeight
\newlength\customboxOuterDepth
\newlength\customboxInnerWidth
\newlength\customboxRuleWidth
\newlength\customboxShadowHeight
\newlength\customboxShadowDepth
\newlength\customboxShadowWidth
\newlength\customboxInnerSep

\customboxInnerSep3\fboxsep
\customboxRuleWidth.6pt
\customboxShadowWidth4pt

\newenvironment{custombox}[1][\linewidth]
  {%
    \noindent
    \customboxOuterWidth#1
    \advance\customboxOuterWidth-\customboxShadowWidth
    \customboxInnerWidth#1
    \advance\customboxInnerWidth-2\customboxRuleWidth
    \advance\customboxInnerWidth-2\customboxInnerSep
    \advance\customboxInnerWidth-\customboxShadowWidth
    \setbox\customboxbox\vbox\bgroup
      \hsize\customboxInnerWidth
      \linewidth\hsize
      \noindent
      \ignorespaces
  }
  {%
      \ifhmode\unskip\fi
    \egroup
    \customboxOuterHeight\ht\customboxbox
    \advance\customboxOuterHeight\customboxInnerSep
    \customboxOuterDepth\dp\customboxbox
    \advance\customboxOuterDepth\customboxInnerSep
    \customboxShadowHeight\customboxOuterHeight
    \advance\customboxShadowHeight-\customboxShadowWidth
    \customboxShadowDepth\customboxOuterDepth
    \advance\customboxShadowDepth\customboxShadowWidth
    \raisebox{\customboxOuterHeight}
      {\rlap{\vrule height \customboxRuleWidth width \customboxOuterWidth}}%
    \vrule height \customboxOuterHeight
           depth \customboxOuterDepth
           width \customboxRuleWidth
    \rlap
      {%
        \hskip\customboxInnerSep\usebox\customboxbox
        \hskip\customboxInnerSep
        \vrule height \customboxOuterHeight
               depth \customboxOuterDepth
               width \customboxRuleWidth
        \vrule height \customboxShadowHeight
               depth \customboxShadowDepth
               width \customboxShadowWidth
      }%
    \raisebox{-\customboxOuterDepth}
      {%
        \rlap
          {%
            \vrule height \customboxRuleWidth
                   depth 0pt
                   width \customboxOuterWidth
          }%
        \hskip\customboxShadowWidth
        \advance\customboxOuterWidth-\customboxRuleWidth
        \vrule height \customboxRuleWidth
               depth \customboxShadowWidth
               width \customboxOuterWidth
      }%
  }


\begin{document}
\begin{custombox}
  \blindduck
\end{custombox}
\end{document}

enter image description here

The environment takes an optional argument which specifies the used total width. Content width is calculated based on total width, \customboxInnerSep, \customboxRuleWidth and \customboxShadowWidth.

It doesn't add any outer spacing.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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