Usage¶
The main command accepts one or more TeX or Markdown files, or a single BibTeX file in bibliography-refresh mode:
Most paper workflows use TeX input files:
bibsync scans citation commands, resolves missing identifier-like citekeys, and
reports whether references.bib is current. It does not write changes unless
--fix is provided:
When a required citekey cannot be resolved, bibsync prints a diagnostic for
each key. Unsupported citekeys are reported as identifier-format problems, and
identifier-like keys that the selected provider cannot find are reported as
provider misses. Those messages are meant to be actionable in automation: fix the
citekey, choose a provider that supports it, add the entry manually, or add the
key to an ignore file.
Citekey Style¶
The most reliable workflow is to cite by identifier:
When the provider returns a BibTeX entry, bibsync rewrites the entry key to
match the citekey used in TeX. For example, if InspireHEP returns
@article{Abbott:2016blz, ...} for \cite{1602.03837}, the output entry is
written as @article{1602.03837, ...}. This keeps the TeX source stable.
Output Discovery¶
If the TeX source contains a bibliography command, bibsync can discover the
output file:
Then this command checks references.bib:
To update the discovered file, add --fix:
If more than one bibliography file is declared, the first one becomes the output file and the remaining files are treated as additional read-only sources.
Use --output when you want explicit control:
Markdown And JOSS Papers¶
bibsync also scans Markdown sources, including
Journal of Open Source Software paper.md files. Files
ending in .md or .markdown are parsed for pandoc-style citations and for the
bibliography declared in the YAML frontmatter:
---
title: "My Software"
bibliography: paper.bib
---
Background and prior work [@1602.03837; @10.1103/PhysRevLett.116.061102].
The bibliography frontmatter field is used as the output file when --output
is not given, matching the way \bibliography{...} is discovered in TeX. A single
value, an inline list ([a.bib, b.bib]), and a block list of - items are all
supported.
Pandoc citation keys (@key, [@key], [-@key], and grouped [@a; @b] forms)
are extracted from the body. Citations inside fenced or inline code spans are
ignored, and email addresses such as name@example.com are not mistaken for
citations. As with TeX, the most reliable workflow is to cite by identifier:
Existing Bibliographies¶
By default, bibsync leaves existing entries untouched unless they look like
unpublished preprints. Preprint entries — those with an archivePrefix or
eprinttype field but no journal field — are re-queried against the provider
to detect whether they have since been published. If the provider returns a
journal record, the entry is updated; if the paper is still a preprint, the
existing entry is preserved as-is.
Use --no-update to skip all existing entries unconditionally:
Use --update-all to re-resolve every existing entry from the provider,
equivalent to the old default behavior:
Use --force-regenerate to re-resolve all existing entries and overwrite them
with fresh provider output regardless of whether they appear to be preprints:
Additional read-only bibliographies can be passed with --other:
Every file passed with --other must already exist and contain valid BibTeX.
If a path is wrong or a file is malformed, bibsync stops with an error naming
that file instead of silently ignoring it.
By default, entries found in those read-only files are not copied into the main output file. This is useful when a project deliberately keeps shared references or software citations in separate files.
Use --merge-other to copy matching entries into the output file:
Ignoring Specific Entries¶
To prevent bibsync from touching certain entries — for example, manually
curated book or thesis records — list their citekeys in an ignore file:
Each line is one citekey. Lines starting with # are treated as comments.
Pass the file with --ignore-file:
Ignored citekeys are never sent to any provider and their existing bib entries are never modified.
The ignore file must exist when --ignore-file is passed. A misspelled ignore
path is reported as a missing input file.
Author Lists¶
InspireHEP and NASA ADS truncate long author lists in their BibTeX
(Abac, A. G. and others, ... and et al.). Citation styles that treat
others as a name, such as the one JOSS uses, then print "Abac & others"
instead of "Abac et al.". Add --full-author-lists to fetch the complete list
from the provider:
Papers with more than 100 authors that name a collaboration are credited to
the collaboration(s) instead, as one brace-protected corporate author, for
example {LIGO Scientific Collaboration, VIRGO Collaboration and KAGRA
Collaboration}. The option is off by default, costs one extra provider request
per truncated entry, and, like --full-journal-names, applies only to entries
resolved from a provider in that run (use --force-regenerate once to convert
an existing file). An entry whose provider has no full list is left truncated
and reported.
Journal Names¶
Providers abbreviate journal names: InspireHEP writes Phys. Rev. D and NASA
ADS writes AAS macros such as \prd. Some venues, including JOSS, require full
names. Add --full-journal-names to write them in full:
This applies to entries resolved from a provider in that run (new entries,
refreshed preprints, and everything with --update-all or
--force-regenerate); entries already in the bibliography are not rewritten,
so run once with --force-regenerate to convert an existing file. The full
names come from a table maintained in bibsync, which also lists journals
whose short title is already their full name (Nature, SoftwareX). Any other
journal is left unchanged and reported, never guessed, so you can check it by
hand:
bibsync: journal "Phys. Rev. Z" in 2001.00001 is not in bibsync's journal table; left unchanged, check that it is the full name
To catch abbreviations that --full-journal-names cannot fix (journals missing
from the table, and hand-written or ignored entries), add --check-venue-names.
It checks the journal and booktitle of every entry in the bibliography,
including entries listed in the ignore file, names each one that is or looks
abbreviated, and makes the run fail:
A name in bibsync's journal table is judged by the table: its abbreviations are
always reported, with the full name to write, and its full names never are,
even when written with a period where the table has a colon (Journal of
Physics. Conference Series). Any other name is reported as looking abbreviated
when it contains a word cut short with a period (Phys., J.Phys.; St.,
Ste., Mt. and Ft. are allowed), or is a single short word with two or more
capitals (JCAP). The parts of a concatenation are joined first, so
"Physical Review" # " D" passes. A macro reference (journal = prd) is
always reported, because bibsync cannot see the name it stands for, and so is an
entry whose fields bibsync cannot read.
The rule for names outside the table is a heuristic, so a real full title such
as RNA can be reported. List the venue names to accept, one per line, in a
file and pass it with --accepted-venues:
The file only accepts names the heuristic flags: listing an abbreviation from the journal table does not stop it being reported.
For a JOSS paper's pre-commit hook, use both options together.
From Python, pass full_journal_names=True to bibsync.sync_files; the report's
unexpanded_journals lists the journal names that were left unchanged because
they are not in the table.
full_author_lists=True does the same for author lists, and the report's
truncated_author_lists names the entries left truncated.
Updating A BibTeX File¶
Passing a single .bib file uses the existing keys in that bibliography as the
identifiers to resolve:
This is useful for checking whether provider metadata has changed without
scanning TeX files. Add --fix to refresh the file:
The .bib file must exist in this mode. Existing output bibliographies are also
parsed before resolution; malformed BibTeX reports the file and approximate
entry location so the bibliography can be corrected before running again.
Use --force-regenerate to rewrite all existing entries from provider output:
Check And Fix¶
Check mode is the default. It performs resolution and merge calculation but does not write the output file:
The command exits with a non-zero status when the bibliography would change or when a required citekey cannot be resolved. This is the mode used by the pre-commit hook.
Unresolved citekeys are printed with reasons. For example:
unresolved:
Smith2024: unsupported identifier format; use an arXiv ID, DOI, or ADS bibcode, or add the entry to the bibliography or ignore file
2404.14498: provider returned no matching BibTeX entry; check the citekey, choose a provider that supports it, or add the entry manually
Use --fix to write the calculated bibliography:
Cache¶
Provider requests are network-bound. Use --cache to store provider records and
reuse them on later runs:
Cache entries are keyed by provider and canonical record ID. Mappings from arXiv
IDs, DOIs, and ADS bibcodes are stored separately, so a citekey such as
1602.03837 can be resolved from cache after its provider record is known.
Preprint entries that are re-checked for publication always bypass the cache and
fetch a fresh result from the provider. This ensures bibsync sees the latest
publication status regardless of what is stored locally. The fresh result is
written back to the cache afterwards.
Use --refresh-cache to force provider calls and update cached records for all
entries:
Override the cache location with --cache-dir:
If a cached JSON file is corrupt, bibsync reports the exact cache path. Remove
that file or rerun with --refresh-cache to rebuild the provider response.
Network and provider failures include the provider and citekey or batch being
resolved.
Backups¶
When bibsync writes over an existing bibliography, it creates a .bak file by
default. Disable this with:
For automation, --no-backup is often appropriate because the repository
history already records the previous bibliography state.