I have the following two custom commands:
The conditional probability:
\newcommand{\cProb}[2]{\operatorname{P}\left[ #1 \,\middle|\, #2 \right]}
and a dotas a placeholder for arguments in functions:
\newcommand{\argdot}{\,\cdot\,}
Now with this setup, if i write \cProb{B}{A}
it produces the follwing nice result:
\operatorname{P}\left[ A \,\middle|\, B \right]
However, if i write \cProb{\argdot}{A}
there is one space too much before the conditional probability delimiter in the produced result:
\operatorname{P}\left[ \,\cdot\, \,\middle|\, B \right]
Is there a way to use a space character (other than \,) in math mode that is just counted once if it appears more than one time in a row? Or in general is there a way to produce this behaviour?
\middle\vert
, i.e, you should write\;\middle|\;
.\newcommand{\cProb}[2]{\operatorname{P}\left[ #1 \mid #2 \right]} \newcommand{\argdot}{\, \cdot}
?\mid
) does not, that'll end up looking horrible.