# How to define a unicode math symbol available in a unicode math font in terms of a hexadecimal value?

Given that I have a unicode math font with a glyph that I want to use in math mode, how can I, using the unicode-math package, define the glyph? I can get this to kind of work using \DeclareUTFcharacter, but with a resulting "invalid in math mode" warning.

\documentclass{article}
\usepackage{xunicode}
\usepackage{unicode-math}
\setmathfont{XITSMath-Regular.otf}
\DeclareUTFcharacter[\UTFencname]{x24C7}{\circledR} % "LaTeX Warning: Command \circledR invalid in math mode"
%\UnicodeMathSymbol{"024C7}{\circledR} {\mathrel}{circled R}
%\__um_process_symbol_noparse:nnn {"024C7}{\circledR} {\mathbin}
\begin{document}
circleddash: $\circleddash$
\\circledparallel: $\circledparallel$
\\circledR: $\circledR$
\end{document}


I'm not sure there's an official interface; anyway, this works.

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITSMath-Regular.otf}

\Umathchardef\circledR="0 \symsymbols "24C7

\begin{document}

circleddash: $\circleddash$

circledparallel: $\circledparallel$

circledR: $\circledR$

\end{document}


• Thank you @egreg—that's very helpful. Yes, an interface would be useful (as you suggested some 5 years ago)... if someone had the time to implement one. – Daniel J. Greenhoe Nov 26 '20 at 15:43