\bbl@tempd 的参数有一个额外的 }

\bbl@tempd 的参数有一个额外的 }

仅在 Debian 9 上使用 TexLive 2017 运行时才会引发错误。如果我在 Windows 10 上使用 MikTex 运行相同示例,则一切正常:

\PassOptionsToPackage{main=brazil,english,spanish,french}{babel}
\documentclass[brazilian,brazil,10pt,a4paper,]{memoir}

\usepackage{babel}
\usepackage{hyperref}

\newcommand{\autor}[1]{\author{#1}}
\newcommand{\imprimirautor}{\theauthor}
\newcommand{\brazilword}[1]{\foreignlanguage{brazil}{#1}}

\autor{\brazilword{Your Name}}
\hypersetup{
  pdfauthor={\imprimirautor},
}

\begin{document}
Hi.
\end{document}
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty)))
! Argument of \bbl@tempd has an extra }.
<inserted text>
                \par
l.14 }

? H
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

答案1

通过研究,我发现了以下相关问题:

  1. 微类型扩展导致 pdfauthor 出错
  2. XeLaTex + babel (\addto\extras{lang}) + hyperref

我尝试了这两个答案,但都没有用。

查看代码后,我发现在 babel 命令\protect前添加\foreignlanguage,可以修复 TexLive 2017 和 MikTeX 的问题。唯一的问题是,为什么之前没有“保护”的 MikTeX 可以正常工作,而 TexLive 却会报错。

  1. https://texfaq.org/FAQ-protect
  2. \protect 的用途是什么?
  3. 脆弱命令和坚固命令之间有什么区别?

相关内容