ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] cont-new.mkiv and \everymathematics
@ 2024-01-20 18:49 Rogers, Michael K
  2024-01-21  9:29 ` [NTG-context] " Hans Hagen via ntg-context
  0 siblings, 1 reply; 2+ messages in thread
From: Rogers, Michael K @ 2024-01-20 18:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

In writing class notes, I frequently make one-letter macros for formatted symbols, such \v and \w for vectors. Generally speaking, one-letter names for function/macros/variables is frowned upon in programming, but I find this localized use very convenient.

In cont-new.mkiv, one finds definitions of \t and \w (via \let) appended to \everymathematics, which overwrites my definition of \w every time TeX enters math mode. I can fix this by appending my definition to \everymathematics. The inefficiency seems minor, and I can live with it. I have a question and a couple of points:

1. Is there a better way than adding the definition to \everymathematics?

2. I don’t think these definitions should be in ConTeXt. Let users add them if they wish. Or add a ‘useshortcuts’ option to \setupmathematics.

3. \t and \w are undocumented, \mathword is undocumented, and it took me a while to track down the bug it created for me. In particular, they overwrote my definition only in math mode, and “\show\w” did not work in math mode. Frustrating.  I could add a wikipage, I suppose, but I’m not proud of the extent of my knowledge: “\mathword{word} typesets “word” in math mode in a normal text font, somewhat like \text{word}, and \w is an abbreviation of it that is added to \everymathematics on startup.” 

Thank you very much,

Michael

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: cont-new.mkiv and \everymathematics
  2024-01-20 18:49 [NTG-context] cont-new.mkiv and \everymathematics Rogers, Michael K
@ 2024-01-21  9:29 ` Hans Hagen via ntg-context
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen via ntg-context @ 2024-01-21  9:29 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

On 1/20/2024 7:49 PM, Rogers, Michael K wrote:
> Hi all,
> 
> In writing class notes, I frequently make one-letter macros for formatted symbols, such \v and \w for vectors. Generally speaking, one-letter names for function/macros/variables is frowned upon in programming, but I find this localized use very convenient.
> 
> In cont-new.mkiv, one finds definitions of \t and \w (via \let) appended to \everymathematics, which overwrites my definition of \w every time TeX enters math mode. I can fix this by appending my definition to \everymathematics. The inefficiency seems minor, and I can live with it. I have a question and a couple of points:
> 
> 1. Is there a better way than adding the definition to \everymathematics?
> 
> 2. I don’t think these definitions should be in ConTeXt. Let users add them if they wish. Or add a ‘useshortcuts’ option to \setupmathematics.
> 
> 3. \t and \w are undocumented, \mathword is undocumented, and it took me a while to track down the bug it created for me. In particular, they overwrote my definition only in math mode, and “\show\w” did not work in math mode. Frustrating.  I could add a wikipage, I suppose, but I’m not proud of the extent of my knowledge: “\mathword{word} typesets “word” in math mode in a normal text font, somewhat like \text{word}, and \w is an abbreviation of it that is added to \everymathematics on startup.”
adding to \everymathematics can work fine as long as you're the last one 
adding

when you overload built in commands,

\enabledirectives[overloadmode=error] % or warning

can give you some protection

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2024-01-21  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-20 18:49 [NTG-context] cont-new.mkiv and \everymathematics Rogers, Michael K
2024-01-21  9:29 ` [NTG-context] " Hans Hagen via ntg-context

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