Now that I've gotten Will Robertson's excellent unicode-math package working to change the colour and style of letters in my mathematics (trust me, there is a reason) thanks to his answer to my previous question, I want to figure out how to implement this properly.
The key step seems to be that the command to change how a letter is displayed needs the unicode numerical value of the letter. The example that Will gave was:
\setmathfont[range="66,math-style=upright,Colour=FF0000]{xits-math.otf}
(font name changed to work with xelatex as per Will's comment on that question) which changes the letter e. But I want a command that I can invoke as \type{constR}{e} (which should declare e to be a constant real number). So I need to convert e to its unicode value.
Now it seems possible that there isn't a general "charater to unicode" command, so I'd be content if I could convert a standard letter to some number since the characters that I'm most going to use this on are the alphanumerics. Thus:
What's the best way to convert an alphanumerical character to a position in the alphabet?
unicode-math! Both directly and via a wrapper macro. – Andrew Stacey Sep 07 '10 at 11:43\expandafter\@gobble\string\%could help. Of course put in a macro. – Donald Arseneau May 11 '20 at 07:07