lualatex 中的 l3names 错误(\reserveinserts{32})

lualatex 中的 l3names 错误(\reserveinserts{32})

我有以下正在工作的“测试文件”,在使用“(La/Xe/pdf)TeX”编译时没有问题,但在使用“LuaLaTeX”编译时会抛出错误:

Package: l3names 2012/09/24 v4230 L3 Namespace for primitives
)
Runaway argument?
! Forbidden control sequence found while scanning use of \next.
<inserted text> 
                \par 
l.66 \reserveinserts
                    {32}
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

文件如下:

\documentclass{article}
\usepackage{soulutf8}
\usepackage[math]{blindtext}
\usepackage{xwatermark}
%\usepackage[verbose=silent]{microtype}
\usepackage{xcolor}
\usepackage{ifpdf,ifluatex,ifxetex}
\newif\ifxetexorluatex
\ifxetex
  \xetexorluatextrue
\else
  \ifluatex
    \xetexorluatextrue
  \else
    \xetexorluatexfalse
  \fi
\fi
\ifxetexorluatex
    \usepackage[no-math]{fontspec}
    \setmainfont[Ligatures=TeX,RawFeature=+onum]{Linux Libertine O}
    \setsansfont[RawFeature=+pnum]{Linux Biolinum O}
    \newfontfamily{\biolinum}{Linux Biolinum O}
    \newcommand{\bitext}[1]{\biolinum #1}%
    \newwatermark[allpages,fontsize=2.0cm,align=center,color=gray!45,angle=45,xpos=0,ypos=0]{\textbf{\bitext{Preliminar 2012}}}
\else
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{fourier}
    \usepackage[rm]{libertine} 
    \renewcommand{\sfdefault}{LinuxBiolinumO-LF}
    \newwatermark[allpages,color=gray!45,angle=45,fontfamily=LinuxBiolinumO-OsF,scale=2.5,xpos=0,ypos=0]{Preliminar 2012}
\fi
\begin{document}
\sodef\textss{}{.3em}{0.6em}{0pt}
\noindent
\begin{center}
\textbf{\textss{\large\scshape «Universidad de Concepci\'{o}n»}}
\end{center}
\Blinddocument
\end{document}

在 Win32/Linux 中使用“TexLive 2012”(已更新)。查看 l3names 的文档,但它对我的水平来说有点“高级”,任何建议或帮助都将不胜感激。问候 Pablo

答案1

一个最小的例子是:

\documentclass{article}
\usepackage{xwatermark}
\usepackage{fontspec}
\begin{document}
\end{document}

分析之后该例子变成:

\RequirePackage{catoptions}% loaded by xwatermark
\outer\def\foo{}% outer macro as \reserveinserts
\RequirePackage{capt-of}% package does not matter
\foo
\csname @@end\endcsname % end of job, after the error

或者

\RequirePackage{catoptions}
\outer\def\foo{}
\makeatletter
\ifnextcharTF[{\typeout{yes}}{\typeout{no}}\foo
\@@end

之后,\RequirePackage[options]{package}还有一个额外的可选参数,用于指定最低要求的发布日期。这些宏由包重新定义catoptions。但是,可选的测试[不仅使用通常的\futurelet,而且下一个标记也会作为宏参数读入(\cpt@ifn@xtcharacter)。如果下一个标记是外部宏,则失败。

解决方法:

\documentclass{article}
\usepackage{xwatermark}% or catoptions
\makeatletter
\let\org@cpt@ifbrack\cpt@ifbrack
\renewcommand*{\cpt@ifbrack}{\@ifnextchar[}
\makeatother
...

答案2

感谢 Heiko。我将上传期权到 CTAN。与此同时这里有一个补丁。问题不是由于错误造成的:\outer是一种我没有预见到的奇怪类型。Heiko 大师知道我为什么对 LaTeX 内核相当谨慎\@ifnextchar

\documentclass{article}
\usepackage{xwatermark}
\makeatletter
% Copy this to end of catoptions:
\edef\if@let@token@isouter{%
  \unexpanded{\expandafter\if@let@token@isouter@a\meaning\@let@token}%
  \detokenize{outer macro}:\cpt@nil
}
\edef\reserved@a{%
  \def\noexpand\if@let@token@isouter@a##1\detokenize{outer macro}:##2\cpt@nil
}
\reserved@a{\@nameuse{@\ifblankTF{#2}{second}{first}oftwo}}
\def\cpt@ifnextcharacter#1#2#3{%
  \ifcase0%
    \ifcat\noexpand\@let@token\bgroup 1\fi
    \ifcat\noexpand\@let@token\egroup 1\fi
    \if@let@token@isouter{1}{0}\relax
    \let\next\cpt@ifn@xtcharacter
  \else
    \def\next{\endgroup\cpt@ifnextchar}%
  \fi
  \next{#1}{#2}{#3}%
}
% End of patch.
\makeatother
\usepackage{soulutf8}
\usepackage[math]{blindtext}
\usepackage{xcolor}
\usepackage{ifpdf,ifluatex,ifxetex}
\newif\ifxetexorluatex
\ifcase0\ifxetex\else\ifluatex\else 1\fi\fi\relax\xetexorluatextrue\fi
\ifboolTF{xetexorluatex}{%
    \usepackage[no-math]{fontspec}
    \setmainfont[Ligatures=TeX,RawFeature=+onum]{Linux Libertine O}
    \setsansfont[RawFeature=+pnum]{Linux Biolinum O}
    \newfontfamily{\biolinum}{Linux Biolinum O}
    \newcommand{\bitext}[1]{\biolinum #1}%
    \newwatermark[allpages,fontsize=2.0cm,align=center,color=gray!45,
      angle=45,xpos=0,ypos=0]{\textbf{\bitext{Preliminar 2012}}}
}{%
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{fourier}
    % There is a problem with the option 'rm' for libertine:
    % \usepackage[rm]{libertine}
    \usepackage{libertine}
    \renewcommand{\sfdefault}{LinuxBiolinumO-LF}
    \newwatermark[allpages,color=gray!45,angle=45,
      fontfamily=LinuxBiolinumO-OsF,scale=2.5,xpos=0,ypos=0]{Preliminar 2012}
}%

\begin{document}
\sodef\textss{}{.3em}{0.6em}{0pt}
\begin{center}
\textbf{\textss{\large\scshape «Universidad de Concepci\'{o}n»}}
\end{center}
\noindent\Blinddocument
\end{document}

这是一个模糊的例子:

\outer\def\foo{}
\iftrue\ifnextcharTF*\relax\relax\foo\fi
\iftrue\ifnextcharTF*\relax\relax\fi
\ifnextcharTF*\relax\relax\iftrue\fi

相关内容