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. > Some information from the mathsets module (which does not work with MkIV). I hope you or somebody will have time to port that module to MkIV. > The entry is the latex bug database is not viewable now. > > %D The \type{\left} and \type{\right} generate a math atom of type inner, > %D while for math sets, we want a math open atom. To see the difference, > %D consider > %D > %D \startbuffer > %D \startformula > %D 2\left(\frac {3}{4} \right) \qquad \hbox{ vs } \qquad > %D 2\biggl( \frac {3}{4} \biggr) > %D \stopformula > %D > %D and > %D > %D \startformula > %D \Pr\left(\frac {3}{4} \right) \qquad \hbox{ vs } \qquad > %D \Pr\biggl( \frac {3}{4} \biggr) > %D \stopformula > %D \stopbuffer > %D \typebuffer > %D > %D which gives (notice the spacing before the parenthesis) > %D > %D \getbuffer > %D > %D I will assume that if \type{text} is something, then > %D the default behaviour is desirable, if \type{text} is empty, then I add > %D \type{\mathopen} and \type{\mathclose}. Using \type{\mathopen} to correct > %D the spacing is due to Frank Mittelbach, see > %D \hyphenatedurl{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/3853} > %D > %D Mathset module ensures that we get the correct spacing in both cases > %D \startbuffer > %D \definemathset[SET][left=(,right=)] > %D \startformula > %D 2\SET{\frac{3}{4}} \qquad \hbox{ and } \qquad > %D \PR{ \frac{3}{4} } > %D \stopformula > %D \stopbuffer > %D \getbuffer[PR] \getbuffer which was typed as \typebuffer > %D > %D Also, if its argument is a single character, \type{\mathop} centers it > to > %D with respect to the math||axis. Compare the outputs of > %D > %D \startbuffer > %D \ruledhbox{$\mathop{y}\nolimits_x\left\{A\,\middle|\,B\right\}$} > %D \ruledhbox{$\mathop{\kern\zeropoint y}\nolimits_x\left\{A\,\middle|\,B\right\}$} > %D \stopbuffer > %D > %D \typebuffer > %D \getbuffer > %D > %D I have added a \type{\kern\zeropoint} to prevent that. Could you explain the advantage over `\!` which Wolfgang suggested at least for the space after the definition. In addition, I think AMSTeX defines a command `\DeclareMathOperator` [1] which takes care of these things. Thanks, Paul [1] http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics#Custom_operators