Bibtex

This command helps interacting with BibTeX bib files in your LaTeX projects.

Examples

You can use it for opening some papers by calling:

papis bibtex read new_papers.bib open

or to add papers to the BibTeX file by calling:

papis bibtex             \
    read new_papers.bib  \ # Read bib file
    add -q einstein      \ # Pick a doc with query 'einstein' from library
    add -q heisenberg    \ # Pick a doc with query 'heisenberg' from library
    save new_papers.bib    # Save in new_papers.bib

or to update some information that was modified in papis’ YAML files by calling:

papis bibtex            \
    read new_papers.bib \ # Read bib file
    update -f           \ # Update what has been read from papis library
    save new_papers.bib   # save everything to new_papers.bib, overwriting

Local configuration file

If you are working in a local folder where you have a bib file called main.bib, you can avoid adding the repetitive read main.bib and save main.bib by using the configuration values described in the documentation. You can create a local configuration file .papis.config for papis bibtex to read and write automatically. This file should contain:

[bibtex]
default-read-bibfile = main.bib
default-save-bibfile = main.bib
auto-read = True

With this setup, you can just do:

papis bibtex add -q einstein save

Check references quality

When you’re collaborating with someone, you might come across malformed or incomplete references. Most journals want to have all the DOIs and URLs available. For this you can use the doctor command:

papis bibtex read mybib.bib doctor

Usually, you likely want to only have the references that are actually cited in the LaTeX file in your project’s BibTeX file. You can check which references are not cited in the .tex files by calling:

papis bibtex iscited -f main.tex -f chapter-2.tex

and you can then filter them out using the filter-cited command.

To monitor the health of the project’s BibTeX file, you can add a simple target to the project’s Makefile like

check-bib:
    papis bibtex iscited -f main.tex doctor
.PHONY: check-bib

Vim integration

This command can also be easily used from vim with these simple lines

function! PapisBibtexRef()
    let l:temp = tempname()
    echom l:temp
    silent exec "!papis bibtex ref -o ".l:temp
    let l:olda = @a
    let @a = join(readfile(l:temp), ',')
    normal! "ap
    redraw!
    let @a = l:olda
endfunction

command! -nargs=0 BibRef call PapisBibtexRef()
command! -nargs=0 BibOpen exec "!papis bibtex open"

And use like such: asciicast

Command-line Interface

A papis script to interact with bibtex files

papis bibtex [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

Options

-h, --help

Show this message and exit.

--noar, --no-auto-read

Do not auto read even if the configuration file says it

Commands

add

Add a reference to the BibTeX file.

bibtex

Import documents from a BibTeX file.

browse

Browse a document in the document list.

doctor

Check BibTeX file for correctness.

edit

Edit documents by adding keys or opening…

filter-cited

Filter cited documents from the BibTeX file.

import

Import documents from a BibTeX file to the…

iscited

Check which documents are not cited.

open

Open a document using the default…

ref

Print the reference for a document.

rm

Remove a document from the documents list.

save

Save the documents in the BibTeX format.

sort

Sort the documents in the BibTeX file.

unique

Remove duplicate BibTeX entries.

update

Update documents from and to the library.