First a little background. I am using MathTime Pro II (which is not an OpenType Font) as my math font and do not want to replace it. I think this precludes my loading unicode-math if I want to use the OTF versions of all other fonts. I am successfully using the OTF versions of TeX Gyre Termes for Roman, TeX Gyre Heros for sans serif, and Microsoft's Consolas for typewriter. Obviously, I am compiling with XeTeX and using fontspec but not unicode-math.

Now to the specifics of my question(s) (which was difficult to condense into the question title). I have figured out how to access individual characters from the OTF version of Stix Two Math using, for instance, {{fontspec{STIX Two Math}\char"27D3}}, although I am not sure this will work in math mode (I am using that particular character as a type of QED symbol and it is in text mode). So my first question is:

  • Will this work in math mode? If not, what alteration do I need to make to get this to work in math mode?

I have not figured out how to access characters with codes above FFFF. The errors I was getting led me to Bad Character Code Error in Math Mode for Unicode Character, where I thought I had found the answer; despite numerous attempts, I have been unable to wrestle that code into a form that solves my problem. So my second question is:

  • How can I access characters with codes above FFFF in the Stix Two Math OTF font (or any font, for that matter)?

I realize this is a multifaceted question but was afraid breaking it up into two questions would obfuscate the answer. I hope I have successfully provided the setting and what I am trying to accomplish. Ultimately, I want the entire Stix Two Math OTF font available to me without having to replace MathTime Pro II. I will likely only need a few characters at a time.


2 Answers 2


You haven't shown what you did, or what error you got.

This shows stix two math alongside latin modern tfm fonts, mathtime would be the same.

enter image description here





\Umathchardef\myA "0 \symstixtwomath "1D400


{\StixTwoMath \char"1D400 / 𝐀}

\[ \myA \neq A \]

  • I'm sorry. The working code was only one line: \newcommand\defend{{\fontspec{STIX Two Math}\char"27D3}}. But as I said, this was text mode.
    – Mike Pugh
    Jul 1, 2023 at 16:43
  • But your code worked! How does this method affect the number of font families? It was trying to escape the limit of 16 from the original TeX that motivated the move to XeTeX and unicode fonts in the first place. Thank you for the answer!
    – Mike Pugh
    Jul 1, 2023 at 16:46
  • @MikePugh classic tex has 16 families of 256 characters, xetex has 256 families of up to (a bit less than) 1114111 characters each. The limit is harder to reach Jul 1, 2023 at 16:58

Here is a math-mode \stixtwosymbol command (based on \boldsymbol from amsbsy) that replaces any arbitrary symbol with the one from STIX Two Math. it also creates a \mathversion{stixtwo} and a \stixtwomath, which work just like \mathversion{bold} and \boldmath.


\setmathfont{New Computer Modern Math Book}
\setmathfont{STIX Two Math}[version=stixtwo]

%% Based on the definition of \boldsymbol from amsbsy.sty"
  \let\@nomath\@gobble \mathversion{stixtwo}%

\noindent\( x \triangleright y \)\\
\( x \stixtwosymbol{\triangleright} y\)

STIX Two Sample

You could instead use any arbitrary text-mode command, including setting the font family followed by \symbol{"123A}, by wrapping it in \text from amsmath (or amstext). If you need it to have any spacing other than \mathord, you need to wrap it again in the math class, such as,

\newfontface\symbolfont{STIX Two Math}

However, a frame challenge: if what you really want is to use certain symbols from a different math font, consistently, use the range= option from unicode-math:

\setmathfont{New Computer Modern Math Book} % Or your font of choice
\setmathfont{STIX Two Math}[range={\triangleleft,\triangleright}]

You can also set ranges and alphabets, and use hex or decimal Unicode codepoints instead of symbolic names. So, for example

\setmathfont{STIX Two Math}[StylisticSet=8, range={"222B-"2233,"2A0B-"2A1C}]

changes all the integrals to upright, or

\setmathfont{STIX Two Math}[StylisticSet=1, range={scr, bfscr}]

changes the \mathscr and \mathbfscr alphabets from a copy of \mathcal to a script font.

  • My concern with using unicode-math is that (I believe) it requires that one load a unicode math font, which MathTime Pro II is not. If I am wrong about this, I would appreciate being set straight.
    – Mike Pugh
    Jul 1, 2023 at 20:42
  • @MikePugh That’s correct. The second approach (\mathbin{\text{\symbolfont\symbol{...}}} will work in that case.
    – Davislor
    Jul 1, 2023 at 20:58
  • @MikePugh Although, if you want to load a number of math symbols this way, it might be better to \DeclareSymbolFont with an encoding of TU and then \DeclareMathSymbol.
    – Davislor
    Jul 1, 2023 at 21:01
  • @MikePugh Or import the symbol from the Type 1 stix2 package.
    – Davislor
    Jul 1, 2023 at 21:07
  • Yes, I have taken the \DeclareMathSymbol approach using the Type 1 version of Stix2 package in the past. The latest version of that package is supposed to be the last, so I thought it was time to move as much as I can to unicode. I just cannot bring myself to replace MathTime Pro II.
    – Mike Pugh
    Jul 1, 2023 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .