ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: h h extern <pragma@wxs.nl>
Subject: Re: ConTeXt equivalent for \ensuremath?
Date: Sun, 13 Mar 2005 22:24:16 +0100	[thread overview]
Message-ID: <4234AF80.9020005@wxs.nl> (raw)
In-Reply-To: <3174c268c21997de08d338255598529a@rna.nl>

Gerben Wierda wrote:
> On Mar 11, 2005, at 15:57, Nikolai Weibull wrote:
> 
>>> \newcommand{\ensuremath}[1]{\ifmmode\expandafter\FirtsOfOne%
>>>         \else\expandafter\EnsuredMath\fi}
>>> \long\def\FirstOfOne#1{#1}
>>> \long\def\EnsuredMath#1{$\relax#1$}
>>> \newcommand{\bit}[2]{\ensuremath{\hbox{\tf #1}_\hbox{\tf #2}}}
>>
>>
>>> but is there a ConTeXt way of doing this?
>>
>>
>> \mathematics{...},
>>     nikolai
>>
> 
> Replacing \ensuremath above with \mathematics gives an error (both 
> attempts):
> 
>>> \newcommand{\bit}[2]{\mathematics{\hbox{\tf #1}_\hbox{\tf #2}}}
>>> \newcommand{\bit}[2]{\mathematics{{\hbox{\tf #1}_\hbox{\tf #2}}}}

you now say something like

<text>_\hbox

and since _ kind of takes an argument, it gets an hbox only; you need

<text>_{\hbox{..}}

as in:

\def\bit#1#2{\mathematics{\hbox{\tf#1}_{\hbox{\tf#2}}}}

\bit{1}{2}

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

      parent reply	other threads:[~2005-03-13 21:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-11 14:46 Gerben Wierda
2005-03-11 14:57 ` Nikolai Weibull
2005-03-11 15:54   ` Gerben Wierda
2005-03-11 17:20     ` Adam Lindsay
2005-03-11 18:03       ` Gerben Wierda
2005-03-13 21:24     ` h h extern [this message]

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=4234AF80.9020005@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.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).