> :> I am searching for a mechanism that will make it possible to make
> :> a command behave differently in a math environment than in a
> :> text environment.
> : TeX: \ifmmode ... \else ... \fi
> : LaTeX: ifthen.sty
> Works like a charm.
The former does not. Well, strictly speaking, it does, but you might
be surprised at what points of time TeX/LaTeX secretly puts a foot
forward in the wrong mode, then surprises you by doing the real thing
in an entirely different mode.
This usually happens at places in array or tabular environments where
*is peeking in order to detect if a column starts with
\multicolumn or \hline or \cline and the like. This peeking often
happens in a different mode than the real typesetting, but then the
harm has already been done.
In order not to have it evaluate \ifmmode in these peeking situations,
you have to place something like \relax before them.
So: TeX: \relax \ifmmode ...
ifthen.sty I know not, so cannot comment on that.
David Kastrup Phone: +49-234-32-25570
Institut fr Neuroinformatik, Universit?tsstr. 150, 44780 Bochum, Germany