I defined a new environment which puts the frame title in the middle of the frame
\newenvironment{coloredframe}[2]{
\mdfsetup{
hidealllines=true,
leftline=true,topline=true,
frametitleaboveskip=-5pt,
linewidth=1.5pt,
frametitle={\colorbox{white}{\space#1\space}},
linecolor=#2
}
\begin{mdframed}
}{
\end{mdframed}
}
The thing is that it looks well, but sometimes it breaks pages in weird places, and if I remove the option frametitleaboveskip=-5pt
it breaks pages where is expected.
What can I do to keep the frame title position but avoid the weird page breaks?
An example of the weird page breaking:
And how it looks without the frametitleaboveskip
, good page breaks, bad location for the Diseño
frame title:
EDIT: MWE
\documentclass[letterpaper, 12pt, oneside, spanish]{tesis}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{mdframed}
\usepackage{blindtext}
\newenvironment{coloredframe}[3][]{
\mdfsetup{
hidealllines=true,
leftline=true,topline=true,
frametitleaboveskip=-5pt,
frametitle={\colorbox{white}{\space#2\space}},
linecolor=#3,
#1
}
\begin{mdframed}
}{
\end{mdframed}
}
\newenvironment{investigationfr}[1][]
{\begin{coloredframe}[#1]{Investigación}{blue}}
{\end{coloredframe}}
\begin{document}
\section{Section}
\begin{investigationfr}
\blindtext\\
\blindtext\\
\blindtext\\
\blindtext\\
\end{investigationfr}
\end{document}