I'm pursuing the Math Expectation operator (
\DeclareMathOperator is not very good for one-letter operators (since it adds some spacing after itself), I use a plain
\newcommand. But here comes the problem that there's no space before it, so writing something like
X \MyExpct X turns into something without spaces, while I would like to see a space between the first
But adding a spacing into
fails when my operator stand in the beginning of an expression! So what I want is a space which would be added before the operator if something (but not a binary operation or a opening bracket!) stands before it, and which would be removed otherwise.
I tried to play with
\ignorespaces, and even looked into how
\DeclareMathOperator deals with it (via
\kern) but failed to find the solution.