Package: mathbib
MathBibMathBib is a mathematics BibLaTeX bibliography manager.WARNING: MathBib is currently in alpha state. The API and other implementation details may change substantially!Installation and basic usageFirst, ensure thatmbibis installed withpipinstallmathbibThis installs thembibcommand-line interface.
The first useful subcommand ismbib get.
For instance, runningmbibgetarxiv:1212.1873will retrieve the arxiv record athttps://arxiv.org/abs/1212.1873.
If you check the output, you will notice that it actually returns@article{arxiv:1212.1873,author={Hochman, Michael},eprint={1337.28015},eprinttype={zbl},journal={Ann. Math.},language={English},number={2},pages={773--822},publisher={Annals of Mathematics},title={On self-similar sets with overlaps and inverse theorems for entropy},volume={180},year={2014}}This contains more information than what can be found on arxiv!
In generalmbibwill search multiple locations for records to build the most updated citation possible.Generating records from command-line arguments is nice, but a much more common use case is to generate records corresponding to a file.
Suppose you have a filedoc.texcontaining the contents\documentclass{article}\usepackage{biblatex}\addbibresource{doc.bib}\begin{document}This document references an article\cite{arxiv:1212.1873}.
It also contains more references\cite{zbl:1251.28008, doi:10.4007/annals.2019.189.2.1}.\printbibliography\end{document}Simply runmbibgeneratedoc.tex--outdoc.bibto build the.bibfile, and compile.Of course, it can be somewhat inconvenient to remember a large number of citation keys, especially ones that are designed to be machine-readable.
One solution is to create aliases.
Let's define a few:mbibaliasaddHoc2014arxiv:1212.1873
mbibaliasaddHocShm2012zbl:1251.28008
mbibaliasaddShm2019doi:10.4007/annals.2019.189.2.1We could now instead write our file  as\documentclass{article}\usepackage{biblatex}\addbibresource{doc.bib}\begin{document}This document references an article\cite{Hoc2014}.
It also contains more references\cite{HocShm2012, Shm2019}.\printbibliography\end{document}Remember to regenerate thedoc.bibfile withmbib generate doc.tex --out doc.bib(the citation keys need to be updated), and the file will compile!
Aliases also work as command line arguments anywhere akey:idis expected.Suppose you have been working on the above TEX document for a while, and now you want to cite a specific theorem from the paperHoc2014.
Simply runmbibfileopenHoc2014to open the PDF file associated with the resource.
This will automatically download a PDF resource for the file (ifmbibcan find one online) and then open it.
The PDF file is also saved locally, so the next time you run this command, you do not need an internet connection.Of course, ifmbibcannot find a resource for your file, you can also add one yourself.mbibfileaddHoc2014path/to/file.pdfFinally, if you have loaded a record but there are mistakes (for instance, improperly formatted LaTeX), you can apply local modifications which will always be applied when requesting the record.
Edit the local record with, for example,mbibfileopenzbl:1251.28008There are also other features implemented: either read more below, or runmbib --helpandmbib <subcommand> --helpfor more information.Remote and local recordsInternally, whenever you request a new record, MathBib searches a few online data repositories for the information associated with the record.
Currently, the followingKEY:types are supportedlocal:(WARNING: not yet supported) internal local recordszbl:zbMATH Identifiersdoi:Digital Object Identifiermr:(WARNING: not yet supported)MathSciNetzbmath:zbMath Internal Identifierarxiv:arXiv Identifierisbn:International Standard Book Number.ol:Open Libraryresource identifiers.The requests to the various sources are cached in$XDG_CACHE_HOME/mathbib.
In particular, the first search will be slow, but afterwards the request will resolve quickly.You can see all the information collected by MathBib by running, for instance,mbib get -r json arxiv:1212.1873Note that MathBib also has an internal notion of record priority.
Local modifications of records have the highest priority, and otherwise the priority is precisely as specified in the list above.
For instance, if you runmbib show arxiv:1212.1873, your web browser will open a record on zbMATH.
If you view the corresponding JSON record, you will see thezbl:entry has the highest priority.Useful scriptsThe output ofmbib listis designed to be machine-readable.
For example, to make it easier to find keys associated with documents, I find the following script (written inFish) useful:functionpa --description'Search MathBib record keys using fzf'ifcount$argv>/dev/nullset--function fzf_opts --query"$argv"endset--local captured(mbib list|fzf$fzf_opts|cut -d" "-f 1)iftest-n"$captured"echo$capturedendendFor instance, you can use this command whenever a key is required:mbib fileopen(pa)will prompt you to choose a file name, and then open the file.Contributing and future improvementsMathBib is still under active development!
Some planned features include:Rework the code for remote record searching and parsing.Asynchronous requests for faster record downloading.Nicer printing and viewing usingrich.Proper implementation of local records.