ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* ConTeXt equivalent of \newmcodes@
@ 2015-04-27 19:14 Maggyero
  2015-04-27 20:44 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Maggyero @ 2015-04-27 19:14 UTC (permalink / raw)
  To: ntg-context


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

> 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

[-- Attachment #1.2: Type: text/html, Size: 1654 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: ConTeXt equivalent of \newmcodes@
  2015-04-27 19:14 ConTeXt equivalent of \newmcodes@ Maggyero
@ 2015-04-27 20:44 ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2015-04-27 20:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

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

* ConTeXt equivalent of \newmcodes@
@ 2015-04-27 21:47 Maggyero
  0 siblings, 0 replies; 7+ messages in thread
From: Maggyero @ 2015-04-27 21:47 UTC (permalink / raw)
  To: ntg-context


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

> \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

[-- Attachment #1.2: Type: text/html, Size: 1342 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: ConTeXt equivalent of \newmcodes@
  2015-04-27 13:20 Maggyero
@ 2015-04-27 13:55 ` Aditya Mahajan
  0 siblings, 0 replies; 7+ messages in thread
From: Aditya Mahajan @ 2015-04-27 13:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

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

* ConTeXt equivalent of \newmcodes@
@ 2015-04-27 13:20 Maggyero
  2015-04-27 13:55 ` Aditya Mahajan
  0 siblings, 1 reply; 7+ messages in thread
From: Maggyero @ 2015-04-27 13:20 UTC (permalink / raw)
  To: ntg-context


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

> 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

[-- Attachment #1.2: Type: text/html, Size: 2224 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: ConTeXt equivalent of \newmcodes@
  2015-04-26 22:13 Maggyero
@ 2015-04-27  7:37 ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2015-04-27  7:37 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

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

* ConTeXt equivalent of \newmcodes@
@ 2015-04-26 22:13 Maggyero
  2015-04-27  7:37 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Maggyero @ 2015-04-26 22:13 UTC (permalink / raw)
  To: ntg-context


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

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.

[-- Attachment #1.2: Type: text/html, Size: 393 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

end of thread, other threads:[~2015-04-27 21:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-27 19:14 ConTeXt equivalent of \newmcodes@ Maggyero
2015-04-27 20:44 ` Hans Hagen
  -- strict thread matches above, loose matches on Subject: below --
2015-04-27 21:47 Maggyero
2015-04-27 13:20 Maggyero
2015-04-27 13:55 ` Aditya Mahajan
2015-04-26 22:13 Maggyero
2015-04-27  7:37 ` Hans Hagen

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).