I'm trying without sucess to make an environment like this:
What I have know is this:
The perfect answer to this question would be a way to have the title in colors and text out of the mdframed environment. The reason of this is because if you have to many text (or larges equations), mdframed goes crazy with "overfull \vbox". Part of my code is this:
\documentclass[a4paper, 12pt]{article}
\usepackage[framemethod=TikZ]{mdframed}
\newcounter{solution}[section]
\renewcommand{\thesolution}{\arabic{section}.\arabic{solution}}
\newenvironment{solution}[1][]{%
\refstepcounter{solution}
% Always:
\mdfsetup{leftmargin = 0.25cm, rightmargin = 0cm,
innertopmargin = 0.25cm, linecolor = gray!50,
linewidth = 2pt, topline = true,
frametitleaboveskip = \dimexpr-\ht\strutbox\relax}
% 'if' condition (without title)
\ifstrempty{#1}%
{\mdfsetup{frametitle = {%
\tikz[baseline = (current bounding box.east),
outer sep = 0pt]
\node[anchor = east, rectangle, fill = gray!50]
{\strut Soluci\'on};}}
}
% 'else' condition (with title)
{\mdfsetup{frametitle = {%
\tikz[baseline = (current bounding box.east),
outer sep = 0pt]
\node[anchor = east, rectangle, fill= gray!50]
{\strut Soluci\'on: #1};}}
}
\begin{mdframed}[]\relax}{%
\end{mdframed}}
By the way, what I mean with "goes crazy" is this:
Thanks for read!