biblatex-apa 与 silent 包错误,它是无害的吗?

biblatex-apa 与 silent 包错误,它是无害的吗?

biblatex使用、APA 和时,我收到以下编译错误silence。我希望这不会造成危害?我刚刚更新了我的 MiKTeX 发行版并重新安装了biblatex-apa

[ ERROR ][ C:\Program Files (x86)\MiKTeX
2.9\tex\latex\biblatex-apa\apa.bbx | Line 972 ] Argument of \blx@noline has an extra }:    \renewbibmacro*{reviewauthor}

[ WARNING ][ C:\Program Files (x86)\MiKTeX
2.9\tex\latex\biblatex-apa\apa.bbx | Line  ] Runaway argument?   ! Paragraph ended before \blx@noline was complete.

[ ERROR ][ C:\Program Files (x86)\MiKTeX
2.9\tex\latex\biblatex-apa\apa.bbx | Line 972 ] Paragraph ended before \blx@noline was complete:    \renewbibmacro*{reviewauthor}

[ WARNING ][ C:\Program Files (x86)\MiKTeX
2.9\tex\latex\biblatex-apa\apa.bbx | Line  ] Package biblatex Warning: Macro 'reviewauthor' undefined.(biblatex)                Using \newbibmacro.

这里是 MWE

\documentclass[11pt,twoside]{standalone} 
\usepackage{silence}
\usepackage[log-declarations=false]{xparse}
\usepackage[quiet]{fontspec}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\begin{document}
Testing
\end{document}

答案1

很有可能不是无害。当然,在没有警告和没有错误之间做出选择是很容易的。;-)

该问题是由于“NoLine”警告通常是通过\@gobble在参数末尾添加以下内容而获得的\PackageWarning

% latex.ltx, line 972:
\def\PackageWarningNoLine#1#2{%
   \PackageWarning{#1}{#2\@gobble}%
}

然而,biblatex它采用自己的方式:

% biblatex2.sty, line 728:
\protected\def\blx@warning#1{%
  \begingroup
  \blx@safe@actives
  \PackageWarning{biblatex}{#1\blx@noline}%
  \endgroup}

其中\blx@noline定义与以下相同(但稍后\@gobble将等效于):\@empty

% biblatex2.sty, line 754:
\let\blx@noline\@gobble

silence因此,用于中和的方法\@gobble不适用于biblatex

您还可以修补silence宏来识别\blx@noline

\documentclass[11pt,twoside]{article} 
\usepackage{silence}
\WarningsOff[biblatex]

\makeatletter
% New macro
\def\sl@RemoveBlxNoline#1\blx@noline\sl@Terminator#2\sl@Terminator{%
  \def\sl@Tempb{#2}%
  \ifx\sl@Tempb\@empty
  \else
    \def\sl@Tempa{#1}%
    \expandafter\@gobble
  \fi
  }
\def\sl@StoreMessage#1{%
  \ifsl@SafeMode
    \sl@UnexpandedMessage{#1}%
  \else
    \sl@UnexpandedMessage{#1}%
    \begingroup
    \let\protect\string
    \let\noexpand\string
    \def\sl@Tempa{#1}%
    \sl@RemoveGobble#1\sl@Terminator\@gobble\sl@Terminator\sl@Terminator
    \sl@RemoveGobbletwo#1\sl@Terminator\@gobbletwo\sl@Terminator\sl@Terminator
    %%% ADDED TEST
    \sl@RemoveBlxNoline#1\sl@Terminator\blx@noline\sl@Terminator\sl@Terminator
    %%%
    \edef\sl@Tempa{\sl@Tempa}%
    \global\expandafter\sl@Message\expandafter{\sl@Tempa}%
    \endgroup
  \fi}
\makeatother

\usepackage[log-declarations=false]{xparse}
\usepackage[quiet]{fontspec}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\begin{document}
Testing
\end{document}

这样警告

Package biblatex Warning: Macro 'reviewauthor' undefined.
(biblatex)                Using \newbibmacro.

没有包裹时获得的内容silence就会消失。

您应该向的维护者提出功能请求silence

相关内容