Why the Q.E.D. symbol show after the sentence end and can’t show right aligned (as picture below)

proof-packagesymbolstheorems

\documentclass[twoside,11pt]{book}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm,papersize={15.5cm,23.5cm}]{geometry}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}.}
\renewcommand{\thesubsection}{\arabic{chapter}.\arabic{section}.\arabic{subsection}.}
\usepackage{amsthm}
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]
\renewcommand{\thetheorem}{\thesection\arabic{theorem}}
\renewenvironment{proof}{{\noindent\bfseries Proof.}}{\qedsymbol}
\renewcommand{\qedsymbol}{\rule{1ex}{1ex}}

\begin{document}
    \chapter{ABC}
    blablabla
    \section{ONE}
    \begin{theorem}
        dddd
    \end{theorem}
\begin{proof}
    It is clear.
\end{proof}
\end{document}

I want the text Proof is bold. So I write:

\renewenvironment{proof}{{\noindent\bfseries Proof.}}{\qedsymbol}

Now, I want to Q.E.D. symbol is black square, so I write

\renewcommand{\qedsymbol}{\rule{1ex}{1ex}}

Why the Q.E.D. symbol show after the sentence end and can't show right aligned (as picture below)? How to make it?

enter image description here

I want:

enter image description here

Best Answer

My suggestion is to use https://tex.stackexchange.com/a/251251/4427 with also a redefinition of \qedsymbol.

\documentclass{article}

\usepackage{amsthm}
\usepackage{xpatch}

\providecommand{\proofnamefont}{\itshape}% the default
\xpatchcmd{\proof}{\itshape}{\normalfont\proofnamefont}{}{}
\renewcommand{\proofnamefont}{\bfseries}% your preference

\renewcommand{\qedsymbol}{\rule{1ex}{1ex}}

\begin{document}

\begin{proof}
Obvious, isn't it?
\end{proof}

\end{document}

enter image description here

Related Question