1

I basically want to obtain the result (replace Proof -> Solution, and mdframed around the environemnt) simply by the code:

\begin{solution}
    Set Theory Best Theory.
    \begin{align*}
        2 = \{\emptyset,\{\emptyset\},\{\emptyset,\{\emptyset\}\}\}
    \end{align*}
\end{solution}

![enter image description here

This can be easily done using \renewenvironment. My main issue lies in preserving the optional argument in the proof environment, i.e. something like this would still work:

\begin{solution}[Proof]
    Set Theory Best Theory.
    \begin{align*}
        2 = \{\emptyset,\{\emptyset\},\{\emptyset,\{\emptyset\}\}\}
    \end{align*}
\end{solution}

enter image description here

Any help is greatly appreciated.

EDIT: To clarify, I do not have a working solution environment working. The first image above can be made possible by:

\newenvironment{solution}
  {\begin{mdframed}\begin{proof}[Solution]}
  {\end{proof}\end{mdframed}}

But it will not accept any arguments (so the second image will not be obtained)

2
  • 1
    Can you please add the definition you have of solution?
    – egreg
    Mar 17, 2021 at 8:58
  • @egreg please see my edit. Mar 17, 2021 at 10:44

1 Answer 1

1

Well, the answer is easy:

\newenvironment{solution}[1][Solution]
  {\begin{mdframed}\begin{proof}[#1]}
  {\end{proof}\end{mdframed}}

If you call \begin{solution}, you'll get “Solution” as the label; with \begin{Solution}[Hint] you'll get “Hint” as the label.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .