environment - solution environment for exercises (different than proof environment)

Gonzalo's answer can be easily modified to do this. Just add \renewcommand\qedsymbol{$\blacksquare$} to the definition

\documentclass{article}
\usepackage{amsthm,amssymb}

\newenvironment{solution}
  {\renewcommand\qedsymbol{$\blacksquare$}\begin{proof}[Solution]}
  {\end{proof}}

\begin{document}

\begin{proof}
test.
\end{proof}

\begin{solution}
test.
\end{solution}

\begin{proof}
test.
\end{proof}

\end{document}

enter image description here


You also can do that very simply with ntheorem. Its advantage is an automatic placement of endmarks even if the environment ends in a display math environment:

\documentclass[leqno]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{heuristica}

 \usepackage{amsmath}
\usepackage[thmmarks, amsmath, thref]{ntheorem}

\theoremstyle{nonumberplain}
\theoremheaderfont{\itshape}
\theorembodyfont{\upshape}
\theoremseparator{.}
\theoremsymbol{\ensuremath{\square}}
\newtheorem{proof}{Proof}
\theoremsymbol{\ensuremath{\blacksquare}}
\newtheorem{solution}{Solution}
\theoremseparator{. ---}
\theoremsymbol{\mbox{\texttt{;o)}}}
\newtheorem{varsol}{Solution (variant)}

\begin{document}

    \begin{proof}Since something is true, we have
      \[ A = B. \]
    \end{proof}


    \begin{solution}[of some exercise]
      This is a very intricate solution.
      \begin{align*}
        a & = b \\ c & = d.
      \end{align*}
    \end{solution}

    \begin{varsol}
      This solution is so very simple that it’s not even worth writing it. Just pure thought:
      \begin{equation}\label{void}
      \end{equation}
    \end{varsol}
\end{document} 

enter image description here

Tags:

Environments