ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \sub conflict with my def
@ 2022-01-12 18:34 Gavin via ntg-context
  2022-01-12 19:14 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Gavin via ntg-context @ 2022-01-12 18:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gavin

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.

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@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
___________________________________________________________________________________

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

* Re: \sub conflict with my def
  2022-01-12 18:34 \sub conflict with my def Gavin via ntg-context
@ 2022-01-12 19:14 ` Hans Hagen via ntg-context
  2022-01-13 12:19   ` Gavin via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen via ntg-context @ 2022-01-12 19:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

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@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
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \sub conflict with my def
  2022-01-12 19:14 ` Hans Hagen via ntg-context
@ 2022-01-13 12:19   ` Gavin via ntg-context
  0 siblings, 0 replies; 3+ messages in thread
From: Gavin via ntg-context @ 2022-01-13 12:19 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Gavin, mailing list for ConTeXt users

Thanks, Hans! Appending to \everymathematics is a powerful trick, which I will not overuse.

-Gavin

> On Jan 12, 2022, at 12:14 PM, Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
> 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@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
> -----------------------------------------------------------------

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2022-01-13 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12 18:34 \sub conflict with my def Gavin via ntg-context
2022-01-12 19:14 ` Hans Hagen via ntg-context
2022-01-13 12:19   ` Gavin 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).