This is a follow-up question to Using ANY Stix Two Math OTF character in text and math modes without loading it as math font.
Using David Carlisle's method, I made the following package file:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{Stix2OTFCalligraphic}[07/01/2023]
\newfontface\StixTwoMathZero{STIXTwoMath-Regular.otf}[NFSSFamily=stixtwocal,Script=Math]
\DeclareSymbolFont{stixtwocal}{TU}{stixtwocal}{m}{n}
\Umathchardef\stixc@lA "0 \symstixtwocal "1D49C
\Umathchardef\stixc@lB "0 \symstixtwocal "0212C
\Umathchardef\stixc@lC "0 \symstixtwocal "1D49E
\Umathchardef\stixc@lD "0 \symstixtwocal "1D49F
\Umathchardef\stixc@lE "0 \symstixtwocal "02130
\Umathchardef\stixc@lF "0 \symstixtwocal "02131
\Umathchardef\stixc@lG "0 \symstixtwocal "1D4A2
\Umathchardef\stixc@lH "0 \symstixtwocal "0210B
\Umathchardef\stixc@lI "0 \symstixtwocal "02110
\Umathchardef\stixc@lJ "0 \symstixtwocal "1D4A5
\Umathchardef\stixc@lK "0 \symstixtwocal "1D4A6
\Umathchardef\stixc@lL "0 \symstixtwocal "02112
\Umathchardef\stixc@lM "0 \symstixtwocal "02133
\Umathchardef\stixc@lN "0 \symstixtwocal "1D4A9
\Umathchardef\stixc@lO "0 \symstixtwocal "1D4AA
\Umathchardef\stixc@lP "0 \symstixtwocal "1D4AB
\Umathchardef\stixc@lQ "0 \symstixtwocal "1D4AC
\Umathchardef\stixc@lR "0 \symstixtwocal "0211B
\Umathchardef\stixc@lS "0 \symstixtwocal "1D4AE
\Umathchardef\stixc@lT "0 \symstixtwocal "1D4AF
\Umathchardef\stixc@lU "0 \symstixtwocal "1D4B0
\Umathchardef\stixc@lV "0 \symstixtwocal "1D4B1
\Umathchardef\stixc@lW "0 \symstixtwocal "1D4B2
\Umathchardef\stixc@lX "0 \symstixtwocal "1D4B3
\Umathchardef\stixc@lY "0 \symstixtwocal "1D4B4
\Umathchardef\stixc@lZ "0 \symstixtwocal "1D4B5
\Umathchardef\stixc@la "0 \symstixtwocal "1D4B6
\Umathchardef\stixc@lb "0 \symstixtwocal "1D4B7
\Umathchardef\stixc@lc "0 \symstixtwocal "1D4B8
\Umathchardef\stixc@ld "0 \symstixtwocal "1D4B9
\Umathchardef\stixc@le "0 \symstixtwocal "0212F
\Umathchardef\stixc@lf "0 \symstixtwocal "1D4BB
\Umathchardef\stixc@lg "0 \symstixtwocal "0210A
\Umathchardef\stixc@lh "0 \symstixtwocal "1D4BD
\Umathchardef\stixc@li "0 \symstixtwocal "1D4BE
\Umathchardef\stixc@lj "0 \symstixtwocal "1D4BF
\Umathchardef\stixc@lk "0 \symstixtwocal "1D4C0
\Umathchardef\stixc@ll "0 \symstixtwocal "1D4C1
\Umathchardef\stixc@lm "0 \symstixtwocal "1D4C2
\Umathchardef\stixc@ln "0 \symstixtwocal "1D4C3
\Umathchardef\stixc@lo "0 \symstixtwocal "02134
\Umathchardef\stixc@lp "0 \symstixtwocal "1D4C5
\Umathchardef\stixc@lq "0 \symstixtwocal "1D4C6
\Umathchardef\stixc@lr "0 \symstixtwocal "1D4C7
\Umathchardef\stixc@ls "0 \symstixtwocal "1D4C8
\Umathchardef\stixc@lt "0 \symstixtwocal "1D4C9
\Umathchardef\stixc@lu "0 \symstixtwocal "1D4CA
\Umathchardef\stixc@lv "0 \symstixtwocal "1D4CB
\Umathchardef\stixc@lw "0 \symstixtwocal "1D4CC
\Umathchardef\stixc@lx "0 \symstixtwocal "1D4CD
\Umathchardef\stixc@ly "0 \symstixtwocal "1D4CE
\Umathchardef\stixc@lz "0 \symstixtwocal "1D4CF
\Umathchardef\stixc@lbfA "0 \symstixtwocal "1D4D0
\Umathchardef\stixc@lbfB "0 \symstixtwocal "1D4D1
\Umathchardef\stixc@lbfC "0 \symstixtwocal "1D4D2
\Umathchardef\stixc@lbfD "0 \symstixtwocal "1D4D3
\Umathchardef\stixc@lbfE "0 \symstixtwocal "1D4D4
\Umathchardef\stixc@lbfF "0 \symstixtwocal "1D4D5
\Umathchardef\stixc@lbfG "0 \symstixtwocal "1D4D6
\Umathchardef\stixc@lbfH "0 \symstixtwocal "1D4D7
\Umathchardef\stixc@lbfI "0 \symstixtwocal "1D4D8
\Umathchardef\stixc@lbfJ "0 \symstixtwocal "1D4D9
\Umathchardef\stixc@lbfK "0 \symstixtwocal "1D4DA
\Umathchardef\stixc@lbfL "0 \symstixtwocal "1D4DB
\Umathchardef\stixc@lbfM "0 \symstixtwocal "1D4DC
\Umathchardef\stixc@lbfN "0 \symstixtwocal "1D4DD
\Umathchardef\stixc@lbfO "0 \symstixtwocal "1D4DE
\Umathchardef\stixc@lbfP "0 \symstixtwocal "1D4DF
\Umathchardef\stixc@lbfQ "0 \symstixtwocal "1D4E0
\Umathchardef\stixc@lbfR "0 \symstixtwocal "1D4E1
\Umathchardef\stixc@lbfS "0 \symstixtwocal "1D4E2
\Umathchardef\stixc@lbfT "0 \symstixtwocal "1D4E3
\Umathchardef\stixc@lbfU "0 \symstixtwocal "1D4E4
\Umathchardef\stixc@lbfV "0 \symstixtwocal "1D4E5
\Umathchardef\stixc@lbfW "0 \symstixtwocal "1D4E6
\Umathchardef\stixc@lbfX "0 \symstixtwocal "1D4E7
\Umathchardef\stixc@lbfY "0 \symstixtwocal "1D4E8
\Umathchardef\stixc@lbfZ "0 \symstixtwocal "1D4E9
\Umathchardef\stixc@lbfa "0 \symstixtwocal "1D4EA
\Umathchardef\stixc@lbfb "0 \symstixtwocal "1D4EB
\Umathchardef\stixc@lbfc "0 \symstixtwocal "1D4EC
\Umathchardef\stixc@lbfd "0 \symstixtwocal "1D4ED
\Umathchardef\stixc@lbfe "0 \symstixtwocal "1D4EE
\Umathchardef\stixc@lbff "0 \symstixtwocal "1D4EF
\Umathchardef\stixc@lbfg "0 \symstixtwocal "1D4F0
\Umathchardef\stixc@lbfh "0 \symstixtwocal "1D4F1
\Umathchardef\stixc@lbfi "0 \symstixtwocal "1D4F2
\Umathchardef\stixc@lbfj "0 \symstixtwocal "1D4F3
\Umathchardef\stixc@lbfk "0 \symstixtwocal "1D4F4
\Umathchardef\stixc@lbfl "0 \symstixtwocal "1D4F5
\Umathchardef\stixc@lbfm "0 \symstixtwocal "1D4F6
\Umathchardef\stixc@lbfn "0 \symstixtwocal "1D4F7
\Umathchardef\stixc@lbfo "0 \symstixtwocal "1D4F8
\Umathchardef\stixc@lbfp "0 \symstixtwocal "1D4F9
\Umathchardef\stixc@lbfq "0 \symstixtwocal "1D4FA
\Umathchardef\stixc@lbfr "0 \symstixtwocal "1D4FB
\Umathchardef\stixc@lbfs "0 \symstixtwocal "1D4FC
\Umathchardef\stixc@lbft "0 \symstixtwocal "1D4FD
\Umathchardef\stixc@lbfu "0 \symstixtwocal "1D4FE
\Umathchardef\stixc@lbfv "0 \symstixtwocal "1D4FF
\Umathchardef\stixc@lbfw "0 \symstixtwocal "1D500
\Umathchardef\stixc@lbfx "0 \symstixtwocal "1D501
\Umathchardef\stixc@lbfy "0 \symstixtwocal "1D502
\Umathchardef\stixc@lbfz "0 \symstixtwocal "1D503
\def\ifiscseq#1{\ifcat$\expandafter@gobble\string#1$\expandafter@secondoftwo\else\expandafter@firstoftwo\fi}
\def\stix@@cal#1#2@nil{%
\ifiscseq{#1}{\ifcsdef{stixc@l@xp@gobble\string#1}{\csname stixc@l@xp@gobble\string#1\endcsname}{#1}}{%not a cs
\csname stixc@l#1\endcsname}
\ifblank{#2}{\relax}{\stix@@cal #2@nil}}
\def\stix@@calbf#1#2@nil{%
\ifiscseq{#1}{\ifcsdef{stixc@lbf@xp@gobble\string#1}{\csname stixc@lbf@xp@gobble\string#1\endcsname}{#1}}{%not a cs
\csname stixc@lbf#1\endcsname}
\ifblank{#2}{\relax}{\stix@@calbf #2@nil}}
\DeclareRobustCommand{\stixcal}[1]{\stix@@cal#1@nil}
\DeclareRobustCommand{\stixcalbf}[1]{\stix@@calbf#1@nil}
This works beautifully. I know there is probably a way to make it cleaner, and I welcome input in that regard.
Now, if I add
\newfontface\StixTwoMathOne{STIXTwoMath-Regular.otf}[NFSSFamily=stixtwochan,Script=Math,StylisticSet=1]
\DeclareSymbolFont{stixtwochan}{TU}{stixtwochan}{m}{n}
and
\def\stix@@chan#1#2\@nil{%
\ifiscseq{#1}{\ifcsdef{stixch@n\@xp\@gobble\string#1}{\csname stixch@n\@xp\@gobble\string#1\endcsname}{#1}}{%not a cs
\csname stixch@n#1\endcsname}
\ifblank{#2}{\relax}{\stix@@chan #2\@nil}}
\def\stix@@chanbf#1#2@nil{%
\ifiscseq{#1}{\ifcsdef{stixch@nbf@xp@gobble\string#1}{\csname stixch@nbf@xp@gobble\string#1\endcsname}{#1}}{%not a cs
\csname stixch@nbf#1\endcsname}
\ifblank{#2}{\relax}{\stix@@chanbf #2@nil}}
\DeclareRobustCommand{\stixchan}[1]{\stix@@chan#1@nil}
\DeclareRobustCommand{\stixchanbf}[1]{\stix@@chanbf#1@nil}
at the bottom and the entire gamut of lines of the form
\Umathchardef\stixch@nA "0 \symstixtwochan "1D49C
in between, I get a plethora of errors beginning with
\symstixtwocal=\mathgroup15
! LaTeX Error: Too many symbol fonts declared.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.7 ...bolFont{stixtwochan}{TU}{stixtwochan}{m}{n}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
! Undefined control sequence.
l.117 \Umathchardef\stixch@nA "0 \symstixtwochan
"1D49C
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), typeI' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Bad math family (119964).
l.117 ...ardef\stixch@nA "0 \symstixtwochan "1D49C
Since I expected to read a number between 0 and 255,
I changed this one to zero.
! Missing number, treated as zero.
<to be read again>
\Umathchardef
l.118 \Umathchardef
\stixch@nB "0 \symstixtwochan "0212C
A number should have been here; I inserted 0'. (If you can't figure out why I needed to see a number, look upweird error' in the index to The TeXbook.)
I've included what I think is relevant. The errors that follow are repetitive and I think they all (including the last three shown) stem from the very first error because the 17th mathgroup is never declared.
This entire effort has been aimed at getting around this limitation. Again, I am using XeTeX to compile with fontspec, not unicode-math, because I do not wish to replace MathTime Pro II as my math font. All my text fonts are OpenType. I am trying to move as many non-mtpro2 math fonts to OpenType as possible. What am I doing wrong?
\Umathchardef\stixc@lJ "0 \symstixtwocal "1D4A5which you did post are relevant to this error. Just a single self contained code block would be enough – David Carlisle Jul 02 '23 at 11:55