更新 Tex Live 基础设施并随后更新新软件包版本后,我收到以下错误消息:
mathspec.sty:92: Missing number, treated as zero.
<to be read again>
\protect
l.92 ...Symbol{\Alpha}{\mathalpha}{operators}{"41}
如何修复?或者如何恢复到以前的 TL 版本?
XeLaTeXmk 拒绝编译。我正在做一个紧急项目。非常感谢您的快速回答。提前致谢。
这是导致错误的原因的 MWE。
% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
%--------------------------------------------------------------
\documentclass[fontsize=11pt,paper=A4]{scrbook}
%--------------------------------------------------------------
\usepackage{ngerman}
\usepackage[quiet]{mathspec}
%······························································
% Undo the wrong changes made by mathspec
% Patch by Ulrike Fischer
\makeatletter
\let\RequirePackage\original@RequirePackage
\let\usepackage\RequirePackage
\makeatother
%······························································
\begin{document}
%······························································
This is an empty document.
%······························································
\end{document}
ngerman 包与 mathspec 冲突。如果您在 mathspec 之前(在 MWE 中注释掉)调用它,则会导致错误。如果您在之后(解决方案)调用它,错误就会消失。因此:(某些)依赖于语言的包必须在之后调用。
但是,除了亲身体验之外,我们“普通”用户如何知道加载我们想要使用的包的正确顺序呢?
答案1
您收到此错误
\documentclass{article}
\catcode`\"\active
\def"{\protect\relax}
\usepackage{mathspec}
\begin{document}
\end{document}
! Missing number, treated as zero.
<to be read again>
\protect
l.92 ...Symbol{\Alpha}{\mathalpha}{operators}{"41}
?
"
因此您已经在序言中加载了一些处于活动状态的包。
在这种情况下,它被证明是过时的ngerman
包,可以用
\usepackage[german]{babel}
答案2
这里有一个解决方案。只需在 mathspec 之后调用 ngerman 即可。
% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
%--------------------------------------------------------------
\documentclass[fontsize=11pt,paper=A4]{scrbook}
%--------------------------------------------------------------
%\usepackage{ngerman} Don't use it at this position
\usepackage[quiet]{mathspec}
\usepackage{ngerman}
%······························································
% Undo the wrong changes made by mathspec
% Patch by Ulrike Fischer
\makeatletter
\let\RequirePackage\original@RequirePackage
\let\usepackage\RequirePackage
\makeatother
%······························································
\begin{document}
%······························································
This is an empty document.
%······························································
\end{document}