I've created a new float element to define examples:
\usepackage{float}
\floatstyle{plain}
\newfloat{example}{thp}{lop}
\floatname{example}{\textsc{Example}}
I want to set my example in an frame. Usually I use the mdframed
or framed
environment to set figures in frames.
The current problem is that I can't wrap my example with the caption. I can only wrap the example.
\begin{example}
\begin{mdframed}{
My example
\caption{content of the caption}
}
\end{mdframed}
\end{example}
Is there a way to set the example and the caption in a frame like with a figure or a table ?
With a minimal example to see the difference between a figure and my example :
\documentclass[a4paper,twoside,12pt]{article}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[labelsep=endash]{caption}
\usepackage{mdframed}
\usepackage{float}
\floatstyle{plain}
\newfloat{example}{thp}{lop}
\floatname{example}{\textsc{Example}}
\begin{document}
% The figure
\begin{figure}
\begin{mdframed}{
My figure
\caption{content of the caption}
}
\end{mdframed}
\end{figure}
%The example
\begin{example}
\begin{mdframed}{
My example
\caption{content of the caption}
}
\end{mdframed}
\end{example}
\end{document}
\documentclass{...}
and ending with\end{document}
.