Biblatex/biber 代码已停止工作

Biblatex/biber 代码已停止工作

这段代码最近开始标记错误,之前从未这样做过。错误是

Illegal parameter number in definition of \blx@defformat@d. ...\addcomma\addspace #1\addcomma\addspace #4 (followed by: })

代码如下:

\DeclareNameFormat{author}{%
  \ifnumequal{\value{listcount}}{1}
    {\ifnumequal{\value{liststop}}{1}
      {#1\addcomma\addspace #4\addcomma\isdot}
      {#1\addcomma\addspace #4}}
    {\ifnumless{\value{listcount}}{\value{liststop}}
      {\addcomma\addspace #1\addcomma\addspace #4}
      {\addcomma\addspace\bibstring{and} #1\addcomma\addspace #4\addcomma\isdot}%
    }%

请问为什么会发生这种情况?我该如何解决?

答案1

使用biblatex标准样式和 3.5 版本,您可以获得您想要的bib latex 中作者/编辑后的标点符号有两条线

\DeclareNameAlias{sortname}{family-given} 
\DeclareDelimFormat[biblist,bib]{nameyeardelim}{\addcomma\space}

不幸的是,biblatex-philosophy目前还没有使用这些花哨的新功能,我们必须自己启用它们。我们只是在适当的位置更改了\addspace/ \printdelim{nameyeardelim}\printdelim{nonameyeardelim}(请注意,来自的宏biblatex-classic.bbx几乎是其对应宏的精确副本,authoryear.bbx并添加了对的支持nameaddon。)

\renewbibmacro*{author}{%
  \ifboolexpr{%
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }%
    {\usebibmacro{bbx:dashcheck}%
       {\bibnamedash}%
       {\usebibmacro{bbx:savehash}%
        \printnames{author}%
        \iffieldundef{nameaddon}{}%
          {\setunit{\addspace}%
           \printtext[brackets]{\printfield{nameaddon}}}%
        \iffieldundef{authortype}%
          {\setunit{\printdelim{nameyeardelim}}}%
          {\setunit{\addcomma\space}}}%
     \iffieldundef{authortype}%
       {}%
       {\usebibmacro{authorstrg}%
        \setunit{\printdelim{nameyeardelim}}}}%
    {\global\undef\bbx@lasthash%
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \usebibmacro{date+extrayear}}%


\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{%
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }%
    {\usebibmacro{bbx:dashcheck}%
       {\bibnamedash}%
       {\printnames{editor}%
        \setunit{\addspace}%
        \usebibmacro{bbx:savehash}}%
     \usebibmacro{#1}%
     \clearname{editor}%
     \setunit{\printdelim{nameyeardelim}}}%
    {\global\undef\bbx@lasthash%
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \usebibmacro{date+extrayear}}%

从这一点来看,上面的两条线做的正是正确的事情。

MWE(改编自bib latex 中作者/编辑后的标点符号

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[a4paper,twoside]{memoir} 
\usepackage[english]{babel}
\usepackage[style=british]{csquotes}
\usepackage[style=philosophy-classic, giveninits=true, uniquename=init, natbib=true, backend=biber, indexing=true, defernumbers=true]{biblatex}

\DeclareNameAlias{sortname}{family-given} 

\addbibresource{biblatex-examples.bib} 

 % Bibliography customisation
\renewcommand*{\newunitpunct}{\addcomma\space}

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1\adddot\nopunct\isdot}


\renewbibmacro{in:}{%
    \printtext{\bibstring{In}\addcolon\space}%
}

% Remove parentheses from year
\renewbibmacro*{date+extrayear}{%
      \begingroup%
        \clearfield{month}%
        \clearfield{day}%
    \ifboolexpr{%
      test {\iffieldundef{date}}
      and
      test {\iffieldundef{year}}
    }%
      {\iftoggle{bbx:nodate}{\printtext{%
        \midsentence\bibstring{nodate}}}{}}%
      {\printtext{\printdateextra}}%
       \endgroup}%

% Dot after year
\renewcommand{\labelnamepunct}{\adddot\space}

% Put number in parentheses
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
%  \setunit*{\adddot}% DELETED
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}

\DeclareDelimFormat[bib]{nameyeardelim}{\addcomma\space}
\DeclareDelimFormat[biblist]{nameyeardelim}{\addcomma\space}

\renewbibmacro*{author}{%
  \ifboolexpr{%
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }%
    {\usebibmacro{bbx:dashcheck}%
       {\bibnamedash}%
       {\usebibmacro{bbx:savehash}%
        \printnames{author}%
        \iffieldundef{nameaddon}{}%
          {\setunit{\addspace}%
           \printtext[brackets]{\printfield{nameaddon}}}%
        \iffieldundef{authortype}%
          {\setunit{\printdelim{nameyeardelim}}}%
          {\setunit{\addcomma\space}}}%
     \iffieldundef{authortype}%
       {}%
       {\usebibmacro{authorstrg}%
        \setunit{\printdelim{nameyeardelim}}}}%
    {\global\undef\bbx@lasthash%
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \usebibmacro{date+extrayear}}%


\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{%
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }%
    {\usebibmacro{bbx:dashcheck}%
       {\bibnamedash}%
       {\printnames{editor}%
        \setunit{\addspace}%
        \usebibmacro{bbx:savehash}}%
     \usebibmacro{#1}%
     \clearname{editor}%
     \setunit{\printdelim{nameyeardelim}}}%
    {\global\undef\bbx@lasthash%
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \usebibmacro{date+extrayear}}%

\begin{document}
\cite{sigfridsson,aksin,geer,worman,knuth:ct:a,knuth:ct:b,knuth:ct:c,cicero}
\printbibliography
\end{document}

第三页 - MWE 的参考书目

相关内容