[Tex/LaTex] Dataset reference style in BibLaTeX

biblatex

The journal I am submitting to wants datasets to be listed in the reference as

[dataset] Authors; Year; Dataset title; Data repository or archive; Version (if any); Persistent identifier (e.g. DOI),

where "[dataset]" at the beginning is literal. The type of other references (articles, books, etc) does not need to be prefixed in this way.

biblatex has a @dataset entry type, and I have gotten close to the target using this:

\documentclass{article}
\usepackage[style=apa]{biblatex}

\begin{filecontents}{\jobname.bib}
@dataset{test,
  author = {The Author},
  title = {Very Big and Important Dataset},
  year = {2020},
  doi = {XX.XXXX/XXX.XXXX.XXXXXXXX},
  publisher = {Dryad}}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
  Text \parencite{test}.

  \printbibliography
\end{document}

enter image description here

This looks pretty good, but how can I get the [dataset] added to the beginning?

Best Answer

With most biblatex styles you can hook into the beginning of the entry by redefining the bibmacro begentry. Then it's just a matter of checking the entry type and printing a suitable string.

The original definition of begentry can be found in apa.bbx (ll. 673-674).

\documentclass{article}
\usepackage[style=apa]{biblatex}

\NewBibliographyString{dataset}

\DefineBibliographyStrings{english}{
  dataset = {dataset},
}

\renewbibmacro{begentry}{%
  \ifkeyword{meta}{\textsuperscript{*}}{}%
  \ifentrytype{dataset}
    {\bibstring[\mkbibbrackets]{dataset}%
     \setunit{\addspace}}
    {}%
}

\begin{filecontents}{\jobname.bib}
@dataset{test,
  author    = {The Author},
  title     = {Very Big and Important Dataset},
  year      = {2020},
  doi       = {XX.XXXX/XXX.XXXX.XXXXXXXX},
  publisher = {Dryad},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
  Text \autocite{test}.

  \printbibliography
\end{document}

[Dataset] Author, T. (2020). Very big and important dataset. Dryad. https://doi.org/XX.XXXX/XXX.XXXX.XXXXXXXX

I don't think this kind of markup is particularly useful. Most readers who care can probably tell that the entry is a data set fairly quickly anyway. What I find most problematic about this is that the "[dataset]" visually shields the "Author 2020" in the bibliography, but "Author 2020" is relevant for sorting.

Related Question