![LuaTeX 错误(字体扩展):字体已使用不同的扩展步骤进行扩展](https://linux22.com/image/264890/LuaTeX%20%E9%94%99%E8%AF%AF%EF%BC%88%E5%AD%97%E4%BD%93%E6%89%A9%E5%B1%95%EF%BC%89%EF%BC%9A%E5%AD%97%E4%BD%93%E5%B7%B2%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%8C%E7%9A%84%E6%89%A9%E5%B1%95%E6%AD%A5%E9%AA%A4%E8%BF%9B%E8%A1%8C%E6%89%A9%E5%B1%95.png)
当我尝试使用 LuaLaTeX 编译我的文档时突然出现以下错误,我的简单问题是:这是什么意思?
LuaTeX error (font expansion): font has been expanded with different expansion step.
我试过这作为一种可能的解决方案但它并没有改变任何事情。
我说“突然”,是因为昨晚我在另一台机器上编译同一个文档时,它运行正常。我能想到的唯一可能的区别是,另一台机器可能没有最新版本的fontspec
或microtype
,但发生错误的那台机器有最新版本的(通过 MiKTeX)。
此时,我不想创建一个最小的代码示例,我只想了解该错误的含义,以便我可以尝试跟踪它。但这是我加载相关包的方法:
\usepackage[
activate={false,nocompatibility},
final,
]{microtype}
\usepackage{fontspec}
\newfontfeature{Microtype}{protrusion=default;expansion=default;}
\setmainfont[Microtype,Ligatures=TeX,Renderer=Basic]{Times New Roman}
我应该补充一点,当我停用 microtype 包时,错误就会消失。
这是日志文件的相关部分:
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for EU2/lmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for T3/cmr/m/n on input line 4.
LaTeX Font Info: Try loading font information for T3+cmr on input line 4.
("C:/Program Files/MiKTeX 2.9/tex/latex/tipa/t3cmr.fd"
File: t3cmr.fd 2001/12/31 TIPA font definitions
)
LaTeX Font Info: ... okay on input line 4.
luaotfload | load font: auto-selecting default features for script: dflt (was l
atn)
luaotfload | load font: font family='timesnewroman', subfamily='regular' found:
times.ttf
LaTeX Info: Redefining \microtypecontext on input line 4.
Package microtype Info: Generating PDF output.
Package microtype Info: Character protrusion enabled (level 2).
Package microtype Info: Using default protrusion set `alltext'.
Package microtype Info: Automatic font expansion enabled (level 2),
(microtype) stretch: 20, shrink: 20, step: 1, non-selected.
Package microtype Info: Using default expansion set `basictext'.
Package microtype Info: No adjustment of tracking.
Package microtype Info: No adjustment of spacing.
Package microtype Info: No adjustment of kerning.
Package microtype Info: Loading generic settings for font family
(microtype) `TimesNewRoman' (encoding: EU2).
(microtype) For optimal results, create family-specific settings.
(microtype) See the microtype manual for details.
! LuaTeX error (font expansion): font has been expanded with different expansio
n step.
<to be read again>
relax
l.4 \begin{document}
Here is how much of LuaTeX's memory you used:
31786 strings out of 495011
125171,1144653 words of node,token memory allocated 1001 words of node memory still in use:
nodes
avail lists: 1:2,2:29,3:1,4:9,5:2,6:2,7:1,9:1,11:1
34213 multiletter control sequences out of 65536+200000
31 fonts using 6322279 bytes
65i,1n,95p,886b,696s stack positions out of 5000i,500n,10000p,200000b,50000s
! ==> Fatal error occurred, no output PDF file produced!
答案1
正如指出的那样这个答案,您不应将microtype
的接口与 的接口fontspec
(分别为luaotfload
)混合使用。要么使用:
\usepackage{fontspec}
\usepackage[activate,final]{microtype}
\setmainfont[Ligatures=TeX,Renderer=Basic]{Times New Roman}
或者:
\usepackage{fontspec}
\newfontfeature{Microtype}{protrusion=default;expansion=default;}
\setmainfont[Microtype,Ligatures=TeX,Renderer=Basic]{Times New Roman}
(在您的例子中,fontspec
想要用 5 来扩展字体step
,而 microtype 使用的step
1,这会导致错误。)