[NTG-context] \sub conflict with my def

Hans Hagen j.hagen at xs4all.nl
Wed Jan 12 20:14:49 CET 2022


On 1/12/2022 7:34 PM, Gavin via ntg-context wrote:
> Hi List,
> 
> I am converting problem sets from LaTeX to ConTeXt and ran into a puzzling problem. I define \sub to produce subscript text in math mode. (See definition below.) This worked for my ConTeXt book, but fails in the problem sets because in ConTeXt \sub is a special item command, and I use itemize to number problems.
> 
> Obviously, I can rename my \sub command, but it is already used in hundreds of problems and solutions that I am converting. Is there a way to get my \sub to work in an itemize? I only need it in math mode. I will never use \sub for its ConTeXt itemizing purpose.

\appendtoks
     \define[1]\sub{_{\text{\rm\tf#1}}}%
\to \everymathematics

or nicer:

\define[1]\MyMathSub{_{\text{\rm\tf#1}}}

\appendtoks
     \let\sub\MyMathSub
\to \everymathematics


> Thanks!
> Gavin
> 
> 
> \define[1]\sub{_{\text{\rm\tf#1}}}
> 
> \starttext
> 
> $E\sub{final}$ is the final energy, but not in an itemize:
> 
> \startitemize
> \item $E_{\text{\rm final}}$ is the final energy.
> \item $E\sub{final}$ is a mess.
> \stopitemize
> 
> \stoptext
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list