ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: \sub conflict with my def
Date: Wed, 12 Jan 2022 20:14:49 +0100	[thread overview]
Message-ID: <e0586a8b-bed5-dba9-14f5-e1073976b2f4@xs4all.nl> (raw)
In-Reply-To: <F17EC1C6-EA76-42BB-B327-C8841969F7DA@comcast.net>

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
___________________________________________________________________________________

  reply	other threads:[~2022-01-12 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 18:34 Gavin via ntg-context
2022-01-12 19:14 ` Hans Hagen via ntg-context [this message]
2022-01-13 12:19   ` Gavin via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0586a8b-bed5-dba9-14f5-e1073976b2f4@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).