1

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.

  • 4
    Mmm… Do you want your students to get a stiff neck? – Bernard Nov 15 '16 at 11:31
  • 3
    The tcolorbox package would be a good place to start. It would be helpful to show us what you have tried by giving a minimal working example. It makes it easier for people to help you, since they have some code to start from, and much more likely that some one will try to help you because you've made an effort. Of course, you don't know how to solve the problem completely but, at the minimum, you can give people some mock theorem environments to work with. – Andrew Nov 15 '16 at 11:34
  • @Bernard Only colour-blind persons. ;-) – Przemysław Scherwentke Nov 15 '16 at 11:41
5

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

  • Thank you very much @Ignasi, this much very well as I need, it just remains the \section style, if you could show me how I can do it. Thank you twice. – hachemy Nov 18 '16 at 21:52
  • 1
    @hachem I'm glad to help you. About the section title, you can make a new question (better if you show some previous effort) or try to look in previous ones – Ignasi Nov 19 '16 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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