11

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.

  • Do you want this just for a single proof? – Gonzalo Medina Oct 6 '12 at 17:22
  • no, but the single case would be sufficient, I can copy/paste for others. I don't really want to create a new environment or change the existing one because i'll forget what to do if I reformat laptop. – john w. Oct 6 '12 at 17:34
10

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)

  • That redefinition of \qed can lead to perhaps an unwanted "dangling qed symbol" by itself on a new line if the last line of the proof itself is too long. For example, in the MWE replace Here is my proof with Here is my very long proof that involves a lot of computation and stretches quite far to the margin. – murray Oct 7 '12 at 15:50
  • 1
    And this also breaks the logic crafted in the amsthm package for placing the tombstone symbol when the last line of the proof is a displayed equation (the symbol gets placed on the next line). Of course, one can always re-write the proof so that the last line is prose... – Willie Wong Oct 8 '12 at 8:40
  • @WillieWong WOuld it be okay to have the que symbol next to the equation's first line? If so loading etoolbox and calling \qedhere right before the end of the environment (for \qedhere suppress the \qed behaviour) should work (\AtEndEnvironment{equation}{\qedhere} and \AtEndEnvironment{equation*}{\qedhere}) – henrique Oct 8 '12 at 13:13
  • 2
    You're at least missing \unskip and \nobreak: \renewcommand{\qed}{\unskip\nobreak\quad\qedsymbol}. Otherwise it may result in a lonely tombstone symbol at the beginning of a line. – egreg Oct 8 '12 at 13:30
  • 2
    I don't think it's a good idea to add \qedhere to all equation environments: \qedhere should be added where needed. With your code, if you have an equation environments in a single proof, it will be marked, independently of it being at the end of the proof; if there are two, the first one will be marked. Please, remove that part. – egreg Oct 8 '12 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.