[Tex/LaTex] A question on how to change the qed-symbol of amsthm

amsthmsymbols

I am using the amsthm package and get a blank square like $\Square$ at the end of proofs. How can I redefine to get the black Halmos tombstone $\Blacksquare$ instead?

I want the symbol to be right aligned, but it would be useful if I were to be able to switch off the right-alignment.

Best Answer

Redefine \qedsymbol:

\documentclass{article}
\usepackage{amsthm}
\usepackage{amssymb}

\renewcommand\qedsymbol{$\blacksquare$}

\begin{document}

\begin{proof}
A test text
\end{proof}

\end{document}

enter image description here

I wouldn't recommend to switch off right alignment for the end-mark (it's not standard, so readers might miss the end-mark and quite franckly, it looks ugly), but you could do something like this:

\documentclass{article}
\usepackage{amsthm}
\usepackage{amssymb}

\renewcommand\qedsymbol{$\blacksquare$}
\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[\hskip\labelsep
        \itshape
    #1\@addpunct{.}]\ignorespaces
}{%
  \nolinebreak\qedsymbol\endtrivlist\@endpefalse
}
\makeatother

\begin{document}

\begin{proof}
A test text some more text and some more text and some more text and
\end{proof}

\end{document}

enter image description here

As barbara beeton mentions in her comment, it might be desired to turn off right alignment on a per-case basis; in this case, it's enough to locally redefine \qedsymbol to be empty and then add the desired symbol at the end (taking some care to prevent undesired line breaks); something along these lines:

\documentclass{article}
\usepackage{amsthm}
\usepackage{amssymb}

\renewcommand\qedsymbol{$\blacksquare$}
\newcommand\placeqed{\nobreak\enspace$\blacksquare$}

\begin{document}

\begin{proof}
A test text some more text and some more text and some more text and
\end{proof}

\begin{proof}
\renewcommand\qedsymbol{}
A test text some more text and some more text and some more text and\placeqed
\end{proof}

\end{document}

enter image description here