0

I'm using Biblatex and would like to remove entries with an empty annote field. The solution described here works: biblatex reading style - how to remove entries without an annotation?. But it doesn't work when using `loadfiles' for external storage of annotations. Could anyone show me how to get this working when using the 'loadfiles' option?

1 Answer 1

1

If you want to check for annotations loaded by the loadfiles option, you cannot use a Biber sourcemap, because Biber has no interface to check for the existence of those files.

You can define a bibcheck to look for the files, though. The bibcheck below shows an entry if it has an annotation field or if there is an annotation file found by loadfiles.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=reading]{biblatex}

\defbibcheck{hasannotation}{%
  \iffieldundef{annotation}
    {\IfFileExists{\bibannotationprefix\thefield{entrykey}.tex}
       {}
       {\skipentry}}
    {}%
}

\begin{filecontents}{\jobname.bib}
@book{elk,
  author     = {Anne Elk},
  title      = {A Theory on Brontosauruses},
  year       = {1972},
  publisher  = {Monthy \& Co.},
  location   = {London},
  annotation = {This is an inline annotation},
}
@book{belk,
  author     = {Anne Belk},
  title      = {A Theory on Triceratops},
  year       = {1973},
  publisher  = {Monthy \& Co.},
  location   = {London},
}
@book{celk,
  author     = {Anne Clk},
  title      = {A Theory on Pterodactylus},
  year       = {1974},
  publisher  = {Monthy \& Co.},
  location   = {London},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{filecontents}{bibannotation-belk.tex}
This is a file annotation.
\end{filecontents}

\begin{document}
Lorem \autocite{elk,belk,celk}

\printbibliography[check=hasannotation]
\end{document}

Belk: A Theory on Triceratops
Elk: A Theory on Brontosauruses

Note that a bibcheck is weaker than a Biber sourcemap in the sense that a Biber sourcemap discards an entry from all Biber processing. The bibcheck will only hide the entry in the relevant bibliography. Label uniqueness and other features will still apply to the hidden entry.

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.