# How to equalize the spaces above and below the theorem?

When I use the following code,

\documentclass{amsbook}

\makeatletter
\rlap{\thepage}\hfil \leftmark{}{}}%
\rightmark{}{}\hfil \llap{\thepage}}%
\let\@mkboth\markboth
\def\chaptermark{%
\def\sectionmark{%
}
\def\th@spplain{%
\let\thm@indent\relax
\thm@preskip.5\baselineskip\@plus.2\baselineskip
\@minus.2\baselineskip
\thm@postskip\thm@preskip
\normalfont
}
\makeatother

\theoremstyle{spplain}
\newtheorem{theo}{Theorem}

\begin{document}

\chapter{A test chapter}
\section{A test section}
$\\$Beginning Text.
\begin{theo}
Some Text
\end{theo}
Ending Text.
\end{document}


I get the following output,

but I want to have an output in which the followings hold,

1. The "E" "Ending Text" should be along the same vertical line as "B" of "Beginning Text".
2. The space between "Theorem 1" and "Beginning Text" should be equal to that of "Theorem 1" and "Ending Text".

How can I modify the above code (or produce a different code) to meet this criteria?

\def\@endtheorem{\endtrivlist\@endpetrue }

before \makeatother would suffice, it automatically suppresses paragraph indentation. Alternatively, you can simply add \noindent after every \end{theo}.
\thm@postskip\thm@preskip