BibLaTeX:软件的自定义引用命令

BibLaTeX:软件的自定义引用命令

我正在尝试\citesoftware为 BibLaTeX 执行自定义命令。我想在文档中引用类似这样的软件

NameOfTheSoftware, Developers Year

例如,对于条目

@software{hadoop,
  author = {{Apache Software Foundation}},
  title = {Hadoop},
  url = {https://hadoop.apache.org},
  version = {0.20.2},
  date = {2010-02-19},
}

我想拥有

Hadoop, Apache Software Fundation 2010

现在我有这样的东西:

\usepackage{csquotes}
\usepackage[style=numeric,
            doi=false,
            isbn=false,
            url=false]{biblatex}
\addbibresource{software.bib}

\DeclareCiteCommand{\citesoftware}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifentrytype{software}{
    \printfield{title}%
    \setunit{\space}%
    \printfield{author}%
    \setunit{\space}%
    \printfield{year}}{\GenericError{}{Not a software entry}{}{}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

不幸的是,我不知道为什么,在输出文件中我只得到了标题和年份,但没有“作者”。

Hadoop, 2016

有什么建议吗?

答案1

直接从包文档中:

biblatex 包实现了三种不同的数据类型来处理书目数据:名称列表、文字列表和字段。

数据类型author属于列表名称),因此您必须使用\printnames{author}而不是\printfield{author}

\begin{filecontents}{software.bib}
    @software{hadoop,
        author = {{Apache Software Foundation}},
        title = {Hadoop},
        url = {https://hadoop.apache.org},
        version = {0.20.2},
        date = {2010-02-19},
        }
\end{filecontents}

\documentclass{article}
\usepackage{csquotes}
\usepackage[style=numeric,backend=biber,
    doi=false,
    isbn=false,
    url=false]{biblatex}

\DeclareCiteCommand{\citesoftware}
    {\boolfalse{citetracker}%
        \boolfalse{pagetracker}%
        \usebibmacro{prenote}}
    {\ifentrytype{software}{% this % is necessary in order avoiding undesidered space
            \printfield{title}%
            \setunit{\addcomma\addspace}% , added
            \printnames{author}%
            \setunit{\addspace}%
            \printfield{year}}{\GenericError{}{Not a software entry}{}{}}}
    {\multicitedelim}
    {\usebibmacro{postnote}}

\addbibresource{software.bib}

\begin{document}

    This is the big data citation: \citesoftware{hadoop}

    \printbibliography

\end{document}

在此处输入图片描述

相关内容