| name | citation-convert |
| description | Fetch BibTeX citations from DOI, arXiv ID, journal URL, or paper title. Covers identifier resolution, BibTeX normalization, batch citation collection, and integration with LaTeX bibliography workflows. |
doi2bib3: BibTeX Citation Fetching
Core Capabilities
1. Supported Input Formats
doi2bib3 accepts the following identifier types:
| Input Type | Examples |
|---|
| Bare DOI | 10.1038/nphys1170 |
| DOI URL | https://doi.org/10.1038/nphys1170 |
| Modern arXiv ID | 2411.08091, arXiv:2411.08091 |
| Legacy arXiv ID | hep-th/9901001, arXiv:hep-th/9901001 |
| arXiv URL | https://arxiv.org/abs/2411.08091 |
| Publisher URL | https://www.pnas.org/doi/10.1073/pnas.2305943120 |
| Paper title | Attention is all you need |
For arXiv inputs, doi2bib3 queries the arXiv API to find the associated DOI and fetches the published BibTeX. If no DOI exists, it falls back to Crossref search.
2. Command-Line Usage
Fetch a single citation and print to stdout:
doi2bib3 10.1038/nphys1170
Save to a file (appends if the file already exists):
doi2bib3 10.1038/nphys1170 -o references.bib
Fetch from an arXiv ID:
doi2bib3 2411.08091 -o references.bib
3. Python API
Use fetch_bibtex as the primary programmatic interface:
from doi2bib3 import fetch_bibtex
bib = fetch_bibtex('10.1038/nphys1170')
bib = fetch_bibtex('2411.08091')
bib = fetch_bibtex('https://www.pnas.org/doi/10.1073/pnas.2305943120')
bib = fetch_bibtex('10.1038/nphys1170', normalize=False)
bib = fetch_bibtex('10.1038/nphys1170', timeout=30)
fetch_bibtex(identifier, timeout=15, normalize=True) -> str
identifier: DOI, arXiv ID, URL, or paper title
timeout: HTTP request timeout in seconds
normalize: Apply BibTeX normalization (journal abbreviation, capitalization protection, special character encoding, citation key generation)
- Returns: BibTeX string
- Raises:
DOIError for invalid or unresolvable identifiers
4. BibTeX Normalization
When normalize=True (the default), doi2bib3 applies the following transformations:
- Citation key generation:
AuthorLastname_FirstTitleWord_Year format
- Journal name abbreviation: Full names replaced with standard abbreviations (APS, Nature journals)
- Capitalization protection: Wraps capitalized words in braces
{Word} to prevent BibTeX lowercasing
- LaTeX encoding: Converts Unicode special characters to LaTeX escape sequences
- Page range standardization: Unicode dashes converted to ASCII double-dash
--
- Article number fetching: For APS journals, retrieves article numbers from Crossref
5. Batch Workflows
Fetch multiple citations from a file containing one DOI per line:
while IFS= read -r doi; do
doi2bib3 "$doi" -o references.bib
sleep 1
done < doi_list.txt
Python batch processing with error handling:
from doi2bib3 import fetch_bibtex
import time
dois = ['10.1038/nphys1170', '2411.08091', '10.1145/3600006.3613165']
entries = []
for doi in dois:
try:
entries.append(fetch_bibtex(doi))
except Exception as e:
print(f"Failed for {doi}: {e}")
time.sleep(1)
with open('references.bib', 'w') as f:
f.write('\n\n'.join(entries))
6. Resolution Strategy
doi2bib3 resolves identifiers through a fallback chain:
- arXiv detection - If input matches arXiv pattern, query arXiv API for DOI
- DOI normalization - Extract and validate DOI format (
10.xxxx/yyyy)
- doi.org content negotiation - Request BibTeX directly from doi.org
- Crossref transform - Use Crossref API to convert DOI to BibTeX
- URL DOI extraction - Scrape publisher pages for DOI metadata tags
- Crossref fuzzy search - Search by title/query string as last resort
This chain ensures maximum coverage across publishers and identifier types.
7. Common Pitfalls to Avoid
- Rate limiting: Making many rapid requests triggers rate limits from doi.org or Crossref. Add
sleep 1 between batch requests.
- arXiv-only papers: Papers without a published DOI fall back to Crossref search, which may return incomplete metadata. Prefer DOIs when available.
- Normalization artifacts: Some publisher-specific fields may be altered by normalization. Use
normalize=False if you need the raw entry.
- Title search ambiguity: Searching by title may return the wrong paper if the title is common. Always prefer DOIs or arXiv IDs over title search.
Workflow for Citation Collection
Stage 1: Gather identifiers
- Collect DOIs from DBLP, ACM Digital Library, or publisher pages
- Collect arXiv IDs for preprints
- Store identifiers in a text file (one per line)
Stage 2: Fetch BibTeX
- Run doi2bib3 on each identifier to build
references.bib
- Use
normalize=True for consistent citation keys
- Add delays between requests to avoid rate limiting
Stage 3: Integrate with LaTeX
- Reference entries using
\cite{AuthorLastname_FirstTitleWord_Year}
- Compile with
bibtex or biber
- Verify all citations resolve correctly
Skill Combinations
- doi2bib3 + academic-writing: Fetch citations while drafting systems conference papers. Use doi2bib3 to collect BibTeX for all cited systems, baselines, and related work.
- doi2bib3 + better-grep: Search existing
.bib files for duplicates before adding new entries. Use rg "citation_key" references.bib to check for existing entries.
References
This skill includes a detailed reference file covering the full API surface and advanced usage patterns:
references/doi2bib3-guide.md: Complete API documentation, internal functions, resolution strategy details, normalization specifics, batch processing patterns, error handling, and LaTeX workflow integration
Load this reference when working with advanced features or troubleshooting resolution failures.