[Tex/LaTex] How to do a style like this

tcolorboxtikz-styles

Can anyone help me to do a latex style for my courses like the one in the following Screenshot :
enter image description here

thank you.

Best Answer

As you probably know, tcolorbox can create all kind of coloured boxes and also includes a theorems library to support creation of coloured environments for theorems, definitions, ...

The main command for these kind of boxes is:

\newtcbtheorem[init options]{env-name}{displayed name}{format options}{reference prefix}

which is explained in section 16.1 from tcolorbox documentation. This command creates an environment env-name with two mandatory parameters, a theorem title and a label which will be preceded by the reference prefix to create a label associated with this particular box.

Following code shows how to use three \newtcbtheorem commands for the definition of theorems, definitions and corollaries with the desired style. All boxes will break on page boundaries, but only the first fragment will be labelled. If box contents height is shorter than rotated title height, undesired effects will appear as you can see in first example.

(Side note: if following code shows an error related to tcolorbox options, please update tcolorbox package`)

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\tcbset{%
    theo/.style={%
        enhanced,
        breakable,
        sharp corners,
        toprule=0pt, rightrule=0pt, bottomrule=0pt, leftrule=1mm,
        colback=#1!5, colframe=#1!80!black, coltitle=#1!80!black, 
        detach title,
        overlay unbroken and first ={
            \node[rotate=90, minimum width=1cm, anchor=south, font=\bfseries] 
               at (frame.west) {\tcbtitle};
        }
    }
}

\newtcbtheorem[auto counter]{mytheo}{Théorème}
{theo=green}{th}

\newtcbtheorem[auto counter]{mydef}{Définition}
{theo=blue}{df}

\newtcbtheorem[auto counter]{mycoro}{Corollaire}
{theo=green}{cl}

\begin{document}

\begin{mytheo}{}{}
\lipsum[1]
\end{mytheo}

\begin{mydef}{}{}
\lipsum[2]
\end{mydef}

\begin{mycoro}{}{}
\lipsum[3]
\end{mycoro}

\end{document}

enter image description here

Related Question