TeX - LaTeX Asked by Selinde on December 3, 2020
I just started using biber / biblatex, and am having trouble understanding some of its behaviour. I cannot imagine that I am the first to have run into this issue, but I was unable to find a duplicate question.
I am citing several articles that are published in the same journal. To ensure that the journal information is consistent throughout the citations, I made a separate bib entry containing just the journal information. I then cross-reference that entry from the article entries. An example references.bib
file:
@article{myjournal,
journaltitle={Journal of Interesting Things},
publisher={Someone}
}
@article{myarticle1,
crossref={myjournal},
title={That thing},
author={Martypants, Susan},
year={2019},
}
@article{myarticle2,
crossref={myjournal},
title={That other thing},
author={Rofessor, Peter},
year={2020}
}
Now, when I cite both myarticle1
and myarticle2
in my document, the reference list contains an extra line with no name, and just the journal information:
A minimal working example that produces this output is:
documentclass{article}
usepackage[backend=biber,style=alphabetic]{biblatex}
addbibresource{references.bib}
begin{document}
cite{myarticle1,myarticle2}
printbibliography{}
end{document}
Interestingly, if I cite only one of the two articles, the "empty" journal item does not appear. (i.e., replacing cite{myarticle1,myarticle2}
with cite{myarticle1}
results in a reference list of one item instead of three.)
Workaround solutions: I can copy-paste the journal info into every paper, and remove the crossref. However, if I later want to change some information about the journal (e.g., add an address of the publisher), I’d have to go through all the entries. Alternatively, I can remove the entry manually from the .bbl
file, which also results in the desired output. Neither of these solutions are quite satisfactory to me.
Question: What is the preferred way to structure the .bib
so that (a) I don’t have to type and maintain duplicate journal information, and (b) the journal entry does not appear as a separate item in the references list, unless explicitly cited?
Thank you for your help!
The crossref
field is about more than just data inheritance. It is also about establishing a certain parent-child relation between entries (cf. the xref
field, which only models this parent-child relation without data inheritance).
One feature of this parent-child relation is that a parent entry is automatically added to the bibliography if it is referred to by a certain number of children (even if it is not cited explicitly). The exact number of child references can be controlled with the mincrossrefs
option. Its default value is 2
, meaning that a parent entry is added to the bibliography if it is referred to by at least two (different) child entries. That is the case in your example: myjournal
is referenced by myarticle1
and myarticle2
.
One way around that would be to set mincrossrefs
to a higher (maybe unreasonably high) value such as 999
as suggested by Manuel Weinkauf in the comments.
documentclass{article}
usepackage[backend=biber, style=alphabetic, mincrossrefs=999]{biblatex}
begin{filecontents}{jobname.bib}
@article{myjournal,
journaltitle = {Journal of Interesting Things},
publisher = {Someone},
}
@article{myarticle1,
crossref = {myjournal},
title = {That thing},
author = {Martypants, Susan},
year = {2019},
}
@article{myarticle2,
crossref = {myjournal},
title = {That other thing},
author = {Rofessor, Peter},
year = {2020},
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
autocite{myarticle1,myarticle2}
printbibliography
end{document}
An alternative would be to tell biblatex
that myjournal
is only a data container and not an entry that could appear in the bibliography in its own right. That is done by adding options = {dataonly},
to the entry. This is not unlike Cicada's suggestion of options={skipbib=true},
, but slightly more rigorous (since it will also avoid label creation, which fails here anyway, to be fair). With this solution myjournal
doesn't even appear in the bibliography when cited explicitly, though.
documentclass{article}
usepackage[backend=biber, style=alphabetic]{biblatex}
begin{filecontents}{jobname.bib}
@article{myjournal,
journaltitle = {Journal of Interesting Things},
publisher = {Someone},
options = {dataonly},
}
@article{myarticle1,
crossref = {myjournal},
title = {That thing},
author = {Martypants, Susan},
year = {2019},
}
@article{myarticle2,
crossref = {myjournal},
title = {That other thing},
author = {Rofessor, Peter},
year = {2020},
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
autocite{myarticle1,myarticle2}
printbibliography
end{document}
If you don't want to establish this additional parent-child relation it may be better to choose a different tool for the job: Cicada suggested @xdata
containers in the comments. The biblatex
documentation explains xdata
as follows (§2.2.3 Special Fields, p. 31)
This field inherits data from one or more
@xdata
entries. Conceptually, thexdata
field is related tocrossref
andxref
:crossref
establishes a logical parent/child relation and inherits data;xref
establishes as logical parent/child relation without inheriting data;xdata
inherits data without establishing a relation. The value of thexdata
may be a single entry key or a separated list of keys. See §3.13.6 for further details.
And that seems a great fit: xdata
is crossref
sans the parent-child relation that caused the undesired behaviour in the first place.
It should be noted, however, that @xdata
entries can't appear in the bibliography themselves and can't usefully be cited. Furthermore, the field inheritance with @crossref
can take into account the entry types of the parent and child entries and can set up rules like the title
field of a @collection
parent is inherited as booktitle
to an @incollection
child. This is not possible (and does not make sense) for @xdata
.
documentclass{article}
usepackage[backend=biber, style=alphabetic]{biblatex}
begin{filecontents}{jobname.bib}
@xdata{myjournal,
journaltitle = {Journal of Interesting Things},
publisher = {Someone},
}
@article{myarticle1,
xdata = {myjournal},
title = {That thing},
author = {Martypants, Susan},
year = {2019},
}
@article{myarticle2,
xdata = {myjournal},
title = {That other thing},
author = {Rofessor, Peter},
year = {2020},
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
autocite{myarticle1,myarticle2}
printbibliography
end{document}
In this particular case all standard styles will ignore the publisher
field for @article
s, so you are only inheriting one field, namely the journal(title)
. Single-field inheritance can also be modelled with @string
entries. (But of course that is not an option if you want to inherit multiple fields at once.)
documentclass{article}
usepackage[backend=biber, style=alphabetic]{biblatex}
begin{filecontents}{jobname.bib}
@string{myjournal = {Journal of Interesting Things}}
@article{myarticle1,
journal = myjournal,
title = {That thing},
author = {Martypants, Susan},
year = {2019},
}
@article{myarticle2,
journal = myjournal,
title = {That other thing},
author = {Rofessor, Peter},
year = {2020},
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
autocite{myarticle1,myarticle2}
printbibliography
end{document}
All of the posted example produce
Correct answer by moewe on December 3, 2020
Manuel Weinkauf's comment was indeed the solution:
usepackage[backend=biber,style=alphabetic,mincrossrefs=99]{biblatex}
I'm adding it as an answer so the question can be closed.
Answered by Selinde on December 3, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP