7

I am typing up solutions to a variety of problems in a textbook, and I want to use the proof environment for proofs but a similar environment for solutions. The link here

Duplicating the amsthm proof environment

shows how I can make my own solution environment, but I want the indication for the end of a solution to be slightly different than that of a proof. I'd like solutions to end with the QED as \blackbox whereas I want the proof environment to stay as it is (white box to indicate QED). Is there an easy way to make this happen?

2 Answers 2

4

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

1
  • the black box to delineate end of exercise is not present. Commented Sep 21, 2020 at 0:16
10

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

1
  • What are the dimensions of the regular QED symbol? I'd like my black square to look exactly like that--I know you have 3mm and it looks like 2.5mm fits better, but I'm not sure of the exact size. Commented Nov 8, 2014 at 12:48

You must log in to answer this question.

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