# Get thmtools style with mdframed (issues with the title and MWE provided)

I am trying to achieve the following output with mdframed, but I can't. I did the proof in the attached picture below with thmtools, but I am abandoning it because some of my proofs are very long and I want them to be split between pages to avoid getting to large white spaces at the end of some pages (something that apparently thmtools cannot handle easily). What I can get is this: But the output I am trying to replicate should look as follows: As you can see, what I need is:

(a) The title in the same line as the text.

(b) The word "Proof" before the name of the theorem being proven.

(c) A long horizontal dash between Proof and the title of the theorem being proven.

(d) A colon after the title of the theorem being proven.

Does it make sense? Here you can find a MWE that replicates what I get (except the font and the color of the math; because those are irrelevant to my question and would only make a code more complex without need).

\documentclass[a4paper]{report}
\pagestyle{plain}

\usepackage[dvipsnames]{xcolor}
\usepackage{amsmath, mathtools, amsthm, mathrsfs, amssymb}
\usepackage{mdframed}
\let\proof\relax
\let\endproof\relax
\newmdenv[linecolor=Gray,frametitle=Proof]{proof}

\begin{document}
\begin{proof}[frametitle={\textbf{von-Neumann--Morgenstern Expected Utility Theorem I}}]
Let's prove that if there exists $U: \mathcal{L}(X) \longrightarrow \mathbb{R}$, a preference $\succsim$ on $\mathcal{L}(X)$ satisfies X and Y. Assume there exists a utility function $U: \mathcal{L}(X) \longrightarrow \mathbb{R}$ representing $\succsim$ such that $U$ satisfies the expected utility property.
\begin{enumerate}
\item To show that $\succsim$ \textbf{is continuous}, let $x,y,z \in \mathcal{L}(X)$ such that $x \succ y \succ z$. Since $U$ represents $\succsim$, $U(x) > U(y) > U(z)$. The set of real numbers is convex; and hence there exists $p \in (0,1)$ such that $p \cdot U(x) + (1-p) \cdot U(z) = U(y)$. By the expected utility property, $U(p \odot x \oplus (1-p) \odot z) = p \cdot U(x) + (1-p) \cdot U(z) = U(y)$. Since $U$ represents $\succsim$, $p \odot x \oplus (1-p) \odot z \sim y$. Now, let $q,r \in [0,1]$ be such that $q >p>r$. Then:
\begin{flalign*}
&& q \cdot U(x) + (1-q) \cdot U(z) & > p \cdot U(x) + (1-p) \cdot U(z)\\
&& &> r \cdot U(x) + (1-r)\cdot U(z)
\end{flalign*}

And by the expected utility property, and the hypothesis that $U$ represents $\succsim$, it follows that $q \odot x \oplus (1-q) \odot z \succ y \succ r \odot x \oplus (1-r) \odot z$.
\item To show that $\succsim$ \textbf{satisfies independence}, let $x,y,z \in \mathcal{L}(X)$ and let $p \in [0,1]$. Since $U$ represents $\succsim$, $x \succ y \Longleftrightarrow U(x) > U(y)$. Hence, $x \succ y \Longleftrightarrow p \cdot U(x) + (1-p) \cdot U(z) > p \cdot U(y) + (1-p) \cdot U(z)$. Since $U$ satisfies the expected utility property, $x \succ y \Longleftrightarrow [p \odot x \oplus (1-p) \odot z] \succ [p \odot y \oplus (1-p) \odot z]$. Since $U$ represents $\succsim$, $x \sim y \Longleftrightarrow U(X) = U(y)$. Hence, $x \sim y \Longleftrightarrow p \cdot U(x) + (1-p) \cdot U(z) = p \cdot U(y) + (1-p) \cdot U(z)$. Since $U$ satisfies the expected utility property, $x \sim y \Longleftrightarrow [p \odot x \oplus (1-p) \odot z] \sim [p \odot y \oplus (1-p) \odot z]$.
\end{enumerate}
\end{proof}

\end{document}


• Can you make a compilable MWE? \begin{document} is in the wrong place and after moving it I get Environment proof undefined. \begin{proof} – samcarter is at topanswers.xyz Feb 14 '17 at 17:27
• I am really sorry for the mistake. It is fixed now and the MWE should compile just fine. – Héctor Feb 14 '17 at 17:31

With a bit of help from https://tex.stackexchange.com/a/185168/36296:

\documentclass[a4paper]{report}

\usepackage{amsmath, amssymb, amsthm}
\usepackage{mdframed}

