让unicode-math的range参数兼容yhmath提供的"圆括号"?

发布于 2026-07-27 00:46:04

本问题是这个问题的 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提供的“圆括号”呢?

查看更多

关注者
0
被浏览
17
1 个回答
Sagittarius Rover
Sagittarius Rover 3小时前
这家伙很懒,什么也没写!

希望没有什么副作用...

\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}

image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览