Giter VIP home page Giter VIP logo

simple-mref's Introduction

simple-mref

A simple tool, following the KISS principle, that i use to retrieve BibTeX entries from MathSciNet. As it uses the free access via MRef, no subscription is required.

Before writing my own script, i found multiple other projects with similar objectives. Though i tried to adjust them to run with modern python, none worked out for me. Basically, they are all (much) too complex and/or do stuff that i don't need or want.

The drawback of simple-mref is, that the input string must already be in "bibliography style", i.e. "Author. Some title. Maybe publisher, year." or similar. From the MRef help page:

MRef can be used whenever a reference can be copied and pasted as text. For example, the reference might be copied as text from a Web page, from a PDF document, or from a file presented in a TeX/AMS-TeX/LaTeX application.

One particular annoyance is, that it does not simply accept an ISBN – but see isbn-to-reference.

Prerequisites

  • zsh
  • curl
  • grep
  • awk

Confirmed to be working with: curl 7.87.0, GNU Awk 5.2.1, the MRef site in fall 2022.

Usage

simple-mref.sh

The fetching script expects the search string as its first argument, i.e. it can be run like this:

./simple-mref.sh "Euclid. Euclid's Elements - All thirteen books complete in one volume, Green Lion Press"

to print the BibTeX entry – if one is found – unmodified to standard output. Alternatively, one may specify - (hyphen) to read the search string from standard input:

echo "Euclid. Euclid's Elements - All thirteen books complete in one volume, Green Lion Press" | ./simple-mref.sh -

post-processing

As i don't like MathSciNet's output format, i keep a set of scripts in post-processing/ that transform the BibTeX entry to my preferred style. They are mostly independent from each other, but many assume single-line entry fields. Two "drivers" post-process-pipe.sh and post-process-tmp.sh exist to filter their file argument through all executable post-processing scripts, where again, a hyphen can be used to read from standard input instead. The scripts simple-mref-with-*.sh pass simple-mref.sh's output to the respective driver:

./simple-mref-with-pipe-post.sh "Euclid. Euclid's Elements - All thirteen books complete in one volume, Green Lion Press"

Note, that some post-processing scripts use further tools such as sed or vim.

vim

For convenience, i use this command

:r !zsh -c '/path/to/simple-mref-with-pipe-post.sh "$(cat)"'

directly in vim: after pasting the copied reference, possibly with line breaks (which don't seem to disturb MRef even in the middle of words), and terminating cat via Ctrl+D twice, the BibTeX entry is pasted into the current file.

isbn-to-reference

Another KISS tool that uses Open Library's API to search for an ISBN and outputs a format that MRef can parse. For example:

./isbn-to-reference.sh 0201038099 | ./simple-mref.sh -

Any non-digit characters from the input argument (or standard input in case of -) are stripped, so it accepts ISBNs with or without hyphens, spaces, leading "ISBN: ", …

Prerequisites

Confirmed to be working with: curl 7.87.0, jq-1.6.

simple-mref's People

Contributors

j0j0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.