xparse 未定义控制序列

xparse 未定义控制序列

我刚刚安装了该texlive-latex3软件包并尝试运行pdflatex以下命令(直接从此处发布的另一个问题复制):

\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand {\dothings}
  { > { \SplitList { ~ } } m }
  { \tl_map_inline:nn {#1} { \fbox{##1} } }
\ExplSyntaxOff
\begin{document}
\dothings{Takes several words as argument}
\end{document}

但我收到“未定义控制序列”错误。我复制的任何其他使用的代码也会出现同样的情况xparse。我在这里做错了什么?我注意到它说我正在使用 LaTeX2e。这可能与问题有关吗?

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./test.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/xpackages/xbase/xparse.sty
(/usr/share/texmf-texlive/tex/latex/expl3/l3names.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/expl3.sty
(/usr/share/texmf-texlive/tex/latex/expl3/l3basics.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3expan.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3tl.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3num.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3intexpr.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3quark.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3seq.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3toks.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3int.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3prg.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3clist.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3token.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3io.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3prop.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3msg.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3skip.sty))
(/usr/share/texmf-texlive/tex/latex/expl3/l3box.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3keyval.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3keys.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3precom.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3calc.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3xref.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3file.sty)) (./test.aux)
! Undefined control sequence.
\xparse_processor_1:n #1->\SplitList 
                                     { }{#1}
l.9 \dothings{Takes several words as argument}

?

答案1

虽然\lisfiles这通常是找出正在使用的特定文件或文件包的确切版本的最佳方法,但在这里很明显,您正在使用的 LaTeX3 文件包版本太旧了。“泄露”行是

(/usr/share/texmf-texlive/tex/latex/expl3/l3num.sty)
(/usr/share/texmf-texlive/tex/latex/expl3/l3intexpr.sty)

因为我们不再使用l3num,并且不久前l3intexpr被集成到。更一般地说,LaTeX3 代码正在积极开发中,这意味着随着想法的出现,新功能也会被添加。使用此处发布的 LaTeX3 想法的答案通常需要 CTAN 代码的最新版本。l3int

您需要安装这两个软件包的更新版本l3kernell3packages以获取最新功能。为此,请下载文件l3kernel.tds.zipl3packages.tds.zip来自 CTAN 的文件。然后应将这些文件解压到您的本地 TeX 树中,通常是~/texmf。然后 TeX 应该会在您的托管 TeX 安装中找到更新的文件,而不是旧文件。(由于您拥有 TeX Live 2009,因此您不需要运行texhash来获取这些文件,而使用早期版本的 TeX Live 则需要这样做。)

相关内容