[Tex/LaTex] How to draw a horizontal line at the end of proofs

amsthmrulestheorems

How can I draw a horizontal line at the end of proofs? I use \begin{proof}....\end{proof}.

I use amsthm package without any modification.

Best Answer

You could patch \endproof (the end macro of the proof environment) to insert a horizontal rule automatically. The following patch is provided via etoolbox:

enter image description here

\documentclass{article}
\usepackage{amsthm,etoolbox}% http://ctan.org/pkg/{amsthm,etoolbox}
\patchcmd{\endproof}% <cmd>
  {\endtrivlist}% <search>
  {\endtrivlist\par\nobreak\vspace*{\dimexpr-\baselineskip-\parskip}\nobreak\noindent\hrulefill}% <replace>
  {}{}% <succes><failure>
\begin{document}
\begin{proof}
Here is a proof.
\end{proof}
\end{document}

The patch removes a vertical skip after ending proof, and inserts \nobreak together with a horizontal rule (\hrulefill) so that they are not separated by a page break.