# Erratic position of QED symbol at the end of proof environment using SIAM template

I already had issues (described here: amsmath package error using SIAM LaTeX template files) with the newest version of SIAM LaTeX template from http://www.siam.org/journals/auth-info.php

For now, I would like to clarify why the position of QED symbol in the proof environment depends on the equation environment type. Using example from manual with \begin{displaymath}\end{displaymath}:

\begin{corollary}
Let $f(x)$ be continuous and differentiable everywhere. If $f(x)$
has at least two roots, then $f’(x)$ must have at least one root.
\end{corollary}
\begin{proof}
Let $a$ and $b$ be two distinct roots of $f$.
By \cref{thm:mvt}, there exists a number $c$ such that
\begin{displaymath}
f’(c) = \frac{f(b)-f(a)}{b-a} = \frac{0-0}{b-a} = 0.
\end{displaymath}
\end{proof}


puts QED symbol at the right position (end of the equation).

However, using  QED symbol is completely absent from the proof environment:

\begin{corollary}
Let $f(x)$ be continuous and differentiable everywhere. If $f(x)$
has at least two roots, then $f’(x)$ must have at least one root.
\end{corollary}
\begin{proof}
Let $a$ and $b$ be two distinct roots of $f$.
By \cref{thm:mvt}, there exists a number $c$ such that
$$f’(c) = \frac{f(b)-f(a)}{b-a} = \frac{0-0}{b-a} = 0.$$
\end{proof}


Finally, using \begin{equation*}\end{equation*} puts QED symbol in a wrong position, i.e., above the equation.

\begin{corollary}
Let $f(x)$ be continuous and differentiable everywhere. If $f(x)$
has at least two roots, then $f’(x)$ must have at least one root.
\end{corollary}
\begin{proof}
Let $a$ and $b$ be two distinct roots of $f$.
By \cref{thm:mvt}, there exists a number $c$ such that
\begin{equation*}
f’(c) = \frac{f(b)-f(a)}{b-a} = \frac{0-0}{b-a} = 0.
\end{equation*}
\end{proof}


My questions are following:

1. Is this behavior typical for any proof environment containing math equations and adding the QED symbol at the end of it; or this another 'bug' in SIAM template file?

2. What is the correct way to type in proof environment math equations? Previously I have used most often \begin{equation*}\end{equation*}, but here it produces the wrong behavior.

First of all, never ever use $$...$$ in LaTeX: you have discovered another reason why, but please have a look at Why is $...$ preferable to $$...$$?

Second, it's another feature of ntheorem with the thmmarks option, that modifies some environments but not all in order to provide automatic placement of the tombstone.

In particular equation* doesn't get redefined, so it's not in line with the automatic placement. You can make it compatible by redefining it.

\documentclass[
%review
]{siamart0516}
\usepackage{amsmath}

\usepackage{etoolbox}
% fix for https://tex.stackexchange.com/questions/328946
\patchcmd{\SetTagPlusEndMark}{$}{}{}{} \patchcmd{\SetTagPlusEndMark}{$}{}{}{}

% fix for the QED in equation*
\renewenvironment{equation*}{$}{$\ignorespacesafterend}

\begin{document}
$$\bar{x} = x + y \tag{\bar{x}} \label{eq:x}$$

\begin{corollary}
Let $f(x)$ be continuous and differentiable everywhere. If $f(x)$
has at least two roots, then $f’(x)$ must have at least one root.
\end{corollary}
\begin{proof}
Let $a$ and $b$ be two distinct roots of $f$.
By \cref{thm:mvt}, there exists a number $c$ such that
\begin{displaymath}$$f’(c) = \frac{f(b)-f(a)}{b-a} = \frac{0-0}{b-a} = 0.$$\end{displaymath}
\end{proof}

\begin{corollary}
Let $f(x)$ be continuous and differentiable everywhere. If $f(x)$
has at least two roots, then $f’(x)$ must have at least one root.
\end{corollary}
\begin{proof}
Let $a$ and $b$ be two distinct roots of $f$.
By \cref{thm:mvt}, there exists a number $c$ such that
\begin{equation*}$$f’(c) = \frac{f(b)-f(a)}{b-a} = \frac{0-0}{b-a} = 0.$$\end{equation*}
\end{proof}

\begin{corollary}
Let $f(x)$ be continuous and differentiable everywhere. If $f(x)$
has at least two roots, then $f’(x)$ must have at least one root.
\end{corollary}
\begin{proof}
Let $a$ and $b$ be two distinct roots of $f$.
By \cref{thm:mvt}, there exists a number $c$ such that
$$f’(c) = \frac{f(b)-f(a)}{b-a} = \frac{0-0}{b-a} = 0.$$
\end{proof}

\end{document}


However, equation will not push the QED in the same position as equation* (I deem wrong the placement in equation*, but apparently this pleases the author of ntheorem).

• I have found a slight misbehaviour if the review option of siamart171218 is used. I fixed it with \renewenvironment{equation*}{$}{$\ignorespacesafterend}. – gerw Sep 6 '18 at 8:19
• @gerw That's a very good suggestion – egreg Sep 6 '18 at 8:29