2010-01-15 Customizing end-of-proof marks (en)

I was recently asked by a friend to help him with customizing end-of-proof marks. Say that we are writing a textbook with theorems with proofs and example problems with solutions and that we want a usual [Error: dvipng binary and convert binary not found at /usr/bin/dvipng or ] after a proof, but, for example, a [Error: dvipng binary and convert binary not found at /usr/bin/dvipng or ] after a solution to a problem.

Probably the best way to accomplish this is by using the powerful ntheorem package by Wolfgang May and Andreas Schedler (see its home page). But alas, I don’t usually use it (since I am used to amsthm), which is a shame on me: ntheorem seems to do all the work of amsthm and much more. The only problem is that you have at least to skim through the documentation (which is well written and not too long) – I am quite busy now, but hopefully I will be able to read it in a few weeks’ time and write something about it here.

If you are an amsthm-addict for some reason, there is also hope for you: just use the following quick-and-dirty solution (to be pasted in the preamble):

\newenvironment{solution}{%
  \proof[Solution]\def\qedsymbol{$\diamond$}%
}{%
  \endproof
}

What it does is:

  1. The newly-defined environment solution will launch the proof environment whenever \begin{solution} is put into the document. Roughly speaking, \proof is (almost) the same as \begin{proof}.
  2. The \qedsymbol will be redefined into whatever we want (here, the [Error: dvipng binary and convert binary not found at /usr/bin/dvipng or ]). Since we don’t use LaTeX’s \newcommand, but plain TeX’s \def, this redefinition is local, i.e., valid only within the proof environment.
  3. The \end{solution} is defined to be essentially the same as \end{proof} ; note that \endproof is a “low-level version” (again, roughly speaking!) of \end{proof}.

Summing up: the main purpose of this construct is to teach people something (hopefully) interesting about how TeX and LaTeX works; for production purposes, ntheorem is better.

CategoryBlog, CategoryEnglish, CategoryTeX, CategoryLaTeX, KategoriaLaTeX