I have been trying to make custom theorem environments because the classical newtheorem command does not suit my needs. I have been stuck with a pagebreak problem which I explain below. Here is the code :
\documentclass[12 pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{fullpage}
\usepackage[framemethod=tikz]{mdframed}
\renewenvironment{proof}
{\par
\textit{\underline{Proof.}} \par
\nopagebreak
\vspace{12 pt}%
\begin{mdframed}[bottomline=false,topline=false,rightline=false]%
}
{%
\end{mdframed}\par
\vspace{-15 pt}%
\begin{flushright} $\square$ \end{flushright}%
}
\begin{document}
Text
\vspace{550 pt}
Text
\begin{proof}
This text goes on the next page without the title "\textit{\underline{Proof.}}", and I would want my environment title to stick with its body.
\end{proof}
\end{document}
Any idea how to tackle this problem? I spent hours on it googling and I ran out of ideas.
EDIT : I managed to get rid of that stupid in-between environment by simply using the mdframed package the way it should be used. Still got the page break with this exact code though.