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? Commented Mar 17, 2021 at 8:58
  • @egreg please see my edit. Commented 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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.