On Wed, 25 May 2011, Paul Menzel wrote:
On Di, 2011-05-24 at 09:56 -0400, Aditya Mahajan wrote:
On Tue, 24 May 2011, Paul Menzel wrote:
to markup the probability measure and the parenthesis around the argument, I defined the following command.
\define[1]\P{{\mathbf P}\left( #1 \right)}
Unfortunately the space between the P and the left ( is a little big in my opinion. Is that correct or should/can I fix that somehow?
Getting these spaces is tricky; especially if you consider spaces before and after the definition. Choose your pick:
\starttext \startformula A{\mathbf P}\left( ABC \right)B \quad A\mathop{\kern\zeropoint\mathbf P}\left( ABC \right)B \quad A{\mathbf P}\mathopen{}\left( ABC \right)\mathclose{}B \quad A\mathop{\kern\zeropoint\mathbf P}\mathopen{}\left( ABC \right)\mathclose{}B \quad \stopformula \stoptext
That looks tricky and complex.
But can be easily hidden behind a macro.
Could you explain the advantage over `\!` which Wolfgang suggested at least for the space after the definition.
\! only corrects the space between the P and (, not the spacing before P, and the space after ). Moreover, some of the math spacing rules change in \scriptstyle and \scriptscriptstyle; using \mathop, \mathopen, and \mathclose means that those rules are followed.
In addition, I think AMSTeX defines a command `\DeclareMathOperator` [1] which takes care of these things
No. \DeclareMathOperator is just a fancy wrapper around \mathop{\operatorfont ...}. A similar result can be achieved in ConTeXt using \declaremathcommand [...] [op] [\mfunction ...] For defining user macros, I prefer \mathop{\mfunction{...}}. Aditya