Eine Möglichkeit wären in der Tat die verlinkten
data model constraints. Die machen allerdings in der Ausgabe nichts rot. Du bekommst dann nur eine Warnung beim Biber-Durchlauf, wenn Du Biber mit dem Schalter --validate-datamodel (-V) aufrufst. Für die Validierung muss eine eigene .dbx-Datei geschrieben und geladen werden (hier im Beispiel mit filecontents, um alles in einer Datei zu haben, in Wirklichkeit wird man die .dbx natürlich extern haben). Die Standard-constraints verlangen recht wenig und warnen daher nicht sehr schnell. Du kannst sie Dir am Ende von
blx-dm.def ansehen
\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{moreconstraints.dbx}
\DeclareDatamodelConstraints[
book,
inbook,
bookinbook,
suppbook,
collection,
incollection,
suppcollection,
mvbook,
mvcollection,
proceedings,
inproceedings,
reference,
inreference,
]{
\constraint[type=mandatory]{
\constraintfield{publisher}
\constraintfield{location}
}
}
\end{filecontents}
\usepackage[backend=biber, datamodel=moreconstraints, style=authoryear]{biblatex}
\begin{filecontents}{\jobname.bib}
@book{appleby,
author = {Humphrey Appleby},
title = {On the Importance of the Civil Service},
date = {1980},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cite{appleby}
\printbibliography
\end{document}
produziert z.B.
D:\Moritz\Documents\TeX\zeample>biber -V dataconstraints
INFO - This is Biber 2.12
INFO - Logfile is 'dataconstraints.blg'
INFO - Reading 'dataconstraints.bcf'
INFO - Found 1 citekeys in bib section 0
INFO - Processing section 0
INFO - Looking for bibtex format file 'dataconstraints.bib' for section 0
INFO - LaTeX decoding ...
INFO - Found BibTeX data source 'dataconstraints.bib'
WARN - Datamodel: Entry 'appleby' (dataconstraints.bib): Missing mandatory field 'publisher'
WARN - Datamodel: Entry 'appleby' (dataconstraints.bib): Missing mandatory field 'location'
INFO - Overriding locale 'de-DE' defaults 'variable = shifted' with 'variable = non-ignorable'
INFO - Overriding locale 'de-DE' defaults 'normalization = NFD' with 'normalization = prenormalized'
INFO - Sorting list 'nyt/global//global/global' of type 'entry' with template 'nyt' and locale 'de-DE'
INFO - No sort tailoring available for locale 'de-DE'
INFO - Writing 'dataconstraints.bbl' with encoding 'UTF-8'
INFO - Output to dataconstraints.bbl
INFO - WARNINGS: 2
Bei darauf folgenden LaTeX-Durchläufen werden die Warnung standardmäßig (wenn nicht mit bibwarn=false unterdrückt) auch in der .log-Datei wiederholt.
Wenn Du wirklich eine visuelle Warnung in der Ausgabe möchtest, dann kannst Du das anders aufziehen. Wir können ausnutzen, dass Biber uns mit einer
source map in die Felder der .bib-Einträge schreiben lässt. Wenn wir das mit overwrite=false machen, wird vorhandener Feldinhalt nicht überschrieben, was bedeutet, dass wir nur in leere Felder schreiben. Wenn wir da jetzt eine kleine Nachricht hinterlassen, das etwas fehlt, wird diese im Literaturverzeichnis angezeigt als wäre sie der eigentliche Feldinhalt.
\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear]{biblatex}
\usepackage{xcolor}
\newrobustcmd*{\missingfield}[1]{%
\textcolor{red}{Field \texttt{#1} missing}%
\PackageWarningNoLine{biblatex}{%
Field '#1' missing in entry \thefield{entrykey}}}
\DeclareSourcemap{
\maps[datatype=bibtex, overwrite=false]{
\map{
\pertype{book}\pertype{collection}\pertype{proceedings}
\pertype{inbook}\pertype{incollection}\pertype{inproceedings}
\step[fieldset=publisher, fieldvalue={\missingfield{publisher}}]
}
\map{
\pertype{book}\pertype{collection}\pertype{proceedings}
\pertype{inbook}\pertype{incollection}\pertype{inproceedings}
\step[fieldset=location, fieldvalue={\missingfield{location}}]
}
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
author = {Humphrey Appleby},
title = {On the Importance of the Civil Service},
date = {1980},
publisher = {Pub \& Co.},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cite{appleby}
\printbibliography
\end{document}
Der Befehl muss robust sein, damit er beim Schreiben der Anweisung für Biber in die .bcf-Datei nicht ungewollt expandiert wird.