\documentclass{article}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes}
\setmathfont{TeX Gyre Termes Math}
\begin{document}
Linear equation \(\sqrt{x+y}=2\)
\end{document}
当我使用 xelatex 运行此代码时,出现以下错误
"(Font) OMX/cmex/m/n --> EU1/TeXGyreTermesMath(2)/bx/n on input
line 4.
! Undefined control sequence.
\um_set_mathcode:nnn #1#2#3->\Umathcode
\int_eval:n {#1}=\mathchar@type #2\c...
l.4 \setmathfont{TeX Gyre Termes Math}
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'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation."
...
l.4 \setmathfont{TeX Gyre Termes Math}
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Missing character: There is no ^^@ in font TeX Gyre Termes/ICU:script=latn;lang
uage=DFLT;!
! Undefined control sequence.
\um_set_mathcode:nnn #1#2#3->\Umathcode
\int_eval:n {#1}=\mathchar@type #2\c...
l.4 \setmathfont{TeX Gyre Termes Math}
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'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
Missing character: There is no ^^@ in font TeX Gyre Termes/ICU:script=latn;lang
uage=DFLT;!