* ConTeXt equivalent for \ensuremath?
@ 2005-03-11 14:46 Gerben Wierda
2005-03-11 14:57 ` Nikolai Weibull
0 siblings, 1 reply; 6+ messages in thread
From: Gerben Wierda @ 2005-03-11 14:46 UTC (permalink / raw)
I modeled this after the LaTeX sources because I had to move on:
\newcommand{\ensuremath}[1]{\ifmmode\expandafter\FirtsOfOne%
\else\expandafter\EnsuredMath\fi}
\long\def\FirstOfOne#1{#1}
\long\def\EnsuredMath#1{$\relax#1$}
but is there a ConTeXt way of doing this?
G
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ConTeXt equivalent for \ensuremath?
2005-03-11 14:46 ConTeXt equivalent for \ensuremath? Gerben Wierda
@ 2005-03-11 14:57 ` Nikolai Weibull
2005-03-11 15:54 ` Gerben Wierda
0 siblings, 1 reply; 6+ messages in thread
From: Nikolai Weibull @ 2005-03-11 14:57 UTC (permalink / raw)
* Gerben Wierda (Mar 11, 2005 15:50):
> I modeled this after the LaTeX sources because I had to move on:
> \newcommand{\ensuremath}[1]{\ifmmode\expandafter\FirtsOfOne%
> \else\expandafter\EnsuredMath\fi} \long\def\FirstOfOne#1{#1}
> \long\def\EnsuredMath#1{$\relax#1$}
> but is there a ConTeXt way of doing this?
\mathematics{...},
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ConTeXt equivalent for \ensuremath?
2005-03-11 14:57 ` Nikolai Weibull
@ 2005-03-11 15:54 ` Gerben Wierda
2005-03-11 17:20 ` Adam Lindsay
2005-03-13 21:24 ` h h extern
0 siblings, 2 replies; 6+ messages in thread
From: Gerben Wierda @ 2005-03-11 15:54 UTC (permalink / raw)
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}}}}
> ! Missing { inserted.
> <to be read again>
> \hbox
> <argument> \hbox {\tf b}_\hbox
> {\tf off}
> \mathematics #1->\relax \ifmmode #1\else $#1
> $\fi
> l.53 ...er off or on, lets call these \bit{b}{off}
> and
But my way also doesn't work. I get empty output as a result of the
\bit{b}{off} command.
Help?
G
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ConTeXt equivalent for \ensuremath?
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
1 sibling, 1 reply; 6+ messages in thread
From: Adam Lindsay @ 2005-03-11 17:20 UTC (permalink / raw)
Gerben Wierda said this at Fri, 11 Mar 2005 16:54:38 +0100:
>But my way also doesn't work. I get empty output as a result of the
>\bit{b}{off} command.
>
>Help?
This is probably not satisfying, because you probably want to get new
mathematics commands working, but if this is to be used solely in text,
you could use (or expand to):
b\low{off}
\low (and \hi and \lohi) look like they work robustly in both math and
text modes.
I'm a bit confused by you using \newcommand in your (ConTeXt?) examples,
though...
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk
Lancaster University, InfoLab21 +44(0)1524/510.514
Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ConTeXt equivalent for \ensuremath?
2005-03-11 17:20 ` Adam Lindsay
@ 2005-03-11 18:03 ` Gerben Wierda
0 siblings, 0 replies; 6+ messages in thread
From: Gerben Wierda @ 2005-03-11 18:03 UTC (permalink / raw)
On Mar 11, 2005, at 18:20, Adam Lindsay wrote:
> Gerben Wierda said this at Fri, 11 Mar 2005 16:54:38 +0100:
>
>> But my way also doesn't work. I get empty output as a result of the
>> \bit{b}{off} command.
>>
>> Help?
>
> This is probably not satisfying, because you probably want to get new
> mathematics commands working, but if this is to be used solely in text,
> you could use (or expand to):
> b\low{off}
>
> \low (and \hi and \lohi) look like they work robustly in both math and
> text modes.
I'll see. I wonder if it will look the same. Especially in terms of
font. Do I get the same font in both sides? Do I get the same kerning?
> I'm a bit confused by you using \newcommand in your (ConTeXt?)
> examples,
> though...
Yes, strange, isn't it? It just works. I copied one accidentally over
and it worked. So I kept using it.
G
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ConTeXt equivalent for \ensuremath?
2005-03-11 15:54 ` Gerben Wierda
2005-03-11 17:20 ` Adam Lindsay
@ 2005-03-13 21:24 ` h h extern
1 sibling, 0 replies; 6+ messages in thread
From: h h extern @ 2005-03-13 21:24 UTC (permalink / raw)
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-03-13 21:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-11 14:46 ConTeXt equivalent for \ensuremath? 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 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).