ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* math: too big space between function and argument
@ 2011-05-24 11:14 Paul Menzel
  2011-05-24 13:25 ` Wolfgang Schuster
  2011-05-24 13:56 ` math: too big space between function and argument Aditya Mahajan
  0 siblings, 2 replies; 7+ messages in thread
From: Paul Menzel @ 2011-05-24 11:14 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1.1: Type: text/plain, Size: 341 bytes --]

Dear ConTeXt folks,


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?


Thanks,

Paul

[-- Attachment #1.1.2: mathbold.pdf --]
[-- Type: application/pdf, Size: 16319 bytes --]

[-- Attachment #1.1.3: mathbold.tex --]
[-- Type: text/x-tex, Size: 204 bytes --]

\define[1]\P{{\mathbf P}\left( #1 \right)}
\starttext
The following equation contains probabilities.

\placeformula
\startformula
\P{A ∪ B} = \P{A} + \P{B} - \P{A ∩ B}
\stopformula
\stoptext

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: math: too big space between function and argument
  2011-05-24 11:14 math: too big space between function and argument Paul Menzel
@ 2011-05-24 13:25 ` Wolfgang Schuster
  2011-05-25 13:46   ` Why is `\P` used for not often used ¶? (was: math: too big space between function and argument) Paul Menzel
  2011-05-24 13:56 ` math: too big space between function and argument Aditya Mahajan
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2011-05-24 13:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 24.05.2011 um 13:14 schrieb Paul Menzel:

> Dear ConTeXt folks,
> 
> 
> 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?

You can insert negative kerning with “\!”.

\define[1]\P{{\mathbf P}\!\left(#1\right)}

BTW: You redefine the already existing \P (expands to ¶) command.

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: math: too big space between function and argument
  2011-05-24 11:14 math: too big space between function and argument Paul Menzel
  2011-05-24 13:25 ` Wolfgang Schuster
@ 2011-05-24 13:56 ` Aditya Mahajan
  2011-05-25 13:52   ` Paul Menzel
  1 sibling, 1 reply; 7+ messages in thread
From: Aditya Mahajan @ 2011-05-24 13:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 24 May 2011, Paul Menzel wrote:

> Dear ConTeXt folks,
>
>
> 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

Some information from the mathsets module (which does not work with 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.


Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Why is `\P` used for not often used ¶? (was: math: too big space between function and argument)
  2011-05-24 13:25 ` Wolfgang Schuster
@ 2011-05-25 13:46   ` Paul Menzel
  2011-05-25 14:27     ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Menzel @ 2011-05-25 13:46 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1009 bytes --]

On Di, 2011-05-24 at 15:25 +0200, Wolfgang Schuster wrote:
> Am 24.05.2011 um 13:14 schrieb Paul Menzel:

> > 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?
> 
> You can insert negative kerning with “\!”.
> 
> \define[1]\P{{\mathbf P}\!\left(#1\right)}

Thank you for the quick reply.

> BTW: You redefine the already existing \P (expands to ¶) command.

I should read the log to notice such problems. I guess I will use `\Pr`
then.

But seriously does somebody really need a lot of ¶ in there texts? (If
yes I would be interested when.) If not, why is such a nice command name
reserved for such a purpose?

I guess this has been there for a long time, so redefining would break
too much?


Thanks,

Paul

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: math: too big space between function and argument
  2011-05-24 13:56 ` math: too big space between function and argument Aditya Mahajan
@ 2011-05-25 13:52   ` Paul Menzel
  2011-05-25 15:54     ` Aditya Mahajan
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Menzel @ 2011-05-25 13:52 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 3246 bytes --]

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

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re:  Why is `\P` used for not often used ¶? (was: math: too big space between function and argument)
  2011-05-25 13:46   ` Why is `\P` used for not often used ¶? (was: math: too big space between function and argument) Paul Menzel
@ 2011-05-25 14:27     ` Wolfgang Schuster
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2011-05-25 14:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 25.05.2011 um 15:46 schrieb Paul Menzel:

>> BTW: You redefine the already existing \P (expands to ¶) command.
> 
> I should read the log to notice such problems. I guess I will use `\Pr`
> then.

This isn’t better because \Pr is also a predefined command for math.
When you want to replace a existing command use \P because you can
just type ¶ when you need the character.

> But seriously does somebody really need a lot of ¶ in there texts? (If
> yes I would be interested when.) If not, why is such a nice command name
> reserved for such a purpose?
> 
> I guess this has been there for a long time, so redefining would break
> too much?

Not really, it’s a command from plain TeX where input was limited to ascii
and local encodings and typing ¶ wasn’t as easy as nowadays.

Here is a list with commands for characters which are inherited from
plain TeX and also a few commands (i list them because they one letter
commands) for accents:

\starttext

\starttabulate[|lh{\type}|l|]
\HC {\AA} \EQ \AA \NC\NR
\HC {\aa} \EQ \aa \NC\NR
\HC {\ae} \EQ \ae \NC\NR
\HC {\AE} \EQ \AE \NC\NR
\HC {\i}  \EQ \i  \NC\NR
\HC {\j}  \EQ \j  \NC\NR
\HC {\l}  \EQ \l  \NC\NR
\HC {\L}  \EQ \L  \NC\NR
\HC {\o}  \EQ \o  \NC\NR
\HC {\O}  \EQ \O  \NC\NR
\HC {\oe} \EQ \oe \NC\NR
\HC {\OE} \EQ \OE \NC\NR
\HC {\P}  \EQ \P  \NC\NR
\HC {\S}  \EQ \S  \NC\NR
\HC {\SS} \EQ \SS \NC\NR % was \ss in plain TeX
\stoptabulate

\starttabulate[|lh{\type}|l|]
\HC {\"{o}} \EQ \"{o} \NC\NR
\HC {\.{o}} \EQ \.{o} \NC\NR
\HC {\^{o}} \EQ \^{o} \NC\NR
\HC {\~{o}} \EQ \~{o} \NC\NR
\HC {\c{o}} \EQ \c{o} \NC\NR
\HC {\d{o}} \EQ \d{o} \NC\NR
\HC {\H{o}} \EQ \H{o} \NC\NR
\HC {\u{o}} \EQ \u{o} \NC\NR
\HC {\v{o}} \EQ \v{o} \NC\NR
\stoptabulate

\type{\Pr} : $\Pr$

\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: math: too big space between function and argument
  2011-05-25 13:52   ` Paul Menzel
@ 2011-05-25 15:54     ` Aditya Mahajan
  0 siblings, 0 replies; 7+ messages in thread
From: Aditya Mahajan @ 2011-05-25 15:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-05-25 15:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 11:14 math: too big space between function and argument Paul Menzel
2011-05-24 13:25 ` Wolfgang Schuster
2011-05-25 13:46   ` Why is `\P` used for not often used ¶? (was: math: too big space between function and argument) Paul Menzel
2011-05-25 14:27     ` Wolfgang Schuster
2011-05-24 13:56 ` math: too big space between function and argument Aditya Mahajan
2011-05-25 13:52   ` Paul Menzel
2011-05-25 15:54     ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).