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
___________________________________________________________________________________

Reply via email to