.TH BIB-FETCH 1 "June 2026" "bibutils" "User Commands" .SH NAME bib-fetch \- fetch a bibtex entry for a pdf by DOI or arXiv id .SH SYNOPSIS .B bib-fetch .RB [ \-d .I doi | .B \-a .IR arxiv-id ] .RI [ file.pdf ] .SH DESCRIPTION .B bib-fetch emits a bibtex entry, in canonical form and with a generated citation key, for the document identified by a DOI or an arXiv id. .PP Unless an identifier is supplied with .B \-d or .BR \-a , the first two pages of .I file.pdf are searched (using .BR pdftotext (1)) for a DOI and, failing that, for an arXiv stamp of the form .BR arXiv:2104.01234v2 . Both modern and old-style .RB ( cs/0101001 ) arXiv ids are recognized. .PP DOIs are resolved through doi.org content negotiation (crossref and friends); arXiv ids through arxiv.org. Note that arXiv reports the year of the latest revision of a preprint, not of its first submission. .SH OPTIONS .TP .BI \-d " doi" Fetch by DOI; no pdf is read. .TP .BI \-a " arxiv-id" Fetch by arXiv id; no pdf is read. A leading .B arXiv: prefix is accepted and stripped. .SH EXIT STATUS 0 on success, 1 if no identifier could be found or the fetch failed, 2 on usage error. .SH DEPENDENCIES .BR curl (1) always; .BR pdftotext (1) (poppler) for identifier extraction from pdfs. .SH EXAMPLES .nf bib-fetch paper.pdf | bib-add refs.bib bib-fetch -a 1706.03762 .fi .SH SEE ALSO .BR bib-add (1), .BR bib-key (1), .BR bib-util (1)