# [NTG-context] How to \bf for math?

Taco Hoekwater taco at elvenkind.com
Sat Feb 18 12:56:53 CET 2006

Hans Hagen wrote:

> (concerning the definemathcharacters, we need input from taco on that
> because he knows what goes on deep inside tex and has done complex
> math typesetting for ages)

The \definemathcharacter macro is a actually quite simple, it is
mostly a  syntactic wrapper around \mathcode and \delcode assignments.
See the attached chunk of --module documentation text.

Whether mixed bold/unbold math is feasible depends mostly on two things:
* if bold symbolic fonts are available (math italic, symbol and
extension)
* how you define the variable symbols (latin characters) and
font switches.

Normally, an 'a' is of mathtype 'variable' (7), so that if you do
${\bf a}$, you get a bold (fam 6) one instead of the one from the
math italic (fam 1).
When you redefine its mathcode so it becomes an ord' (0) in a
bold math italic' family (say 'A' or so. You cannot use \bi since
that is a match for \it, and it will not have the same spacing
rules!); afterward it no longer obey font switches.

If you want to get back to the upright version in such a setup,
you have to redefine te \rm command to change the math family code
yet again, to 'ord' in upright math (fam 0), this time.

All this shuffling about with mathcodes is needed because during a
single formula, TeX stores tokens in the form (family id, chararacter).
Only at the very end of the formula are the families themselves
mapped to fonts (and the tokens converted to using those fonts),
so changing the \textfont0 etc. assignments while in the formula
does not help.

I hope this is clear enough.

Cheers, Taco

-------------- next part --------------
A non-text attachment was scrubbed...
Name: definemathcharacter.tex
Type: application/x-tex
Size: 4224 bytes
Desc: not available
Url : http://www.ntg.nl/pipermail/ntg-context/attachments/20060218/8cc6941e/attachment.tex