\newtheoremstyle{mystyle}%                % Name
{0pt}%                                     % Space above
{}%                                     % Space below
{\itshape}%                             % Body font
{}%                                     % Indent amount
{:}%                                    % Punctuation after theorem head
{ }%                                    % Space after theorem head, ' ', or \newline
{\thmname{#1} -- \thmnote{#3}}%       % Theorem head spec (can be left empty, meaning normal')
\theoremstyle{mystyle}

\let\proof\relax
\let\endproof\relax

\newmdtheoremenv[innerleftmargin=0.1cm,innerrightmargin=0.1cm,innertopmargin=0.1cm,innerbottommargin=0.1cm]{proof}{Proof}

\AtEndEnvironment{proof}{\hfill$\square$}%

\begin{document}
\begin{proof}[von-Neumann--Morgenstern Expected Utility Theorem I]
Let's prove that if there exists $U: \mathcal{L}(X) \longrightarrow \mathbb{R}$, a preference $\succsim$ on $\mathcal{L}(X)$ satisfies X and Y. Assume there exists a utility function $U: \mathcal{L}(X) \longrightarrow \mathbb{R}$ representing $\succsim$ such that $U$ satisfies the expected utility property.
\begin{enumerate}
\item To show that $\succsim$ \textbf{is continuous}, let $x,y,z \in \mathcal{L}(X)$ such that $x \succ y \succ z$. Since $U$ represents $\succsim$, $U(x) > U(y) > U(z)$. The set of real numbers is convex; and hence there exists $p \in (0,1)$ such that $p \cdot U(x) + (1-p) \cdot U(z) = U(y)$. By the expected utility property, $U(p \odot x \oplus (1-p) \odot z) = p \cdot U(x) + (1-p) \cdot U(z) = U(y)$. Since $U$ represents $\succsim$, $p \odot x \oplus (1-p) \odot z \sim y$. Now, let $q,r \in [0,1]$ be such that $q >p>r$. Then:
\begin{flalign*}
&& q \cdot U(x) + (1-q) \cdot U(z) & > p \cdot U(x) + (1-p) \cdot U(z)\\
&& &> r \cdot U(x) + (1-r)\cdot U(z)
\end{flalign*}

And by the expected utility property, and the hypothesis that $U$ represents $\succsim$, it follows that $q \odot x \oplus (1-q) \odot z \succ y \succ r \odot x \oplus (1-r) \odot z$.
\item To show that $\succsim$ \textbf{satisfies independence}, let $x,y,z \in \mathcal{L}(X)$ and let $p \in [0,1]$. Since $U$ represents $\succsim$, $x \succ y \Longleftrightarrow U(x) > U(y)$. Hence, $x \succ y \Longleftrightarrow p \cdot U(x) + (1-p) \cdot U(z) > p \cdot U(y) + (1-p) \cdot U(z)$. Since $U$ satisfies the expected utility property, $x \succ y \Longleftrightarrow [p \odot x \oplus (1-p) \odot z] \succ [p \odot y \oplus (1-p) \odot z]$. Since $U$ represents $\succsim$, $x \sim y \Longleftrightarrow U(X) = U(y)$. Hence, $x \sim y \Longleftrightarrow p \cdot U(x) + (1-p) \cdot U(z) = p \cdot U(y) + (1-p) \cdot U(z)$. Since $U$ satisfies the expected utility property, $x \sim y \Longleftrightarrow [p \odot x \oplus (1-p) \odot z] \sim [p \odot y \oplus (1-p) \odot z]$.
\end{enumerate}
\end{proof}

\end{document} • I will mark it as accepted because your code does exactly what I asked for, but notice that your code increases the space surrounding the text inside the frame, which is something I'd like to avoid. Also, I forgot to mention that the QED symbol should be automatically added in the environment. But this is my fault because I forgot to mention it in the original question. – Héctor Feb 14 '17 at 18:20
• @Héctor Please see my edit for adjusted margins. – samcarter is at topanswers.xyz Feb 14 '17 at 18:26
• @Héctor and the qed – samcarter is at topanswers.xyz Feb 14 '17 at 18:30
• The qed symbol should not be on a separate line. – Bernard Feb 14 '17 at 21:20

I propose a solution with the simpler framed environment option of ntheorem. One advantage is the automatic (and correct) placement of the qed symbol, even when the proof ends in a displayed equation. It is activated by the thmmarks option.

I redefined the nonumberplain predefined style under the name myproof so as to incorporate the emdash between the name of the environment and the optional argument, in the place of the pair of parentheses.

Also I obtain a better layout of the enumerate environment inside the frame with enumitem.

\documentclass[a4paper]{report}
\pagestyle{plain}
\usepackage{geometry}%
\usepackage[dvipsnames]{xcolor}
\usepackage{amsmath, mathtools, mathrsfs, amssymb}
\usepackage{framed, enumitem} %
\usepackage[framed, thref, amsmath, thmmarks]{ntheorem} %
\makeatletter
\newtheoremstyle{myproof}%
\makeatother
\theorembodyfont{\mdseries}
\theoremseparator{:}
\theoremsymbol{\ensuremath{\square}}
\theoremstyle{myproof}
\newframedtheorem{proof}{Proof}

\begin{document}

\begin{proof}[von\,Neumann-Morgenstern Expected Utility Theorem I]
Let's prove that if there exists $U: \mathcal{L}(X) \longrightarrow \mathbb{R}$, a preference $\succsim$ on $\mathcal{L}(X)$ satisfies X and Y. Assume there exists a utility function $U: \mathcal{L}(X) \longrightarrow \mathbb{R}$ representing $\succsim$ such that $U$ satisfies the expected utility property.
\begin{enumerate}[wide=0pt, leftmargin=*]
\item To show that $\succsim$ \textbf{is continuous}, let $x,y,z \in \mathcal{L}(X)$ such that $x \succ y \succ z$. Since $U$ represents $\succsim$, $U(x) > U(y) > U(z)$. The set of real numbers is convex; and hence there exists $p \in (0,1)$ such that $p \cdot U(x) + (1-p) \cdot U(z) = U(y)$. By the expected utility property, $U(p \odot x \oplus (1-p) \odot z) = p \cdot U(x) + (1-p) \cdot U(z) = U(y)$. Since $U$ represents $\succsim$, $p \odot x \oplus (1-p) \odot z \sim y$. Now, let $q,r \in [0,1]$ be such that $q >p>r$. Then:
\begin{flalign*}
&& q \cdot U(x) + (1-q) \cdot U(z) & > p \cdot U(x) + (1-p) \cdot U(z)\\
&& &> r \cdot U(x) + (1-r)\cdot U(z)
\end{flalign*}

And by the expected utility property, and the hypothesis that $U$ represents $\succsim$, it follows that $q \odot x \oplus (1-q) \odot z \succ y \succ r \odot x \oplus (1-r) \odot z$.
\item To show that $\succsim$ \textbf{satisfies independence}, let $x,y,z \in \mathcal{L}(X)$ and let $p \in [0,1]$. Since $U$ represents $\succsim$, $x \succ y \Longleftrightarrow U(x) > U(y)$. Hence, $x \succ y \Longleftrightarrow p \cdot U(x) + (1-p) \cdot U(z) > p \cdot U(y) + (1-p) \cdot U(z)$. Since $U$ satisfies the expected utility property, $x \succ y \Longleftrightarrow [p \odot x \oplus (1-p) \odot z] \succ [p \odot y \oplus (1-p) \odot z]$. Since $U$ represents $\succsim$, $x \sim y \Longleftrightarrow U(X) = U(y)$. Hence, $x \sim y \Longleftrightarrow p \cdot U(x) + (1-p) \cdot U(z) = p \cdot U(y) + (1-p) \cdot U(z)$. Since $U$ satisfies the expected utility property, $x \sim y \Longleftrightarrow [p \odot x \oplus (1-p) \odot z] \sim [p \odot y \oplus (1-p) \odot z]$.
\end{enumerate} %
\end{proof}

\end{document} • I really like your answer, thank you very much. I am about to ask a related question on how to get the numbering I was getting with thmtools´ but with mdframed´, instead. That is, CHAPTER.SECTION.ALPH for Definitions and CHAPTER.SECTION.ROMAN for Propositions, while keeping PROOFS unnumbered. I haven't been able to do so yet, but maybe I succeed with your code. – Héctor Feb 14 '17 at 22:33
• I'll try to see that. Do you mean uppercase Roman and Alph? – Bernard Feb 14 '17 at 23:28
• I mean exactly that. You can indeed see the question here, in case you want: tex.stackexchange.com/questions/353923/… (it just got an answer). – Héctor Feb 14 '17 at 23:29
• @Héctor: I've posted a solution to your new question using ntheorem`. – Bernard Feb 15 '17 at 13:39