When I read the title of the question, I immediately thought of the crossref
feature shown in What is the Bibtex crossref field used for?, which @samcarter_is_at_topanswers.xyz already linked in the comments. But for your use case I'd probably prefer a Biber sourcemap to override field values easily from within your .tex
document.
Compare the value from the .bib
file (2020-02-02) to the value set by the sourcemap and shown in the output (2023-02-20). Note that the sourcemap only works if a urldate
is present in the .bib
entry (it will not add urldate
s to entries that don't have them yet - that could be done, but would probably be overkill).
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear]{biblatex}
\DeclareSourcemap{
\maps{
\map[overwrite=true]{
\step[fieldsource=urldate, final]
\step[fieldset=urldate, fieldvalue={2023-02-20}]
}
}
}
\begin{filecontents}{\jobname.bib}
@book{elk,
author = {Anne Elk},
title = {A Theory on Brontosauruses},
year = {1972},
publisher = {Monthy \& Co.},
location = {London},
url = {https://example.edu/~elk/bronto},
urldate = {2020-02-02},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \autocite{sigfridsson,elk}
\printbibliography
\end{document}
The sourcemap shown here applies to all entries alike. If you need to give different dates for different entries, you can filter by entrykey
, but of course that might get messy rather quickly
\DeclareSourcemap{
\maps{
\map[overwrite=true]{
\step[fieldsource=entrykey, match=\regexp{\Aelk\Z}, final]
\step[fieldsource=urldate, final]
\step[fieldset=urldate, fieldvalue={2023-02-20}]
}
}
}
Compare also biblatex: remove field from specific entry.