Bibtex

This command helps to interact with bib files in your LaTeX projects.

Examples

I use it for opening some papers for instance

papis bibtex read new_papers.bib open

or to add papers to the bib

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

or if I update some information in my papis yaml files then I can do

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’ll grow sick and tired of writing always read main.bib and save main.bib, so you can write a local configuration file .papis.config for papis bibtex to read and write automatically

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

with this setup, you can just do

papis bibtex add 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 ``doi``s and urls available. You can automate this diagnostic with

For this you kan use the command doctor

papis bibtex read mybib.bib doctor

Mostly I want to have only the references in my project’s bib file that are actually cited in the latex file, you can check which references are not cited in the tex files by doing

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

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

To monitor the health of the bib project’s file, I mostly have a target in the project’s Makefile like

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

it does not solve all problems under the sun, but it is really better than no check!

Vim integration

Right now, you can easily use it 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

Cli

papis bibtex

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 Examples…

browse

browse a document in the documents list

doctor

Check bibfile for correctness, missing keys…

edit

edit a document in the documents list

filter-cited

Filter cited documents from the read bib file…

import

Import documents to papis e.g.

iscited

Check which documents are not cited e.g.

open

Open a document in the documents list

ref

Print the reference for a document

rm

Remove a document from the documents list

save

Save the documents imported in bibtex format

sort

Sort documents

unique

Remove repetitions

update

Update documents from and to the library