如果另一个字段为空,使用 biblatex 将字段值从一个字段复制到另一个字段

如果另一个字段为空,使用 biblatex 将字段值从一个字段复制到另一个字段

我使用了一个设置,其中有一个字段 authauthor,其中包含应该显示在作者索引中的作者的标准名称。从 biblatex 中索引的另一个字段获取名称我也想使用 authauthor 的值进行排序。因此,我正在寻找可以检查文件 sortname 是否有值的方法,如果没有但 authauthor 有值,则将 authauthor 的值复制到 sortname。可以用 biblatex 来实现吗?

\documentclass{scrbook}            

\usepackage[
natbib=true,
style=langsci-unified,
citestyle=langsci-unified,
datamodel=langsci,   % add authauthor and autheditor as possible fields to bibtex entries
backend=biber,
indexing=cite
]{biblatex}


\begin{filecontents}{bibliography.bib}
@incollection{Steedman89,
        authauthor = {Mark Steedman},
        author = {Steedman, Mark J.},
        pages = {463--504},
        sortname = {Mark Steedman},
        address = {Cambridge},
        booktitle = {Lexical Representation and Process},
        editor = {Marslen-Wilson, William},
        publisher = {The MIT Press},
        title = {Lexical Representation and Process},
        year = {1989},
        title = {Grammar, Interpretation, and Processing from the Lexicon}}

@incollection{Steedman90,
        authauthor = {Mark Steedman},
        author = {Steedman, Mark J.},
        pages = {463--504},
        %sortname = {Mark Steedman},
        address = {Cambridge},
        booktitle = {Lexical Representation and Process},
        editor = {Marslen-Wilson, William},
        publisher = {The MIT Press},
        title = {Lexical Representation and Process},
        year = {1990},
        title = {Grammar, Interpretation, and Processing from the Lexicon}}


@incollection{Steedman91,
        authauthor = {Mark Steedman},
        author = {Steedman, Mark J.},
        pages = {463--504},
        sortname = {Mark Steedman},
        address = {Cambridge},
        booktitle = {Lexical Representation and Process},
        editor = {Marslen-Wilson, William},
        publisher = {The MIT Press},
        title = {Lexical Representation and Process},
        year = {1991},
        title = {Grammar, Interpretation, and Processing from the Lexicon}}

\end{filecontents}

\addbibresource{bibliography.bib}

\begin{document}

\citep{Steedman89,Steedman90,Steedman91}

\printbibliography 

\end{document}

示例显示,如果在第二个条目中注释掉字段 sortname,则此项排序错误。sortname 应该以某种方式从 authauthor 接管。

答案1

您可以使用 Biber sourcemap 将一个字段的值复制到另一个字段。一个这样的示例(其中第一个字段也被删除)是如何将字段注释移至参考文献末尾

但是,在您的用例中,这对我来说似乎没有必要。将authauthor和添加autheditor到排序方案中可能更容易。然后您不再需要将其值复制到sortname

\documentclass{article}

\usepackage[
natbib=true,
style=langsci-unified,
datamodel=langsci, % add authauthor and autheditor as possible fields to bibtex entries
backend=biber,
indexing=cite
]{biblatex}

\DeclareSortingTemplate{nyt}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{authauthor}
    \field{author}
    \field{autheditor}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}

\begin{filecontents}{\jobname.bib}
@incollection{Steedman89,
        authauthor = {Mark Steedman},
        author = {Steedman, Mark J.},
        pages = {463--504},
        sortname = {Mark Steedman},
        address = {Cambridge},
        booktitle = {Lexical Representation and Process},
        editor = {Marslen-Wilson, William},
        publisher = {The MIT Press},
        title = {Lexical Representation and Process},
        year = {1989},
        title = {Grammar, Interpretation, and Processing from the Lexicon}}

@incollection{Steedman90,
        authauthor = {Mark Steedman},
        author = {Steedman, Mark J.},
        pages = {463--504},
        %sortname = {Mark Steedman},
        address = {Cambridge},
        booktitle = {Lexical Representation and Process},
        editor = {Marslen-Wilson, William},
        publisher = {The MIT Press},
        title = {Lexical Representation and Process},
        year = {1990},
        title = {Grammar, Interpretation, and Processing from the Lexicon}}


@incollection{Steedman91,
        authauthor = {Mark Steedman},
        author = {Steedman, Mark J.},
        pages = {463--504},
        sortname = {Mark Steedman},
        address = {Cambridge},
        booktitle = {Lexical Representation and Process},
        editor = {Marslen-Wilson, William},
        publisher = {The MIT Press},
        title = {Lexical Representation and Process},
        year = {1991},
        title = {Grammar, Interpretation, and Processing from the Lexicon}}

\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\citep{Steedman89,Steedman90,Steedman91}

\printbibliography 

\end{document}

Steedman, Mark J. 1989. 语法、解释和词汇处理。William Marslen-Wilson (ed.),词汇表征和过程,463–504。剑桥:麻省理工学院出版社。Steedman, Mark J. 1990. 语法、解释和词汇处理。William Marslen-Wilson (ed.),词汇表征和过程,463–504。剑桥:麻省理工学院出版社。Steedman, Mark J. 1991. 语法、解释和词汇处理。William Marslen-Wilson (ed.),词汇表征和过程,463–504。剑桥:麻省理工学院出版社。

相关内容