Somewhat complex problem:
For simplicity I have a single large bib file that I modify with biblatex source maps to customize for different papers.
To help readers find some harder to locate papers, I started adding OCLC numbers through the addendum field. I made a command to automatically link to the WorldCat entry for the journal given the OCLC number.
For error checking, I added a command to check that the OCLC number is valid. This command will produce an error if the OCLC number is not a positive integer. Unfortunately it appears that this extra code causes a "! Missing { inserted." error on the \printbibliography line for one entry with an extra addendum. I have no idea why. I remove the \RequirePosInt{#1} from the \OCLC command and this compiles fine. I put the updated addendum in the bib file rather than source map and this compiles fine too.
Minimum working example:
\documentclass{article}
% https://texfaq.org/FAQ-isitanum
\def\IsPositive#1{%
TT\fi%
\ifcat_\ifnum0<0#1 _\else A\fi%
}
\newcommand*{\RequirePosInt}[1]{%
\if\IsPositive{#1}%
\typeout{Is positive integer: #1}%
\else%
\PackageError{requireinteger}{Positive integer expected: #1}{}%
\fi%
}
\usepackage{hyperref}
\newcommand*{\OCLC}[1]{OCLC: \href{https://www.worldcat.org/oclc/#1}{#1}\RequirePosInt{#1}}
\usepackage[style=numeric,backend=biber,natbib=true]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{huh_phenomenological_1991,
location = {{Tsukuba, Japan}},
title = {A Phenomenological Model of Diesel Spray Atomization},
volume = {2},
booktitle = {Proceedings of the International Conference on Multiphase Flows},
author = {Huh, K. Y. and Gosman, A. D.},
editor = {Matsui, G.},
date = {1991},
pages = {515--518},
addendum = {\OCLC{831380048}}
}
@article{huh_diesel_1998,
title = {Diesel Spray Atomization Model Considering Nozzle Exit Turbulence Conditions},
volume = {8},
issn = {1044-5110},
doi = {10.1615/AtomizSpr.v8.i4.60},
number = {4},
journaltitle = {Atomization and Sprays},
author = {Huh, Kang Y. and Lee, Eunju and Koo, Jaye},
date = {1998},
pages = {453--469}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=entrykey, match={huh_phenomenological_1991}, final]
\step[fieldset=addendum, fieldvalue={\OCLC{831380048} (See the citation for \citet{huh_diesel_1998} for a note about an error in this paper.)}]
}
}
}
\begin{document}
\nocite{huh_phenomenological_1991}
\printbibliography
\end{document}
As a side note if anyone knows a better or cleaner way to do what I intend to do, I'm interested.
