使用setmathfont设置部分字符使用字体未实现的问题

发布于 2021-08-05 09:15:31

我想让正文部分的字体和公式部分的字体一致
因为setmathfont只能使用带有数学部分的字体,所以我把Latin Modern Math中的数字和字母部分改成了我想使用的字体(NEU-BZ),NEU-BZ-Math是我改过之后的字体,然后在设置字体的时候只让应用我修改的部分。

unicode-math关于setmathfont的叙述:

4.1 Using multiple fonts
There will probably be few cases where a single Unicode maths font suffices (sim- ply due to glyph coverage). The STIX font comes to mind as a possible exception. It will therefore be necessary to delegate specific Unicode ranges of glyphs to sep- arate fonts:
setmathfont{ ⟨font name⟩ }[range= ⟨unicode range⟩ , ⟨font features⟩ ]
where ⟨unicode range⟩ is a comma-separated list of Unicode slot numbers and ranges such as {"27D0-"27EB,"27FF,"295B-"297F}. Note that TEX’s syntax for ac- cessing the slot number of a character, such as `+, will also work here. Only nu- merical slots can be used in ranged declarations.
Note that, for efficiency, the unicode-math package only loads a default maths setup when absolutely necessary. Before you use the range option you must first load a ‘main’ maths font in the standard way.
You may also use the macro for accessing the glyph, such as range=int, or whole collection of symbols with the same math type, such as range=mathopen, or complete math styles such as range=symbb (or just range=bb).

这是两个字体
自己改的:
NEU-BZ-Math.otf

原版:
latinmodern-math.otf

在写这个提问的时候,群友告诉我要加上「{}」,之后的MWE:

% -*- coding: utf-8 -*-
% !TEX program = xelatex
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont{NEU-BZ-Math}[range={"0030-"0039,"0041-"005A,"0061-"007A}]
\setmainfont{NEU-BZ}
\begin{document}
    Test,ABCDEFG
    
    $Test,ABCDEFG$    
\end{document}

这次没有报错了,但是并没有实现,
编译结果(这是LaTeX编译的):image.png
希望结果(不是LaTeX编译的):image.png

查看更多

关注者
0
被浏览
2.3k
-XM-
-XM- 2021-08-05
这家伙很懒,什么也没写!

[range={"0030-"0039,"0041-"005A,"0061-"007A}] 改成 [range=it] 试试

1 个回答

撰写答案

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

发布
问题

分享
好友

手机
浏览

扫码手机浏览