MiKTeX 找不到 stix2 字体文件

MiKTeX 找不到 stix2 字体文件

我想将stix2字体与 一起使用unocode-math。我尝试像下面的 MWE 一样加载它们,这在 TeX Live 中运行良好,但在 MiKTeX 中失败,并告诉我The font "STIX2Text-Regular" cannot be found.等。我已以管理员身份安装了 MiKTeX,并且stix2-otf包已安装。

这是什么问题?我该如何解决?

这是加载字体的推荐方法吗?或者有更安全的方法吗?


% !TeX program = lualatex
\documentclass{article}

\usepackage{fontspec}
\usepackage[
  math-style=ISO,
  partial=upright,
  warnings-off={mathtools-overbracket, mathtools-colon},
  ]{unicode-math}

\setmainfont{STIX2Text}[
    UprightFont = *-Regular,
    ItalicFont = *-Italic,
    ItalicFeatures = { SmallCapsFont = *-Italic },
    SlantedFont = *-Regular,
    SlantedFeatures= { FakeSlant=0.2 },
    BoldFont = *-Bold,
    BoldFeatures = { SmallCapsFont = *-Bold },
    BoldItalicFont = *-BoldItalic,
    BoldItalicFeatures = { SmallCapsFont = *-BoldItalic },
    BoldSlantedFont= *-Bold,
    BoldSlantedFeatures= { FakeSlant=0.2, SmallCapsFont = *-Bold },
    SmallCapsFont = *-Regular,
    SmallCapsFeatures={ RawFeature=+smcp },
    Extension = .otf
  ]
\setmathfont{STIX2Math}

\begin{document}

Hello World!

\end{document}

这是日志文件的开头。

This is LuaHBTeX, Version 1.13.0 (MiKTeX 21.1) (format=lualatex 2021.1.21)  21 JAN 2021 11:00
 restricted system commands enabled.
