Consider the following MWE:
\documentclass[11pt]{report}
\usepackage{framed}
\usepackage{pstricks}
\usepackage{color}
\usepackage[framed,thmmarks,thref, hyperref]{ntheorem}
\usepackage{etoolbox}
\definecolor{proofback}{rgb}{0.95,0.95,0.95}
\theoremheaderfont{\sc}
\theorembodyfont{\upshape}
\theoremstyle{nonumberplain}
\theoremsymbol{\raisebox{-5mm}{ \rule{1ex}{1ex} }}
\shadecolor{proofback}
\newshadedtheorem{proof}{Proof}
\begin{document}
\begin{proof}
test test
\end{proof}
some normal text
\end{document}
This gives the following output:

As per title I would like to remove the indentation after the end of the proof. As a solution I thought I could use something like
\let\oldendproof\endproof
\def\endproof{\oldendproof \leavevmode\vspace{-\baselineskip} \\ \noindent}
Adding these two lines, indeed, leads to
However, the problem is that, in case there is a proof followed directly by a theorem this solution creates an unnecessary amount of space:
\begin{proof}
test test
\end{proof}
\begin{proof}
another test
\end{proof}
while, without my hack, the rendered pdf looks like
I suspect this is due to the fact that I'm leaving vertical mode, but I know very little about how latex works internally.
Any idea of how I can remove the indentation after a proof without this side effect? I know I can simply add a \noindent just after the end of the proof, but I was looking for some "automatic" and general solution that doesn't force me to do so. I'm compiling using xelatex.





ntheorem, i can't suggest how to avoid it. – barbara beeton Oct 18 '16 at 13:14