[NTG-context] small caps italic and font switching inside math

Thu Jun 29 07:13:12 CEST 2006

On Thu, 29 Jun 2006, Mojca Miklavec wrote:

> On 6/28/06, Taco Hoekwater wrote:
>>> Some catcode trickery might work. This is all I could manage.
>>
>> This does not work well, because
>>
>>         HSO\low{4}\high{-}
>>
>> is not correct.
>
> True, but if I'm aware of it, I can use \lohi{4}{$-$} if needed, which
> works even better in some cases, see below.

Or use some more catcode trickery to ensure that - is equivalent to
\mathematics{-} ;)

> I converted the document from LaTeX and I didn't came to the idea of
> using low and high (perhaps just because that's "not possible"
> there).

Latex is not all that bad :) It has \textsuperscript and
\textsubscript (though most people still write 29$^\text{th}$ June
rather than 29\textsuperscipt{th} June)

> You could compare it to {\bf How to loose a guy in $10$ days}.
>
> I have a strange feeling that handling fonts in math is rather
> limited, but no knowledge how to fix anything (just remembering that I
> still don't know how to properly switch to bold math with some other
> fancy font except with dirty tricks).

The wrapping in \hbox is not that bad. A lot of math trickery happens
inside a \hbox. The example on contextgarden
(http://wiki.contextgarden.net/Bold_Math) is not too different from
how bm.sty implements bold symbols in latex (which is the best bold
math implementation in latex, AIUI). However, the \boldmath definition
on contextgarden lacks

1. Use of pmb (poor man's bold) when a true bold character is not
present. \boldsymbol{\sum} does not work.

2. Does not take care of the math spacing

\formula{ a \boldsymbol{=} a } does not look correct.

3. Does not take care of delimiters

\formula { \boldsymbol{\left(}\frac 1n\right)} does not work.

4. bm.sty goes into some trouble to define bold accents. So
\bm{\hat}{a} produces a bold accent over a non-bold a. (I can not
understand why would someone ever use that).

Hans, why is [boldmath] not defined by default in all the typescripts?

> I guess that it should be possible to remember the font before
> switching to math and then switch to that font again, but that's all
> black magic for me. A site on ConTeXt garden solves that for titles in
> such a way that there's an additional command provided which also
> appends bold to all the mathematics in titles, but that's useful for
> titles only.

It can be used everywhere. For example

\def\myrmbf{\boldmath\rm\bf}

{\myrmbf How to loose a guy in $10$ days}

It will be nice if one could write

\def\mybf{\boldmath\previousfont\bf}

Maybe what is needed is a \beforemathswitch token set. Then one could
do

\appendtoks \boldmath to \beforemathswitch