我想在我的 XeLaTeX 源.otf
目录中本地安装一些字体./fonts
。在 Mac Mojave 上使用 TeXShop/TexLive 的标准安装 XeLaTeX 是可行的(请参阅)。无论是默认路径( )还是本地路径( ) essai1.tex
,将路径和扩展名添加到包\setmathfont
的命令中unicode-math
都不起作用。essai2.tex
essai3.tex
$ cat essai1.tex
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Minion Math}[
SizeFeatures = {
{Size = -6.01, Font = MinionMath-Tiny},
{Size = 6.01-8.41, Font = MinionMath-Capt},
{Size = 8.41-13.01, Font = MinionMath-Regular},
{Size = 13.01-19.91, Font = MinionMath-Subh},
{Size = 19.91-, Font = MinionMath-Disp}
}]
\begin{document}
\XeTeXtracingfonts=1\relax
\fontspec{MinionMath-Regular}{\symbol{8594}}
\end{document}
$ xelatex essai1.tex > /dev/null
$ grep " ->" essai1.log
-> /Users/.../Library/Fonts/MinionMath-Regular.otf
...
$ cat essai2.tex
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Minion Math}[
Extension = .otf ,
Path = /Users/.../Library/Fonts/ ,
SizeFeatures = {
{Size = -6.01, Font = MinionMath-Tiny},
{Size = 6.01-8.41, Font = MinionMath-Capt},
{Size = 8.41-13.01, Font = MinionMath-Regular},
{Size = 13.01-19.91, Font = MinionMath-Subh},
{Size = 19.91-, Font = MinionMath-Disp}
}]
\begin{document}
\XeTeXtracingfonts=1\relax
\fontspec{MinionMath-Regular}{\symbol{8594}}
\end{document}
$ xelatex essai2.tex > /dev/null
kpathsea:make_tex: Invalid filename `[/Users/.../Library/Fonts/Minion Math.otf]/OT', contains '['
^D
$ ls /Users/.../Library/Fonts/MinionMath-*
/Users/.../Library/Fonts/MinionMath-Bold.otf /Users/.../Library/Fonts/MinionMath-MediumSubh.otf
...
$ cat essai3.tex
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Minion Math}[
Extension = .otf ,
Path = ./fonts/ ,
SizeFeatures = {
{Size = -6.01, Font = MinionMath-Tiny},
{Size = 6.01-8.41, Font = MinionMath-Capt},
{Size = 8.41-13.01, Font = MinionMath-Regular},
{Size = 13.01-19.91, Font = MinionMath-Subh},
{Size = 19.91-, Font = MinionMath-Disp}
}]
\begin{document}
\XeTeXtracingfonts=1\relax
\fontspec{MinionMath-Regular}{\symbol{8594}}
\end{document}
$ xelatex essai3.tex > /dev/null
kpathsea:make_tex: Invalid filename `[./fonts/Minion Math.otf]/OT', contains '['
^D
$ ls ./fonts/MinionMath*
./fonts/MinionMath-Capt.otf ./fonts/MinionMath-Semibold.otf ./fonts/MinionMath-SemiboldTiny.otf
...
答案1
解决方案是
\documentclass{文章} \usepackage{字体规格} \usepackage{unicode-math} \defaultfontfeatures[MinionMath-常规] { 路径 = {./fonts/} , 扩展名 = .otf } \defaultfontfeatures[MinionMath-粗体] { 路径 = {./fonts/} , 扩展名 = .otf } \setmathfont{MinionMath-常规}[% 数学样式=ISO, 尺寸特征 = { {大小 = -6.01,字体 = MinionMath-Tiny,样式 = MathScriptScript}, {大小 = 6.01-8.41,字体 = MinionMath-Capt,样式 = MathScript}, {大小 = 8.41-13.01,字体 = MinionMath-Regular}, {大小 = 13.01-19.91,字体 = MinionMath-Subh}, {大小 = 19.91-,字体 = MinionMath-Disp} }] \setmathfont{MinionMath-Bold}[范围={bfup->up,bfit->it}] \开始{文档} \XeTeXtracingfonts=1\放松 \微小的 $\符号{10520}$ \脚本大小 $\符号{10520}$ \脚注大小 $\符号{10520}$ \小的 $\符号{10520}$ \正常尺寸 $\符号{10520}$ \大的 $\符号{10520}$ \大的 $\符号{10520}$ \大的 $\符号{10520}$ \巨大的 $\符号{10520}$ \巨大的 $\符号{10520}$ \正常字体\正常大小 \fontspec{MinionMath-Regular.otf}[路径 = ./fonts/]{\symbol{10520}} \结束{文档}
它将在 ./fonts/ 目录中查找字体。