如何在 latex 中添加外部字体路径?当我在 macOS 13.2 中编译 latex(texlive 2023) 文档时,显示错误:
Package fontspec Error: The font "HelveticaNeueLTPro-Md" cannot be found.
我已经尝试将字体放入路径并添加如下路径:
\setmainfont[
Path = /Users/xiaoqiangjiang/Library/texmf/tex/latex/Font,
Extension = .otf,
]{HelveticaNeueLTPro-Md}
仍然无法修复此问题。我应该怎么做才能在 macOS 中添加字体路径?这是文件夹字体列表:
> ll
total 48760
-rw-r--r-- 1 xiaoqiangjiang staff 41K Jun 15 18:28 HelveticaNeueLTPro-Md.otf
-rw-r--r-- 1 xiaoqiangjiang staff 34K Jun 15 18:28 HelveticaNeueLTPro-Roman.otf
-rw-r--r-- 1 xiaoqiangjiang staff 12M Jun 15 18:28 Pro_GB18030.ttf
-rw-r--r-- 1 xiaoqiangjiang staff 12M Jun 15 18:28 Pro_GB18030DemiBold.ttf
我尝试将文件复制到文件夹~/Library/Fonts
,但仍然无法解决此问题。
答案1
将字体放入/Users/.../Library/Fonts/HelveticaNeue/
然后在终端中运行luaotfload-tool --update
。现在文件应该列在
luafindfont helveticaneue
例如:
bash-3.2$ luafindfont helveticaneueltpro
No. Filename Symbolic name Path
1. HelveticaNeueLTPro-Bd.otf helveticaneueltpro /Users/voss/Library/Fonts/Helvetica/
2. HelveticaNeueLTPro-BdCn.otf helveticaneueltpro /Users/voss/Library/Fonts/Helvetica/
3. HelveticaNeueLTPro-BdCnO.otf helveticaneueltpro /Users/voss/Library/Fonts/Helvetica/
4. HelveticaNeueLTPro-BdEx.otf helveticaneueltpro /Users/voss/Library/Fonts/Helvetica/
[...]
或lualatex
将xelatex
找到字体。