MathSciNet is a big database that has bibliographic information and reviews about most mathematical publications out there. I created a Shell script that automatically adds bibliography entries to a .bib files using the mathscinet MR numbers. This post explains how to use the script. 2 examples will be shown, one that uses natbib and the second with biblatex.

Notice you must have access to MathSciNet. Many universities already have a subscription so you can just go to the site from your university network.

## Installation

The script uses wget, grep and sed which are standard linux tools, usually you don’t have to install anything.

To use this script just download it from github, put it in you bin directory or in /usr/bin to make it available system-wide, then make it executable. This can be accomplished from a terminal with these commands

wget \
https://raw.githubusercontent.com/geriom/getmathscinetbib/master/getmbib \
-P $HOME/bin/ chmod a+x$HOME/bin/getmbib


If there’s no bin folder in your home directory you have to create it first.

## Getting the MR numbers

This script works assuming you used the MR numbers from mathscinet as your citation keys. How do you get these numbers?, go to MathSciNet and search for an item you want to add to your bibliography; for instance, let’s try the well-know An introduction to algebraic topology by Rotman.

The MR number shows up above the Author’s name, in this case the number is MR0957919.

Proceed to the next section to learn how to use this information.

## Natbib example

Let’s create a simple .tex file, it’s called nb_test.tex:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{natbib}
\bibliographystyle{unsrtnat}

\title{Bibliography From MathSciNet}
\author{Geri O M}
\date { }

\begin{document}

\maketitle

This document shows how to use the MR keys to cite sources from MathSciNet.
For instance, we can cite this great Topology book \cite{MR0957919}, also
not, let's throw the famous Einstein paper in the list \cite{einstein}.

\medskip

\bibliography{nb_sample}

\end{document}


As you can see, I used the MR number in my \cite{ } commands, also one of the cited sources is not from MathSciNet, so it should be already in the nb_sample.bib bib file. This is how the bibliography file looks right now:

@article{einstein,
author =  "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}.  ({German}) [{On}
the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004" }


Now let’s compile it from a terminal:

pdflatex nb_sample.tex


It will show a few warnings because of the missing bibliographies. We are going to use those warnings to retrieve the missing entries using the script. Open a terminal and run the following command:

getmbib nb_test nb_sample


The first argument for this command is the name of the tex file, the second is the name of the bib file, both without the file extensions. You should see something like this afterwards:

Retrieving bibliographies from MathScinet...
... Done! 2 bibliography sources added to nb_sample.bib


So let’s check nb_sample.bib. Open it in your favorite editor, it should now have the missing entries:

@article{einstein,
author =  "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}.  ({German}) [{On}
the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004" }

@book {MR0957919,
AUTHOR = {Rotman, Joseph J.},
TITLE = {An introduction to algebraic topology},
SERIES = {Graduate Texts in Mathematics},
VOLUME = {119},
PUBLISHER = {Springer-Verlag, New York},
YEAR = {1988},
PAGES = {xiv+433},
ISBN = {0-387-96678-1},
MRCLASS = {55-01},
MRNUMBER = {957919},
MRREVIEWER = {P. J. Kahn},
DOI = {10.1007/978-1-4612-4576-6},
URL = {http://dx.doi.org/10.1007/978-1-4612-4576-6},
}
@book {MR1194180,
AUTHOR = {Dimca, Alexandru},
TITLE = {Singularities and topology of hypersurfaces},
SERIES = {Universitext},
PUBLISHER = {Springer-Verlag, New York},
YEAR = {1992},
PAGES = {xvi+263},
ISBN = {0-387-97709-0},
MRCLASS = {32Sxx (14J70 32S25 32S50 57M25 57R45 58C27)},
MRNUMBER = {1194180},
MRREVIEWER = {Aleksandr G. Aleksandrov},
DOI = {10.1007/978-1-4612-4404-2},
URL = {http://dx.doi.org/10.1007/978-1-4612-4404-2},


That’s great!. Let’s try and compile the document again.

pdflatex nb_test.tex
bibtex nb_test
pdflatex nb_test.tex
pdflatex nb_test.tex


And now the PDF should show the bibliographies nicely formatted:

## BibLaTeX Example

If you are running the test examples as you read this please delete the aux log and bbl files before continuing, otherwise you will experience unexpected errors.

BibLaTeX is a modern bibliography engine more flexible than natbib, it supports localization and creating bibliography styles is easier. The following example is very similar to the previous one. The file names are the same:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}

\title{Bibliography From MathSciNet}
\author{Geri O M}
\date { }

\begin{document}

\maketitle

This document shows how to use the MR keys to cite sources from MathSciNet.
For instance, we can cite this great Topology book \cite{MR0957919}, also
not, let's throw the famous Einstein paper in the list \cite{einstein}.

\medskip

\printbibliography
\end{document}


The bibliography file is the same used in the previous section, now let’s compile the document

pdflatex nb_test.tex


Again, warnings complaining about missing citations will appear. Run the script to retrieve the bibliographies:

getmbib nb_test nb_sample


The output confirms that new entries were added:

Retrieving bibliographies from MathScinet...
... Done! 2 bibliography sources added to nb_sample.bib


And if you open nb_sample.bib it will look just as in the previous section. Now let’s compile the document again:

pdflatex nb_test.tex
biber nb_test
pdflatex nb_test.tex
pdflatex nb_test.tex


And now you will get the expected PDF output:

Please report any bugs, preferably on github but you can also use the comment section below.