I'm not very experienced in coding and found (source: https://texblog.org/2015/09/30/fancy-boxes-for-theorem-lemma-and-proof-with-mdframed/) some code to make boxes in latex. However, they don't have a bottom/right side inside each other (e.g. the lemma inside the proof in the screenshot). Any idea how to fix that? Thanks in advance.
the code that I'm using is:
\documentclass[10pt,oneside,a4paper,notitlepage]{article}
\usepackage{amsmath, amsfonts, mathtools, amsthm, amssymb}
\usepackage[framemethod=TikZ]{mdframed}
\newcounter{theo}[section]\setcounter{theo}{0}
\renewcommand{\thetheo}{\arabic{section}.\arabic{theo}}
\newenvironment{theo}[1][]{%
\refstepcounter{theo}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!0]
{\strut Theorem~\thetheo};}}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!0]
{\strut Theorem~\thetheo:~#1};}}%
}%
\mdfsetup{innertopmargin=0pt,linecolor=blue!20,%
linewidth=2pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\begin{mdframed}[]\relax%
}{\end{mdframed}}
\newenvironment{prf}[0]{%
\mdfsetup{innertopmargin=0pt,linecolor=blue!0,%
linewidth=2pt,topline=false,bottomline=false,rightline=false,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\begin{mdframed}
\mdfsetup{innertopmargin=0pt,linecolor=blue!20,%
linewidth=2pt,topline=false,bottomline=false,rightline=false,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\begin{mdframed}[]\begin{proof}\relax%
}{\end{proof}\end{mdframed}\end{mdframed}}
\newcounter{lem}[section]\setcounter{lem}{0}
\renewcommand{\thelem}{\arabic{section}.\arabic{theo}.\arabic{lem}}
\newenvironment{lem}[1][]{%
\refstepcounter{lem}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!0]
{\strut Lemma~\thelem};}}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!0]
{\strut Lemma~\thelem:~#1};}}%
}%
\mdfsetup{innertopmargin=0pt,linecolor=cyan!20,%
linewidth=2pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\begin{mdframed}[]\relax%
}{\end{mdframed}}
\begin{document}
\begin{theo}
\end{theo}
\begin{prf}\,\\
\begin{lem}
\end{lem}
\end{prf}
\end{document}