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
* 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);}
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
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 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
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 -----------------------------------------------------------------
participants (4)
-
Adam Lindsay
-
Gerben Wierda
-
h h extern
-
Nikolai Weibull