This is a partial re-asking of my question Can I change the font and colour of a letter permanently?. The answers there focussed on the colour aspect of what I wanted. I also want to be able to change the actual font used for a character.
What's the right way to reassign a character to a particular glyph from a particular font?
As a possible (albeit slightly manic) example, suppose I wanted (in maths mode) to use C
just for the set of complex numbers. So typing C
should produce ℂ. I also want to be able to shift the glyphs around, so maybe typing d
should produce δ.
Will's answer to my original question began with:
In regular latex you can choose different fonts for different symbols
but didn't tell me exactly how to do that!
Best Answer
The first argument is the token (control sequences are valid here) you're defining. The second is the class,
\mathord
,\mathbin
,\mathop
,\mathrel
,\mathopen
,\mathclose
,\mathpunct
, and 7 for variable (there's probably some\mathfoo
for variable, but I don't know what it is). The third is the font family. The fourth is the position within that family.As would be expected, this particular case eventually expands to a
\mathcode `C="0.43
. I don't really know what the missing hex digit (the family) is.\mathcode
is one of those mysterious (to me) primitives.I believe the basic format is:
\mathcode `x="cfpp
wherex
is any literal character,c
is the class (0 = ordinary through 7 = variable),f
is the family, andpp
is the position within that family.cfpp
is a hexadecimal value, of course.It occurs to me that you might want to use
7
instead of\mathord
to get a letter in the variable class. I'm not sure. Hopefully someone else can express an opinion on the matter.