2

How can we to create an exercise environment like this:

enter image description here Full document is here: Exercises.pdf

1
  • 3
    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 !
    – marsupilam
    Jul 28, 2017 at 17:48

3 Answers 3

7

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}}%
\MakeFramed{\advance\hsize-\width \FrameRestore}}%
{\endMakeFramed}
\declaretheoremstyle[
spaceabove=6pt,
spacebelow=6pt
headfont=\normalfont\bfseries,
headpunct={} ,
headformat={\cornersize*{2pt}\ovalbox{\NAME~\NUMBER\ifstrequal{\NOTE}{}{\relax}{\NOTE}:}},
bodyfont=\normalfont,
]{exobreak}

\declaretheorem[style=exobreak, name=Exercice,%
postheadhook=\leavevmode\myleftbar, %
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} 

enter image description here

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

Here's a small demonstration using the tcolorbox

enter image description here

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}
1

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.

1
  • 4
    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.
    – marsupilam
    Jul 28, 2017 at 17:40

You must log in to answer this question.

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