**test02.tex
(./test02.tex
LaTeX2e <2020-10-01> patch level 4
Lua module: luaotfload 2021-01-08 3.17 Lua based OpenType font support
Lua module: lualibs 2020-12-30 2.73 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2020-12-30 2.73 ConTeXt Lua libraries -- extended c
ollection.
luaotfload | conf : Root cache directory is "C:/Users/wilde/AppData/Local/MiKTeX
/luatex-cache/generic/names".
luaotfload | init : Loading fontloader "fontloader-2021-01-07.lua" from kpse-res
olved path "C:/Program Files/MiKTeX/tex/luatex/luaotfload/fontloader-2021-01-07.
lua".
Lua-only attribute luaotfload@noligature = 1
Lua-only attribute luaotfload@syllabe = 2
luaotfload | init : Context OpenType loader version 0x1.8e76c8b439581p+1
Inserting `luaotfload.node_processor' at position 1 in `pre_linebreak_filter'.
Inserting `luaotfload.node_processor' at position 1 in `hpack_filter'.
Inserting `luaotfload.glyph_stream' at position 1 in `glyph_stream_provider'.
Inserting `luaotfload.define_font' at position 1 in `define_font'.
Lua-only attribute luaotfload_color_attribute = 3
luaotfload | conf : Root cache directory is "C:/Users/wilde/AppData/Local/MiKTeX
/luatex-cache/generic/names".
Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_opentype_file'.
Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_truetype_file'.
Inserting `luaotfload.harf.finalize_vlist' at position 1 in `post_linebreak_filt
er'.
Inserting `luaotfload.harf.finalize_hlist' at position 2 in `hpack_filter'.
Inserting `luaotfload.cleanup_files' at position 1 in `wrapup_run'.
Inserting `luaotfload.harf.finalize_unicode' at position 1 in `finish_pdffile'.
Inserting `luaotfload.glyphinfo' at position 1 in `glyph_info'.
Inserting `luaotfload.aux.set_sscale_dimens' at position 1 in `luaotfload.patch_
font'.
Inserting `luaotfload.aux.set_font_index' at position 2 in `luaotfload.patch_fon
t'.
Inserting `luaotfload.aux.patch_cambria_domh' at position 3 in `luaotfload.patch
_font'.
Inserting `luaotfload.aux.fixup_fontdata' at position 1 in `luaotfload.patch_fon
t_unsafe'.
Inserting `luaotfload.aux.set_capheight' at position 4 in `luaotfload.patch_font
'.
Inserting `luaotfload.aux.set_xheight' at position 5 in `luaotfload.patch_font'.
Inserting `luaotfload.rewrite_fontname' at position 6 in `luaotfload.patch_font'
. L3 programming layer <2021-01-09> xparse <2020-03-03>
("C:/Program Files/MiKTeX/tex/latex/base/article.cls"
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
("C:/Program Files/MiKTeX/tex/latex/base/size10.clo"
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
luaotfload | db : Font names database loaded from C:/Users/wilde/AppData/Local/M
iKTeX/luatex-cache/generic/names/luaotfload-names.luc)
\c@part=\count173
\c@section=\count174
\c@subsection=\count175
\c@subsubsection=\count176
\c@paragraph=\count177
\c@subparagraph=\count178
\c@figure=\count179
\c@table=\count180
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
("C:/Program Files/MiKTeX/tex/latex/fontspec/fontspec.sty"
("C:/Program Files/MiKTeX/tex/latex/l3packages/xparse/xparse.sty"
("C:/Program Files/MiKTeX/tex/latex/l3kernel/expl3.sty"
Package: expl3 2021-01-09 L3 programming layer (loader) 

("C:/Program Files/MiKTeX/tex/latex/l3backend/l3backend-luatex.def"
File: l3backend-luatex.def 2021-01-09 L3 backend support: PDF output (LuaTeX)
\l__kernel_color_stack_int=\count181
\l__pdf_internal_box=\box47
))
Package: xparse 2020-10-27 L3 Experimental document command parser

("C:/Program Files/MiKTeX/tex/latex/l3packages/xparse/xparse-generic.tex"))
Package: fontspec 2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX
Lua module: fontspec 2020/02/21 2.7i Font selection for XeLaTeX and LuaLaTeX
("C:/Program Files/MiKTeX/tex/latex/fontspec/fontspec-luatex.sty"
Package: fontspec-luatex 2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaT
eX
\l__fontspec_script_int=\count182
\l__fontspec_language_int=\count183
\l__fontspec_strnum_int=\count184
\l__fontspec_tmp_int=\count185
\l__fontspec_tmpa_int=\count186
\l__fontspec_tmpb_int=\count187
\l__fontspec_tmpc_int=\count188
\l__fontspec_em_int=\count189
\l__fontspec_emdef_int=\count190
\l__fontspec_strong_int=\count191
\l__fontspec_strongdef_int=\count192
\l__fontspec_tmpa_dim=\dimen139
\l__fontspec_tmpb_dim=\dimen140
\l__fontspec_tmpc_dim=\dimen141

("C:/Program Files/MiKTeX/tex/latex/base/fontenc.sty"
Package: fontenc 2020/08/10 v2.0s Standard LaTeX package
)
("C:/Program Files/MiKTeX/tex/latex/fontspec/fontspec.cfg")))
(C:/Users/wilde/AppData/Roaming/MiKTeX/tex/latex/unicode-math/unicode-math.sty
Package: unicode-math 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLaTeX

(C:/Users/wilde/AppData/Roaming/MiKTeX/tex/latex/unicode-math/unicode-math-luat
ex.sty
Package: unicode-math-luatex 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaL
aTeX
 ("C:/Program Files/MiKTeX/tex/latex/l3packages/l3keys2e/l3keys2e.sty"
Package: l3keys2e 2020-10-27 LaTeX2e option processing using LaTeX3 keys
)
("C:/Program Files/MiKTeX/tex/latex/base/fix-cm.sty"
Package: fix-cm 2015/01/14 v1.1t fixes to LaTeX

("C:/Program Files/MiKTeX/tex/latex/base/ts1enc.def"
File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
LaTeX Font Info:    Redeclaring font encoding TS1 on input line 47.
))
("C:/Program Files/MiKTeX/tex/latex/amsmath/amsmath.sty"
Package: amsmath 2020/09/23 v2.17i AMS math features
\@mathmargin=\skip49

For additional information on amsmath, use the `?' option.
("C:/Program Files/MiKTeX/tex/latex/amsmath/amstext.sty"
Package: amstext 2000/06/29 v2.01 AMS text

("C:/Program Files/MiKTeX/tex/latex/amsmath/amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks15
\ex@=\dimen142
))
("C:/Program Files/MiKTeX/tex/latex/amsmath/amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen143
)
("C:/Program Files/MiKTeX/tex/latex/amsmath/amsopn.sty"
Package: amsopn 2016/03/08 v2.02 operator names
)
\inf@bad=\count193
LaTeX Info: Redefining \frac on input line 236.
\uproot@=\count194
\leftroot@=\count195
LaTeX Info: Redefining \overline on input line 399.
\classnum@=\count196
\DOTSCASE@=\count197
LaTeX Info: Redefining \ldots on input line 496.
LaTeX Info: Redefining \dots on input line 499.
LaTeX Info: Redefining \cdots on input line 620.
\Mathstrutbox@=\box48
\strutbox@=\box49
\big@size=\dimen144
LaTeX Font Info:    Redeclaring font encoding OML on input line 743.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 744.
\macc@depth=\count198
\c@MaxMatrixCols=\count199
\dotsspace@=\muskip16
\c@parentequation=\count266
\dspbrk@lvl=\count267
\tag@help=\toks16
\row@=\count268
\column@=\count269
\maxfields@=\count270
\andhelp@=\toks17
\eqnshift@=\dimen145
\alignsep@=\dimen146
\tagshift@=\dimen147
\tagwidth@=\dimen148
\totwidth@=\dimen149
\lineht@=\dimen150
\@envbody=\toks18
\multlinegap=\skip50
\multlinetaggap=\skip51
\mathdisplay@stack=\toks19
LaTeX Info: Redefining \[ on input line 2923.
LaTeX Info: Redefining \] on input line 2924.
)
(C:/Users/wilde/AppData/Roaming/MiKTeX/tex/lualatex/lualatex-math/lualatex-math
.sty
Package: lualatex-math 2020/09/25 v1.9 Patches for mathematics typesetting with
 LuaLaTeX
 ("C:/Program Files/MiKTeX/tex/latex/etoolbox/etoolbox.sty"
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count271
)
Lua module: lualatex-math 2013/08/03 1.3 Patches for mathematics typesetting wit
h LuaLaTeX)
\g__um_fam_int=\count272
\g__um_fonts_used_int=\count273
\l__um_primecount_int=\count274
\g__um_primekern_muskip=\muskip17

(C:/Users/wilde/AppData/Roaming/MiKTeX/tex/latex/unicode-math/unicode-math-tabl
e.tex)))
luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: File not foun
d: "STIX2Text-Regular.otf".

! Package fontspec Error: The font "STIX2Text-Regular" cannot be found.

For immediate help type H <return>.
 ...                                              
                                                  
l.26   ]
      

A font might not be found for many reasons.
 Check the spelling, where the font is installed etc. etc.

 When in doubt, ask someone for help!


luaotfload | aux : no font with id 0
luaotfload | aux : no font with id 0

! Package fontspec Error: The font "STIX2Text-Regular" cannot be found.

For immediate help type H <return>.
 ...                                              
                                                  
l.26   ]
      

A font might not be found for many reasons.
 Check the spelling, where the font is installed etc. etc.

 When in doubt, ask someone for help!



! Package fontspec Error: The font "STIX2Text-Regular" cannot be found.

For immediate help type H <return>.
 ...                                              
                                                  
l.26   ]
      

A font might not be found for many reasons.
 Check the spelling, where the font is installed etc. etc.

 When in doubt, ask someone for help!



[...]

答案1

我认为主要问题是 otf 字体文件名包含字符串“Two”而不是数字“2”。

在我的系统(MacTeX2020,已应用所有更新)上,以下两种变体均可正常工作:

\setmainfont{Stix Two Text}[<options>] 
\setmathfont{Stix Two Math} 

\setmainfont{StixTwoText}[<options>]
\setmathfont{StixTwoMath}

当然,\setmainfont{Stix2Text}[<options>]而且\setmathfont{Stix2Math}不是工作。

相关内容