6

Description of the problem

My problem is this. For the proof of a math theorem i use the proof environment of the package amsthm. It adds a \qedsymbol in the last line of the proof, but if the proof ends with a displayed formula the qedsymbol appears in the next line leaving an unwanted blank space.

The documentation of amsthm teaches to fix this problem placing the command \qedhere after of the displayed formula but inside of the appropriate environment.

This works well if the formula is of one line like

\[ax^2+bx+c=0.\qedhere
\]

but if the proof ends in a matrix, or cases with a "great height" the qedsymbol is fixed in the baseline at right and it this looks higher than expected (for my taste).

The result is showed in this

MWE

\documentclass{article}
\usepackage[width=7cm]{geometry} % Only for reducing space in this MWE 
\usepackage{amsmath} % For `bmatrix`
\usepackage{amsthm} % For `proof` environment
\begin{document}
\begin{proof}
And this proof ends with
\[
\begin{bmatrix}
    1 & 0 \\
    0 & 1 \\
    0 & 0
\end{bmatrix}.\qedhere
\]
\end{proof}
\noindent Text
\end{document}

that produces

enter image description here

What I want

I'd like something like

enter image description here

with the qedsymbol aligned with the bottom of the matrix. Is this possible?

skpblack
  • 8,904
  • 3
  • 31
  • 42
  • 2
    This is a known issue that is fixed by the ntheorem package: see problem with qedhere. The solution is to replace \usepackage{amsthm} with \usepackage[amsmath,amsthm,thmmarks]{ntheorem} -- and you can drop the \qedhere completely. –  Aug 08 '14 at 04:16
  • 1
    I don't think you want it. You have a full stop and the QED symbol should be level to it. It's no different to the case of an integral, that extends below the baseline. – egreg Aug 08 '14 at 09:04

3 Answers3

10

Since you're using punctuation (which I agree with), the QED symbol should share the baseline with the punctuation.

Here's a trick that avoids using ntheorem (which I never use nor recommend); I also show why you shouldn't lower the tombstone.

\documentclass{article}
\usepackage[width=7cm]{geometry} % Only for reducing space in this MWE 
\usepackage{amsmath} % For `bmatrix`
\usepackage{amsthm} % For `proof` environment

\newenvironment{verticalhack}
  {\begin{array}[b]{@{}c@{}}\displaystyle}
  {\\\noalign{\hrule height0pt}\end{array}}

\begin{document}
\begin{proof}
And this proof ends with
\[
\begin{verticalhack}
\begin{bmatrix}
    1 & 0 \\
    0 & 1 \\
    0 & 0
\end{bmatrix}.
\end{verticalhack}\qedhere
\]
\end{proof}
\noindent Text
\begin{proof}
And this proof ends with
\[
\begin{verticalhack}
\int\limits_{\Gamma} f(x,y,z)\,dx\,dy\,dz.
\end{verticalhack}\qedhere
\]
\end{proof}
\noindent Text
\end{document}

enter image description here

The latter example makes no sense, does it? Well, the former example is just the same.

egreg
  • 1,121,712
6

As Enrico already mentioned, I wouldn't use a stop after the matrix. However, you can use the \tag amcro from amsmath:

\documentclass{article}
\usepackage[width=7cm]{geometry} % Only for reducing space in this MWE 
\usepackage{amsmath} % For `bmatrix`
\usepackage{amsthm} % For `proof` environment
\begin{document}
\begin{proof}
And this proof ends with
\begin{align*}
\begin{bmatrix}
    1 & 0 \\
    0 & 1 \\
    0 & 0
\end{bmatrix}\\[-\normalbaselineskip]\tag*{\qedhere}
\end{align*}
\end{proof}
\noindent Text
\end{document}

enter image description here

2

Here is a solution with the ntheorem package:

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

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

    \theoremstyle{plain}
    \theoremheaderfont{\bfseries}
    \theoremseparator{.}
    \theorembodyfont{\itshape}
    \newtheorem{theorem}{Theorem}

    \theoremstyle{nonumberplain}
    \theoremheaderfont{\scshape}
    \theorembodyfont{\upshape}
    \theoremsymbol{\ensuremath{\square}}
    \newtheorem{proof}{Proof}

    \theoremsymbol{\ensuremath{\blacksquare}}
    \newtheorem{blackproof}{Proof}
    \begin{document}

    \begin{theorem}[Some theorem]\label{thm:some-theorem}
    This is an important theorem.
    \end{theorem}

    \begin{proof}[of \cref{thm:some-theorem}]
    This is a very important proof.
    \[ \begin{bmatrix}
    1 & 0 \\
    0 & 1 \\
    0 & 0
    \end{bmatrix}.\]
    \end{proof}

    \begin{blackproof}[of \cref{thm:some-theorem}]
    This is another very important proof.
    \begin{align*}
        a & = b\\ c & = d.
    \end{align*}
    \end{blackproof}

    \end{document} 

enter image description here

Bernard
  • 271,350