Re: [NTG-context] ConTeXt equivalent of \newmcodes@

2015-04-27 Thread Hans Hagen

On 4/27/2015 12:13 AM, Maggyero wrote:

Dear list members,

What is the ConTeXt equivalent of the LaTeX function \newmcodes@ defined
in the AMSopn package (this function is used inside \DeclareMathOperator
and \operatorname and has the effect of resetting text-mode punctuation
characters such as *, -, /, :, and ’ in operator names)?


do you have an example of usage

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___

[NTG-context] ConTeXt equivalent of \newmcodes@

2015-04-27 Thread Maggyero
 \definemathcommand[xyz][nolop]{\text{fancy-function-name'*.:}}

The problem with this solution is that the font of the operator becomes the
normal text font whereas I want to use the standard math upright font (so
\mfunction + \kern\zeropoint + \newmathcodes is the way to go). For
instance with \setupbodyfont[sansserif] the operator name becomes sans
serif, which I don't want.

I only need to make this code compile:

\begingroup \catcode`\=12
\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\.613A%
\ifnum\mathcode`\-=45 \else
\mathchardef\std at minus\mathcode`\-\relax
\fi
\mathcode`\-45\mathcode`\/47\mathcode`\:603A\relax}
\endgroup

\definemathcommand[xyz][nolop]{\newmcodes@
\kern\zeropoint\mfunction{fancy-function-name'*.:}}

\starttext
\xyz
\stoptext

How can I do that? The compilation fails at the \ifnum condition. Isn't
\ifnum a ConTeXt macro?


Maggyero
___
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
___

Re: [NTG-context] ConTeXt equivalent of \newmcodes@

2015-04-27 Thread Hans Hagen

On 4/27/2015 9:14 PM, Maggyero wrote:

  Does \definemathcommand [xyz] [nolop] {xyz} do what you want?

Not really if, instead of xyz, I want a name with hyphens, quotes, stars
or colons. Compare the output of

\definemathcommand[xyz][nolop]{fancy-function-name'*.:}

in ConTeXt with the output of

\DeclareMathOperator{\xyz}{fancy-function-name'*.:}

in LaTeX. What I can do is

\definemathcommand[xyz][nolop]{\kern\zeropoint\mfunction{fancy-function-name'*.:}}

which gives the same result as \DeclareMathOperator, except for the
hyphens and the star are converted into binary operators and the colon
which is preceded by a space, since I didn't use \newmcodes@, that is
why I asked how to implement the macro \newmcodes@ in ConTeXt, which is
defined in LaTeX as

\begingroup \catcode`\=12
 \gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\.613A%
 \ifnum\mathcode`\-=45 \else
 \mathchardef\std at minus\mathcode`\-\relax
 \fi
 \mathcode`\-45\mathcode`\/47\mathcode`\:603A\relax}
\endgroup

so that the following code can compile in ConTeXt:

\definemathcommand[xyz][nolop]{\newmcodes@\kern\zeropoint\mfunction{fancy-function-name'*.:}}


\definemathcommand[xyz][nolop]{\text{fancy-function-name'*.:}}

$\xyz^{\xyz}$


--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___

[NTG-context] ConTeXt equivalent of \newmcodes@

2015-04-27 Thread Maggyero
 do you have an example of usage

Yes, I am trying to create the command \operatorname in ConTeXt. I know
that in LaTeX \operatorname{xyz} is equivalent to

\mathop{\newmcodes@\kern\z@\operator@font xyz}\csname nolimits@\endcsname}

according to the AMSopn package (
http://www.bakoma-tex.com/doc/latex/amsmath/amsopn.pdf), and I am trying to
translates that in ConTeXt:

\mathop{\newmcodes@\kern\zeropoint\mfunction{xyz}}\nolimits

but \newmcodes@ produces an error.

In LaTeX, \newmcodes@ is defined as

\begingroup \catcode`\=12
\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\.613A%
\ifnum\mathcode`\-=45 \else
\mathchardef\std@minus\mathcode`\-\relax
\fi
\mathcode`\-45\mathcode`\/47\mathcode`\:603A\relax}
\endgroup

according to the AMSopn package, so I have copied the code in my document
(I only removed the @ so that I don't have to convert its catcode) but the
if condition gives an error (however it compiles fine without the if
condition).

I also know that there is the ConTeXt command
\definemathcommand[nolop]{xyz} which I thought stands as an equivalent to
the \operatorname wrapper \DeclareMathOperator, but apparently not since it
doe not use the 3 commands
1. \newmcodes@
2. \kern\z@
3. \operator@font
in it, so I wonder the point of such a wrapper since all it seems it does
is translates to

\mathop{xyz}\nolimits

To sum up, I would like to have a \DeclareMathOperator in ConTeXt, so here
are my 2 questions:
1. What is the ConTeXt equivalent of \newmcodes@?
2. What is the point of \definemathcommand?


Maggyero
___
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
___

Re: [NTG-context] ConTeXt equivalent of \newmcodes@

2015-04-27 Thread Aditya Mahajan

On Mon, 27 Apr 2015, Maggyero wrote:


do you have an example of usage


Yes, I am trying to create the command \operatorname in ConTeXt. I know
that in LaTeX \operatorname{xyz} is equivalent to

\mathop{\newmcodes@\kern\z@\operator@font xyz}\csname nolimits@\endcsname}

I also know that there is the ConTeXt command
\definemathcommand[nolop]{xyz} which I thought stands as an equivalent to
the \operatorname wrapper \DeclareMathOperator, but apparently not since it
doe not use the 3 commands
1. \newmcodes@
2. \kern\z@
3. \operator@font
in it, so I wonder the point of such a wrapper since all it seems it does
is translates to


Does

   \definemathcommand [xyz] [nolop] {xyz}

do what you want?

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
___

[NTG-context] ConTeXt equivalent of \newmcodes@

2015-04-27 Thread Maggyero
 Does \definemathcommand [xyz] [nolop] {xyz} do what you want?

Not really if, instead of xyz, I want a name with hyphens, quotes, stars or
colons. Compare the output of

\definemathcommand[xyz][nolop]{fancy-function-name'*.:}

in ConTeXt with the output of

\DeclareMathOperator{\xyz}{fancy-function-name'*.:}

in LaTeX. What I can do is

\definemathcommand[xyz][nolop]{\kern\zeropoint\mfunction{fancy-function-name'*.:}}

which gives the same result as \DeclareMathOperator, except for the hyphens
and the star are converted into binary operators and the colon which is
preceded by a space, since I didn't use \newmcodes@, that is why I asked
how to implement the macro \newmcodes@ in ConTeXt, which is defined in
LaTeX as

\begingroup \catcode`\=12
\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\.613A%
\ifnum\mathcode`\-=45 \else
\mathchardef\std at minus\mathcode`\-\relax
\fi
\mathcode`\-45\mathcode`\/47\mathcode`\:603A\relax}
\endgroup

so that the following code can compile in ConTeXt:

\definemathcommand[xyz][nolop]{\newmcodes@
\kern\zeropoint\mfunction{fancy-function-name'*.:}}


Maggyero
___
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
___

[NTG-context] ConTeXt equivalent of \newmcodes@

2015-04-26 Thread Maggyero
Dear list members,

What is the ConTeXt equivalent of the LaTeX function \newmcodes@ defined in
the AMSopn package (this function is used inside \DeclareMathOperator and
\operatorname and has the effect of resetting text-mode punctuation
characters such as *, -, /, :, and ’ in operator names)?

Thank you in advance.
___
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
___