Expl3 语法破坏 biblatex xpatch 修补

Expl3 语法破坏 biblatex xpatch 修补

使用\ExplSyntaxOnbreak \xpatchbibmacro。可以修复这个问题吗,还是我只需要使用xpatch其他地方的命令?

梅威瑟:

\documentclass{article}

\usepackage{expl3}
\usepackage{xpatch}
\usepackage[style=authoryear]{biblatex}

\begin{filecontents}[overwrite]{\jobname.bib}
@book{1person,
  author    = {John Smith},
  title     = {Some Random Thing},
  date      = {1970}
}
@book{2people,
  author    = {John Smith and Bob Smith},
  title     = {Some Other Thing},
  date      = {1971}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}

\DeclareNameAlias{sortname}{given-family}
\ExplSyntaxOn % Removing this fixes it...
\xpatchbibmacro{date+extradate}% Remove date's parentheses, add period before (/a/428193)
    {\printtext[parens]}{\setunit*{\addperiod\addspace}\printtext}{}{}
\ExplSyntaxOff

\begin{document}
\printbibliography
\end{document}

答案1

\ExplSyntaxOn:改变了几个字符(空格、、、_)的类别代码,~如果类别代码与定义时的代码不同,修补程序可能会失败。

请勿\xpatch...在 范围内使用\ExplSyntaxOn

相关内容