使用 \DefineName 缩写在 AMSRefs \bib 条目中输入十位作者会引发 rkeyval 错误

使用 \DefineName 缩写在 AMSRefs \bib 条目中输入十位作者会引发 rkeyval 错误

我正在使用命令\DefineName\DefineJournal\DefinePublisher在我的参考书目中使用缩写,类似于 AMSRefs 第 8.4 节中提到的包装文档。现在,我有十位作者的条目,并使用缩写全部十位作者抛出rkeyval错误。

麦格维:newtest.tex

\documentclass{amsart}

\usepackage{amsrefs}

\DefineName{bas-t}      {Bascelli, Tiziana}
\DefineName{bla-p}      {B{\l}aszczyk, Piotr}
\DefineName{bor-a-v}    {Borovik, Alexandre~Vasilievich}
\DefineName{kan-v-g}    {Kanovei, Vladimir~G.}
\DefineName{kat-k-u}    {Katz, Karin~Usadi}
\DefineName{kat-m-g}    {Katz, Mikhail~Gersh}
\DefineName{kut-s-s}    {Kutateladze, Sem{\"e}n~Samsonovich}
\DefineName{mcgaf-t}    {McGaffey, Thomas}
\DefineName{sch-d-m}    {Schaps, David~M.}
\DefineName{she-d-m}    {Sherry, David~M.}

\DefineJournal{fs}{1233-1821, 1572-8471/e}
    {Found. Sci.}
    {Foundations of Science}

\begin{document}

\begin{bibdiv}
\begin{biblist}

\raggedright

\bib{BasBlaBor18}{article}{
      author={bas-t},
      author={bla-p},
      author={bor-a-v},
      author={kan-v-g},
      author={kat-k-u},
      author={kat-m-g},
      author={kut-s-s},
      author={mcgaf-t},
      author={sch-d-m},
      author={she-d-m},
       title={Cauchy's infinitesimals, his sum theorem, and foundational paradigms},
        date={2018},
     journal={fs},
      volume={23},
      number={2},
       pages={267\ndash 296},
         doi={10.1007/s10699-017-9534-y},
      review={\MR{3803893}},
}

\end{biblist}
\end{bibdiv}

\end{document}

控制台输出显示:

./newtest.tex:47: Package rkeyval Error: Invalid key name character.

See the rkeyval package documentation for explanation.
Type H <return> for immediate help.
 ...

l.47 }

?

我尽职尽责地检查了rkeyval 包装文档任何解释,但对于像我这样的新手来说,这并没有用。

接下来,我R <return>在控制台中输入让引擎不停地运行,同样的错误信息又重复了九次,直到文档编译完成。PDF 输出完全符合预期。

我猜想,单个条目中两位数的作者缩写\bib会以某种方式导致此错误。如果我删除任何一个缩写,并正常输入该名称,则文档可以正常编译。

我该怎么做才能修复或者至少避免这个错误?

答案1

如果我添加\tracingmacros=1,我会在日志文件中找到

\@tempa ->\def \bib'author {\name {Bascelli, Tiziana}\name {B{\l }aszczyk, Piot
r}\name {Borovik, Alexandre~Vasilievich}\name {Kanovei, Vladimir~G.}\name {Katz
, Karin~Usadi}\name {Katz, Mikhail~Gersh}\name {Kutateladze, Sem{\"e}n~Samsonov
ich}\name {McGaffey, Thomas}\name {Schaps, David~M.}\name {Sherry, David~M.}}\r
eset@nth@property \bib'author 1{}\reset@nth@property \bib'author 2{}\reset@nth@
property \bib'author 3{}\reset@nth@property \bib'author 4{}\reset@nth@property
\bib'author 5{}\reset@nth@property \bib'author 6{}\reset@nth@property \bib'auth
or 7{}\reset@nth@property \bib'author 8{}\reset@nth@property \bib'author 9{}\re
set@nth@property \bib'author 10{}

进而

\reset@nth@property #1#2#3->\begingroup \edef \@tempa {\extract@group #1}\@temp
cnta #2\relax \@temptokena {#3}\toks@ \@emptytoks \@tempcntb \z@ \@xp \reset@sc
an \@xp #1\csname \@tempa ,aux\endcsname \edef \@tempa {\def \@xp \@nx \csname
\@tempa ,aux\endcsname {\the \toks@ }}\@xp \endgroup \@tempa
#1<-\bib'author
#2<-1
#3<-

所以你的猜想是正确的。当\reset@nth@property后跟 时10{}\@tempcnta设置为 1,而 时\@temptokena0。所以一切都崩溃了。

