# How align the qedsymbol after of a big formula in display mode?

## 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

## What I want

I'd like something like

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

• 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. – Andrew Aug 8 '14 at 4:16
• 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 8 '14 at 9:04

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}  • This answer seemed to me the easiest and gives me an idea to solve another problem. – skpblack Aug 9 '14 at 0:06 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}


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

• Why don't you use ntheorem package? Does it have some features you do not like, or is it flawed, so to say, in some way? – Mad Hatter Feb 25 '16 at 12:36
• I find it quite rigid; amsthm is much easier to customize, maybe with the help of thmtools. – egreg Feb 25 '16 at 13:43
• Is there a way to apply your solution to ams environments, like align? I have a problem, since in a book I write when I use \qedhere within align, the box is not flushed to the margin but is placed just after the dot ending the last line in a sequence of formulas. – Mad Hatter Feb 26 '16 at 9:03
• @MadHatter I don't think you should use this approach to the placement of the tombstone to begin with. Are you using the fleqn option? – egreg Feb 26 '16 at 9:19
• No, I am not using it. – Mad Hatter Feb 26 '16 at 9:21

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}
\theoremseparator{.}
\theorembodyfont{\itshape}
\newtheorem{theorem}{Theorem}

\theoremstyle{nonumberplain}
\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}