本问题是这个问题的 follow-up:
\documentclass{article}
% \usepackage{yhmath}%<---被覆盖,不起作用
\usepackage[no-math]{fontspec}
\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}
\setmathfont[
range={
up/{num,latin,Latin,greek,Greek},
it/{latin,Latin,greek,Greek},
bfup/{num,latin,Latin,greek,Greek},
bfit/{latin,Latin,greek,Greek},
"0021,"002C,"002E,"003B,"003F
}
]{texgyretermes-math.otf}
\usepackage{yhmath}%<---报错
\begin{document}
123abcABC,.;?! +-*/
$123abcABC,.;?!\alpha\beta\Gamma\Delta$
\[
\iint_S \vec{F}\cdot d\vec{S},
\oint_C \vec{B}\cdot d\vec{l},
\sum_{i=1}^{N}a_i,
\prod_{k=1}^{n}(x-x_k)
\]
\[
\begin{bmatrix}
\dfrac{\partial^2 f}{\partial x^2} &
\dfrac{\partial^2 f}
{\partial x \partial y} \\
\dfrac{\partial^2 f}
{\partial x \partial y} &
\dfrac{\partial^2 f}{\partial y^2}
\end{bmatrix}
=
\begin{pmatrix}
a_{11} & a_{12} & \cdots & a_{1n} \\
a_{21} & a_{22} & \cdots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & \cdots & a_{nn}
\end{pmatrix}
\]
\end{document}这会报错:
! LaTeX Error: Command `\arrowvert' already defined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.57 ...athord}{symbols}{"6A}{yhlargesymbols}{"3C}
? 如何在保留unicode-math的拼字体功能的前提下,继续使用yhmath提供的“圆括号”呢?
希望没有什么副作用...
\documentclass{article}
\usepackage[no-math]{fontspec}
\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}
\setmathfont[
range={
up/{num,latin,Latin,greek,Greek},
it/{latin,Latin,greek,Greek},
bfup/{num,latin,Latin,greek,Greek},
bfit/{latin,Latin,greek,Greek},
"0021,"002C,"002E,"003B,"003F
}
]{texgyretermes-math.otf}
\DeclareSymbolFont{yhlargesymbols}{OMX}{yhex}{m}{n}
\Udelcode 40 = \symyhlargesymbols 0
\Udelcode 41 = \symyhlargesymbols 1
\begin{document}
123abcABC,.;?! +-*/
$123abcABC,.;?!\alpha\beta\Gamma\Delta$
\[
\iint_S \vec{F}\cdot d\vec{S},
\oint_C \vec{B}\cdot d\vec{l},
\sum_{i=1}^{N}a_i,
\prod_{k=1}^{n}(x-x_k)
\]
\[
\begin{bmatrix}
\dfrac{\partial^2 f}{\partial x^2} &
\dfrac{\partial^2 f}
{\partial x \partial y} \\
\dfrac{\partial^2 f}
{\partial x \partial y} &
\dfrac{\partial^2 f}{\partial y^2}
\end{bmatrix}
=
\begin{pmatrix}
a_{11} & a_{12} & \cdots & a_{1n} \\
a_{21} & a_{22} & \cdots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & \cdots & a_{nn}
\end{pmatrix}
\]
\end{document}