我不知道在哪里可以找到在数字周围添加括号的方法,这可以解决问题,但这似乎有效。

\documentclass{amsart}

\usepackage{amsrefs}

\makeatletter
\let\saved@reset@nth@property\reset@nth@property
\def\reset@nth@property#1#2#{\saved@reset@nth@property{#1}{#2}}
\makeatother

\DefineName{bas-t}      {Bascelli, Tiziana}
\DefineName{bla-p}      {B{\l}aszczyk, Piotr}
\DefineName{bor-a-v}    {Borovik, Alexandre~Vasilievich}
\DefineName{kan-v-g}    {Kanovei, Vladimir~G.}
\DefineName{kat-k-u}    {Katz, Karin~Usadi}
\DefineName{kat-m-g}    {Katz, Mikhail~Gersh}
\DefineName{kut-s-s}    {Kutateladze, Sem{\"e}n~Samsonovich}
\DefineName{mcgaf-t}    {McGaffey, Thomas}
\DefineName{sch-d-m}    {Schaps, David~M.}
\DefineName{she-d-m}    {Sherry, David~M.}

\DefineJournal{fs}{1233-1821, 1572-8471/e}
    {Found. Sci.}
    {Foundations of Science}

\begin{document}

\begin{bibdiv}
\begin{biblist}

\raggedright

\bib{BasBlaBor18}{article}{
      author={bas-t},
      author={bla-p},
      author={bor-a-v},
      author={kan-v-g},
      author={kat-k-u},
      author={kat-m-g},
      author={kut-s-s},
      author={mcgaf-t},
      author={sch-d-m},
      author={she-d-m},
       title={Cauchy's infinitesimals, his sum theorem, and foundational paradigms},
        date={2018},
     journal={fs},
      volume={23},
      number={2},
       pages={267\ndash 296},
         doi={10.1007/s10699-017-9534-y},
      review={\MR{3803893}},
}

\end{biblist}
\end{bibdiv}

\end{document}

这是基于以下假设:\reset@nth@property后面跟着一个标记(例如\bib'author或其他标记),然后是一个数字,然后是一个左括号。如果情况并非总是如此,您将收到奇怪的错误消息。

答案2

这似乎也有效:

\documentclass{amsart}

\usepackage{amsrefs}
\makeatletter
\catcode`\'=11
\def\xref@check@ab#1#2{%
    \csname bi@#2\endcsname
    \ifx\@empty\bib'name
        \@temptokena{#2}%
    \else 
        \@temptokena\@xp{\bib'name}%
        \get@property\@tempa\bib'name
        \edef\@tempa{%
            \@nx\addto@hook\@temptokenb{%
                \@nx\reset@nth@property\@nx#1{\the\series@index}{\@tempa}% missing braces
            }%
        }%
        \@tempa
    \fi
    \edef\@tempa{\@nx\add@toks@{\@nx\name{\the\@temptokena}}}%
    \@tempa
}
\catcode`\'=12
\makeatother

\DefineName{bas-t}      {Bascelli, Tiziana}
\DefineName{bla-p}      {B{\l}aszczyk, Piotr}
\DefineName{bor-a-v}    {Borovik, Alexandre~Vasilievich}
\DefineName{kan-v-g}    {Kanovei, Vladimir~G.}
\DefineName{kat-k-u}    {Katz, Karin~Usadi}
\DefineName{kat-m-g}    {Katz, Mikhail~Gersh}
\DefineName{kut-s-s}    {Kutateladze, Sem{\"e}n~Samsonovich}
\DefineName{mcgaf-t}    {McGaffey, Thomas}
\DefineName{sch-d-m}    {Schaps, David~M.}
\DefineName{she-d-m}    {Sherry, David~M.}

\DefineJournal{fs}{1233-1821, 1572-8471/e}
    {Found. Sci.}
    {Foundations of Science}

\begin{document}

\begin{bibdiv}
\begin{biblist}

\raggedright
\bib{BasBlaBor18}{article}{
      author={bas-t},
      author={bla-p},
      author={bor-a-v},
      author={kan-v-g},
      author={kat-k-u},
      author={kat-m-g},
      author={kut-s-s},
      author={mcgaf-t},
      author={sch-d-m},
      author={she-d-m},
       title={Cauchy's infinitesimals, his sum theorem, and foundational paradigms},
        date={2018},
     journal={fs},
      volume={23},
      number={2},
       pages={267\ndash 296},
         doi={10.1007/s10699-017-9534-y},
      review={\MR{3803893}},
}

\end{biblist}
\end{bibdiv}

\end{document}

相关内容