Skip to main content

A tool to automatically retrieve bibtex entries

Project description

caleb

PyPI version Coverage Status Build Status Language grade: Python GitHub code style

Overview

caleb is a tool for automatically filling in your Latex citations. It assumes that the citations in your tex files are of the form \cite{author:title:year} or \cite{author:title}. caleb then extracts the citation keys from the aux file and will retrieve bibliographic data from either https://www.crossref.org/ (default) or https://mathscinet.ams.org/mrlookup. By default, these entries are then appending to the bib file. If the --dry-run option is passed, then the entries are printed instead.

Usage examples

The quickest way to see what caleb is doing is to use the --get-this-key flag.

$ caleb --get-this-key 'mazur:eisenstein' --method 'ams'
@article {mazur:eisenstein,
    AUTHOR = {Mazur, B.},
     TITLE = {Modular curves and the {E}isenstein ideal},
      NOTE = {With an appendix by Mazur and M. Rapoport},
   JOURNAL = {Inst. Hautes \'{E}tudes Sci. Publ. Math.},
  FJOURNAL = {Institut des Hautes \'{E}tudes Scientifiques. Publications
              Math\'{e}matiques},
    NUMBER = {47},
      YEAR = {1977},
     PAGES = {33--186 (1978)},
      ISSN = {0073-8301},
   MRCLASS = {14G25 (10D05)},
  MRNUMBER = {488287},
MRREVIEWER = {M. Ohta},
       URL = {http://www.numdam.org/item?id=PMIHES_1977__47__33_0},
}

The following examples occur in the examples directory.

  • First run pdflatex an_example.tex to generate an_example.aux. caleb will now parse an_example.aux to generate the appropriate bibliography file.
$ caleb an_example
  • The first important commandline option is --take-first. When making a query, it is possible that there are multiple result. By default, caleb will take no action here. However, if the --take-first flag is passed, caleb will take the first entry.
$ caleb --take-first an_example
$ caleb --method ams an_example

Workflow integration

latexmk

  • The best way is probably to integrate into latexmk. The -pdflatex flag allows us to run caleb after each pdflatex call.
latexmk -pdf -pdflatex='pdflatex %O %S; caleb -t -m ams %B' an_example
  • We can set the -pdflatex flag in a .latexmkrc file. This can either go in the your tex project folder or in the home directory. So in the .latexmkrc file, include the following line (see examples directory for an example):
$pdflatex='pdflatex %O %S; caleb %B'

Barebones

  • The barebone approach is to run caleb before running bibtex.
pdflatex an_example
caleb an_example
bibtex an_example
pdflatex an_example
pdflatex an_example

cocalc

http://cocalc.com contains a collaborative latex editor that allows you to use a custom build command. We can use caleb by changing it to

latexmk -pdf -pdflatex='pdflatex %O %S; caleb -t -m ams %B' -f -g -bibtex -synctex=1 -interaction=nonstopmode an_example.tex

Help

caleb comes with some command line arguments.

$ caleb --help
usage: caleb [-h] [-t] [-v] [--version] [-m {crossref,ams}] [-g GET_THIS_KEY]
             [-dr]
             [input_name]

positional arguments:
  input_name

optional arguments:
  -h, --help            show this help message and exit
  -t, --take-first      Take first result if multiple results
  -v, --verbose         Increase verbosity of output
  --version             Outputs the version
  -m {crossref,ams}, --method {crossref,ams}
                        Specify a method for retrieving citations
  -g GET_THIS_KEY, --get-this-key GET_THIS_KEY
                        Print the first entry with this key
  -dr, --dry-run        Write the changes to stdout instead of the bibtex

Installation

Dependencies

Testing and Development Dependencies

pip

The recommended method is to get caleb from its PyPI repository.

pip3 install caleb --user

setup.py

Alternatively, a setup.py file is auto-generated using dephell. Let me know if something goes wrong!

python setup.py install --user

Goal of project

  • Reach feature parity with IRL Caleb by version 2.13.1995.

Homepage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caleb-0.7.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

caleb-0.7.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file caleb-0.7.0.tar.gz.

File metadata

  • Download URL: caleb-0.7.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.4 Linux/5.2.8-arch1-1-ARCH

File hashes

Hashes for caleb-0.7.0.tar.gz
Algorithm Hash digest
SHA256 d81f4f8ac0427ac9e1cc172af87270980243418c0fb4565ab3604a065c2093ce
MD5 01cefe744eb4c021d057c4f424be4645
BLAKE2b-256 339d988a531114375497bef0d8998d64cc1b885b9d50b4bb19349e41284cc933

See more details on using hashes here.

File details

Details for the file caleb-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: caleb-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.4 Linux/5.2.8-arch1-1-ARCH

File hashes

Hashes for caleb-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e3ceb8e95457e3445db4f18393b7c9506638f4254b9bc583c541efc0bb325e5
MD5 fb4a1a64b2b6193da98d42cbd11012ea
BLAKE2b-256 790cb7352edc208cca2f0a76790dada13a69ff4439610102223c18dd9abe73a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page