Bibtex
This command is used for interacting with BibTeX bib
files in your LaTeX projects.
It is meant to be used when the BibTeX file is a companion to your Papis library.
Then, papis bibtex
can be used to add, remove, update, and generally clean
the file using information from the library.
Examples
You can use it for opening some papers from the BibTeX file by calling
papis bibtex read new_papers.bib open
This is done by matching the entry in the BibTeX file with a document in your library and then opening the correspond files. If no document can be found in the library, then the file cannot be opened, of course. To add papers to the BibTeX file (from the current library) you can call
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
To update some information that was modified in Papis’ YAML files, you can call
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
Note
Reading, adding, and then saving documents in this fashion will re-export them and may change the formatting of your BibTeX file.
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"
Command-line Interface
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 the ‘default-read-file’ (must call ‘read’ explicitly)
Commands
- add
Add documents from the library to the…
- 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