[Tex/LaTex] Move QED symbol to the left, i.e. at the end of the sentence

amsmathamsthmsymbolstheorems

I want to make the qed symbol at the end of a proof appear at the end of the last sentence, not at the far right of the same line.

Would like to do this the simplest way possible.

All I can find online is people using \qedhere to fix the symbol being on the wrong line.

Best Answer

You can redefine it to simply (Thanks to @egreg who pointed out the need for \unskip\nobreak)

\renewcommand{\qed}{\unskip\nobreak\quad\qedsymbol}%

Here's a (not so minimal) MWE:

\documentclass{article}
\usepackage{amsmath,amsthm}
\renewcommand{\qed}{\unskip\nobreak\quad\qedsymbol}% As suggested by egreg

\begin{document}

\begin{proof} A Simple Proof
Here is my proof
\end{proof}

\begin{proof} A Long Proof
Here is my very long proof that involves a lot of computation and stretches quite far to the margin.
\end{proof}

\begin{proof} A Proof with Equations (\verb!equation! environment)
Here is my proof:

\begin{equation}
  x = a_0 + \cfrac{1}{a_1
          + \cfrac{1}{a_2
          + \cfrac{1}{a_3 + a_4}}}
\end{equation}
\end{proof}


\begin{proof} A Proof with Equations (\verb!equation! environment) and \verb!\qedhere!
Here is my proof:

\begin{equation}
  x = a_0 + \cfrac{1}{a_1
          + \cfrac{1}{a_2
          + \cfrac{1}{a_3 + a_4}}}
  \qedhere
\end{equation}
\end{proof}

\begin{proof} A Proof with aligned equations (\verb!align! environment)
\begin{align}
\intertext{If}
   A &= \sigma_1+\sigma_2\\
   B &= \rho_1+\rho_2\\
\intertext{then}
C(x) &= e^{Ax^2+\pi}+B
\end{align}
\end{proof}

\begin{proof} A Proof with aligned equations (\verb!align! environment) and \verb!\qedhere!
\begin{align}
\intertext{If}
   A &= \sigma_1+\sigma_2\\
   B &= \rho_1+\rho_2\\
\intertext{then}
C(x) &= e^{Ax^2+\pi}+B\qedhere
\end{align}
\end{proof}

\end{document}

QED symbol replacement examples

ISSUES

If your proof has equations, you should use \qedhere to avoid that the symbol goes to the next line (as @egreg suggested, it's not a good idea to add \qedhere to all equation environments)