3

I'm trying to do a custom \citesoftware command for BibLaTeX. I would like to cite in the document a software like

NameOfTheSoftware, Developers Year

For instance, for the entry

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

I would like to have

Hadoop, Apache Software Fundation 2010

For now I have something like this:

\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}}

Unfortunately, I do not know why, on the output file I only got title and year, but no "authors".

Hadoop, 2016

Any suggestion?

5

Directly from the package documentation:

The biblatex package implements three distinct data types to handle bibliographic data: name lists, literal lists, and fields.

The data type author is of the kind list (name), hence you have to use \printnames{author} instead of \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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.