Discussion:
Multiple note fields in bibtex file
(too old to reply)
Peter Flynn
2018-01-25 14:40:11 UTC
Permalink
I am converting a large quantity of references into BiBTeX format for use with biblatex and biber. There are many occasions where a field in the source data has no direct match to a BiBTeX field, and I use 'note' if it needs to be exposed in the reference, and 'annote' if not.

A problem arises when there are many such fields per entry, leading to multiple note fields. As far as I can see, biber by default only uses the last such field.

Is there a way to persuade it to concatenate multiple note fields? Moewe's first answer to https://tex.stackexchange.com/questions/165936/several-strings-in-one-biblatex-field-multiple-references?rq=1 implies that biber cannot do this, but I thought I'd ask before I start rewriting my own code to put all the values into a single field.

P
Ulrike Fischer
2018-01-25 18:00:21 UTC
Permalink
Post by Peter Flynn
I am converting a large quantity of references into BiBTeX format
for use with biblatex and biber. There are many occasions where a
field in the source data has no direct match to a BiBTeX field,
and I use 'note' if it needs to be exposed in the reference, and
'annote' if not.
A problem arises when there are many such fields per entry,
leading to multiple note fields. As far as I can see, biber by
default only uses the last such field.
Not only biber, bibtex too will ignore additional note fields.
Post by Peter Flynn
Is there a way to persuade it to concatenate multiple note
fields?
I doubt it. A database shouldn't use the same key more than once.

But you could put the entries in fields notea, noteb, notec etc and
concatenate them with a source map:

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage{biblatex}
\addbibresource{test.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]
{
\step[fieldsource=notea,final]
\step[fieldset=note, origfieldval, append]
}
\map[overwrite,foreach={noteb,notec,noted}] %more if needed
{
\step[fieldsource=\regexp{$MAPLOOP},final]
\step[fieldset=note, fieldvalue={, {}}, append]
\step[fieldset=note, origfieldval, append]
}
}
}

\begin{document}
\cite{testnote}

\printbibliography
\end{document}


@article{testnote,
title={Title},
author={Author, A},
journal={Journal },
year={2018},
notea={A note a},
noteb = {A note b},
notec={A note c}
}
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
Peter Flynn
2018-01-25 22:45:58 UTC
Permalink
[...]
Post by Ulrike Fischer
Post by Peter Flynn
A problem arises when there are many such fields per entry,
leading to multiple note fields. As far as I can see, biber by
default only uses the last such field.
Not only biber, bibtex too will ignore additional note fields.
Yes, true.
Post by Ulrike Fischer
Post by Peter Flynn
Is there a way to persuade it to concatenate multiple note
fields?
I doubt it. A database shouldn't use the same key more than once.
I would argue that in the flat-file representation that is the .bib
format, a repeated non-key fieldname could imply concatenation. There's
really only one real key in the .bib format, and that's the entry label.
Several other fields are essentially containers for unnormalised values:
it would be a major convenience if one could write

@book{foo,
author = {Peter Flynn},
author = {Ulrike Fischer},
title = ...etc}
}

instead of having to use 'and' and have values running to several
hundred or even thousand characters.

But I digress, sorry...in my case it's moot anyway, as I never store the
master data in .bib file format anyway.
Post by Ulrike Fischer
But you could put the entries in fields notea, noteb, notec etc and
Oooh, thank you. What a neat idea.

///Peter
Ulrike Fischer
2018-01-26 08:42:36 UTC
Permalink
Post by Peter Flynn
it would be a major convenience if one could write
@book{foo,
author = {Peter Flynn},
author = {Ulrike Fischer},
title = ...etc}
}
You could make a feature request for biber.
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
Loading...