Consider the following code, the purpose of which is to have a proof environment in which the "Proof." bit is bold.
\documentclass{article}\usepackage{amsthm} \renewenvironment{proof}[1][Proof]{\noindent{\bfseries #1.\ }}{\qed\\[2mm]}\begin{document}\begin{proof} $A = X$.\end{proof}\begin{proof}[Proof] $A = X$.\end{proof}\begin{proof}[Proof]% $A = X$.\end{proof}\end{document}
This produces the following spacing inconsistency:In particular, when the optional argument is provided, even when given exactly the same value as the default (Proof), an extra space appears after the period. Adding
%
after the argument bracket close fixes this, but why does this happen? And how to write the environment in such a way that this %
is not necessary?