Giter Club home page Giter Club logo

caleb's Introduction

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

caleb's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar kevinywlui avatar neptamin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

caleb's Issues

Verbose option is broken!

Running caleb without the verbose option!

Traceback (most recent call last):
  File "/home/klui/.local/bin/caleb", line 10, in <module>
    sys.exit(launch())
  File "/home/klui/.local/lib/python3.7/site-packages/caleb/cmdline.py", line 65, in launch
    elif args.verbose >= 2:
TypeError: '>=' not supported between instances of 'NoneType' and 'int'

Implement a dry-run option and a get-single option.

The dry-run option will just have caleb print out what caleb would have written to the bib file.
This is use on it's own and as a debugging feature.

The get-single will allow the user to input a key and have caleb find the first entry corresponding to that key.

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.