593 private links
Let's say you have a very large Zotero library, from which you export a likewise large BibLaTeX file, say full-library.bib
.
In your document you load that large BIB-file (because that's easy), \addbibresource{full-library.bib}
, but naturally cite only a subset of works.
Now you want to share the source code for this document with someone else, and provide them with a BIB-file so they can recompile it if they wish. Can we produce a BIB-file containing only the entries that were actually cited in the document?
Yes, we can. biber
has built-in support for this scenario. Just make sure your latest compilation produced a proper .bcf
file, then:
biber --output_format=bibtex --output_resolve document.bcf
which will create document_biber.bib
, a properly formatted BibLaTeX BIB-file containing only the subset of works from your library that were actually cited in this document.
I'm afraid I don't remember where I learned this.
Using biblatex with a numeric style and a book class with frontmatter/mainmatter, would it be possible to have all citations in the frontmatter appear last in the list of references, as if the frontmatter (from biblatex's point of view) appeared after the mainmatter?
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,sorting=none,style=nature]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{hydrogen,
author = {Author, A.},
year = {2001},
title = {Alpha}}
@misc{neodymium,
author = {Luthor, Lex.},
year = {2002},
title = {Bravo}}
\end{filecontents}
\addbibresource{\jobname.bib}
\frontmatter
\cite{neodymium}
\mainmatter
\cite{hydrogen}
\backmatter
\printbibliography[title={List of references}]
\end{document}
In the above MWE, references in the "List of references" are printed in the same order as they were given in the document, so neodymium
would be listed before hydrogen
in the "List of references".
This also means that the citation in the frontmatter would be labelled [1]
in the text and the first citation in the mainmatter would be labelled [2]
.
This is just as expected with the numeric style as often used in science and engineering theses.
I wonder if there is some way to make the first citation in the mainmatter be [1]
(because it might be jarring for the reader to see the first citation in the first chapter be something like [11]
, it may make them wonder what they missed), without having a separate \printbibliography
for the frontmatter (nor using refsection
or refsegments
, because I don't think they will help in this case). Preferably any citations in the frontmatter would simply be appended to the end of "List of references", as if the frontmatter was processed after the frontmatter by biblatex
.
I think this would be hard to achieve. But I'd like to hear if anyone knows better?
Would something like this be possible? Have I missed something obvious?
I have read the Sorting section in the biblatex manual, and read these related (but not-very-pertinent) questions on TeX.SE
- https://tex.stackexchange.com/questions/540610/numbering-issue-in-printbiblography/540615
- https://tex.stackexchange.com/questions/306678/biblatex-have-two-separate-bibliographies-with-consecutive-numbering
- https://tex.stackexchange.com/questions/244150/citations-out-of-order-with-appendix-and-split-bibliographies-in-backmatter
I am heavily indebted to Hoger Gerhardt for posting his example on TeX.SE.
I chose to put a DOI symbol (thanks to the Academicons package) at the end of each bib entry. I think it looks rad.
\usepackage[backend=biber,date=year,doi=true,url=false,style=nature]{biblatex}
\usepackage{fontawesome5}
\usepackage{academicons}
\usepackage{hyperref}
\renewbibmacro*{finentry}{%
\iffieldundef{doi}{%
% Entry lacks DOI
\iffieldundef{url}{%
% Entry lacks URL and DOI
\finentry%
}{%
% Entry has URL but lacks DOI
% Show URL hyperlink as icon (concsiously not using same icon as our "external hyperlinks")
\finentry\space%
\href{\thefield{url}}{\footnotesize\faIcon{link}}%
}%
}{%
% Entry has DOI \aiDoi
\finentry\space%
% lower the DOI symbol a little to align better with baseline
\href{https://doi.org/\thefield{doi}}{\raisebox{-0.1ex}{\aiDoi}}%
}%
}%
% suppress output of DOI field (hide both DOI label and string)
\DeclareFieldFormat{doi}{}%
Here's an example of how the typeset bibliography entries look like (please excuse the poor resolution, the screenshotter suddenly decided to drop the quality):