# How to create an exercise environment like this

How can we to create an exercise environment like this:

Full document is here: Exercises.pdf

• The author writes : Si vous souhaitez obtenir le fichier source en LaTeX, n'hésitez pas à me contacter! Unless you are very shy, that would be the definitive way to have a perfect answer ! Commented Jul 28, 2017 at 17:48

Here is a simple solution with framed, fancybox and thmtools :

\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage{enumitem}
\usepackage{framed}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{etoolbox}
\usepackage{fancybox}

\newenvironment{myleftbar}{%
\def\FrameCommand{\hspace{0.6em}\vrule width 2pt\hspace{0.6em}}%
{\endMakeFramed}
\declaretheoremstyle[
spaceabove=6pt,
spacebelow=6pt
bodyfont=\normalfont,
]{exobreak}

\declaretheorem[style=exobreak, name=Exercice,%
prefoothook = \endmyleftbar]{exo}

\begin{document}

\setcounter{exo}{22}
\begin{exo}[test]
\noindent On considère l’équation différentielle
$xy''-y'-x³y = 0$%
\begin{enumerate}[label=\alph*), wide=0pt \relax, font =\bfseries]
\item Montrer que si $y$ est solution sur $I$, alors $x ↦ y(-x)$ est solution sur $I'$ symétrique de $I$ par rapport à $0$.
\item Résoudre sur $\mathbf R^{ + *}$ l’équation via le changement de variable $t = x²$.
\item Déterminer les solutions sur $\mathbf R$.
\end{enumerate}
\end{exo}

\end{document}


• Thank you very much @Bernard , it 's precisely what I ask for. Commented Jul 28, 2017 at 22:02
• Yeah ! That's a great example for thmtools. Thanks, @Bernard ! Commented Jul 28, 2017 at 22:08
• @marsupilam: Thanks to you for having corrected my typos! Commented Jul 28, 2017 at 22:11

Here's a small demonstration using the tcolorbox

I started with Section 16 of the documentation (Theorems) for this example.

% arara: pdflatex
\documentclass{article}

\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\newtcbtheorem{exercise}{Exercise}%
{ % frame stuff
enhanced,frame empty,interior empty,
colframe=blue,
borderline west={1pt}{0pt}{green!25!blue},
left=0.2cm,
% title stuff
attach boxed title to top left={yshift=-2mm,xshift=-2mm},
coltitle=black,
fonttitle=\bfseries,
colbacktitle=white,
boxed title style={boxrule=.4pt,sharp corners}}{exercise}

\begin{document}

\begin{exercise}{title}{ex:mylabel}
\lipsum[1]
\end{exercise}
\end{document}


A good place to start would be to look into the tcolorbox package. You can use it to make that vertical line and the rounded box.

• Can you show us how to produce a similar output as in the question, using tcolorbox ? Otherwise, this (valuable) information would be better suited to a comment. Commented Jul 28, 2017 at 17:40