
bibtex-tidy
CLI整理 BibTeX 参考文献:统一字段格式与缩进、排序条目、合并或删除重复项、移除指定字段,可原地改写 .bib 或输出到标准输出,也能作 pre-commit 钩子使用。需要 Node.js。
bibtex-tidy
Tidy bibtex files. Try it out.

There are several ways you can use bibtex-tidy:
Example
Before:
@ARTICLE {feinberg1983technique,
title={A technique for radiolabeling DNA restriction endonuclease fragments to high specific activity},
author={Feinberg, Andrew P. and Vogelstein, Bert},
journal = {Analytical biochemistry},
volume = 132,
number=1,
pages={6--13},
year=1983,
publisher={Elsevier},}
@article{miles1984qualitative,
title={Qualitative data analysis: A sourcebook},
author={Miles, Matthew B. and Huberman, A. Michael and Saldana, J.},
journal={Beverly Hills},
year=1984
}
After bibtex-tidy references.bib:
@article{feinberg1983technique,
title = {A technique for radiolabeling DNA restriction endonuclease fragments to high specific activity},
author = {Feinberg, Andrew P. and Vogelstein, Bert},
year = 1983,
journal = {Analytical biochemistry},
publisher = {Elsevier},
volume = 132,
number = 1,
pages = {6--13}
}
@article{miles1984qualitative,
title = {Qualitative data analysis: A sourcebook},
author = {Miles, Matthew B. and Huberman, A. Michael and Saldana, J.},
year = 1984,
journal = {Beverly Hills}
}
CLI
Requires node v12 or later.
npm install -g bibtex-tidy
bibtex-tidy references.bib
--help, -h
Show help
--v2
Input files will no longer be modified by default. Instead, you will need to
specify `--modify`/`-m` option to overwrite the file, or `--output`/`-o` to
output to a different file.
--output, -o
Write output to specified path. When omitted (and -m/--modify is not used),
the result will be printed to stdout.
--modify, -m, --no-modify
Overwrite the original input files with the tidied result. This is enabled by
default but will be disabled by default in v2. For v1, use --no-modify to
output to stdout instead of overwriting the input files.
--omit
Remove specified fields from bibliography entries.
Examples:
--omit=id,name
--curly, --no-curly
Enclose all property values in braces. Quoted values will be converted to
braces. For example, "Journal of Tea" will become {Journal of Tea}.
--numeric, --no-numeric
Strip quotes and braces from numeric/month values. For example, {1998} will
become 1998.
--months
Convert all months to three letter abbreviations (jan, feb, etc).
--space
Indent all fields with the specified number of spaces. Ignored if tab is set.
Examples:
--space=2 (default), --space=4
--tab, --no-tab
Indent all fields with a tab.
--align, --no-align
Insert whitespace between fields and values so that values are visually
aligned.
Examples:
--align=14 (default)
--blank-lines, --no-blank-lines
Insert an empty line between each entry.
--sort, --no-sort
Sort entries by the specified field names (citation key is used if no fields
are specified). For descending order, prefix the field with a dash (-).
Multiple fields may be specified to sort everything by first field, then by
the second field whenever the first field for entries are equal, etc.
The following additional fields are also permitted: key (entry citation key),
type (sorts by the type of entry, e.g. article), and special (ensures that
@string, @preamble, @set, and @xdata entries are first).
Examples:
--sort (sort by citation key), --sort=-year,name (sort year descending then
name ascending), --sort=name,year
--duplicates
Warn if duplicates are found, which are entries where DOI, abstract, or
author and title are the same.
Examples:
--duplicates=doi (same DOIs), --duplicates=key (same IDs),
--duplicates=abstract (similar abstracts), --duplicates=citation (similar
author and titles), --duplicates=doi,key (identical DOI or keys),
--duplicates (same DOI, key, abstract, or citation)
--merge, --no-merge
Merge duplicates entries. Use the duplicates option to determine how
duplicates are identified. There are different ways to merge:
- first: only keep the original entry
- last: only keep the last found duplicate
- combine: keep original entry and merge in fields of duplicates if they do
not already exist
- overwrite: keep original entry and merge in fields of duplicates,
overwriting existing fields if they exist
--strip-enclosing-braces
Where an entire value is enclosed in double braces, remove the extra braces.
For example, {{Journal of Tea}} will become {Journal of Tea}.
--drop-all-caps
Where values are all caps, make them title case. For example, {JOURNAL OF
TEA} will become {Journal of Tea}. Roman numerals will be left unchanged.
--escape, --no-escape
Escape special characters, such as umlauts. This is usually unnecessary for
modern toolchains like biber and biblatex. Enabled by default.
By default, the legacy escape list is used for v1 compatibility and may emit
macros requiring external packages. Use --escape=new to only convert
characters with package-independent LaTeX escapes and warn on characters that
cannot be escaped. New mode will become the default in v2; please raise a
GitHub issue if you still need the legacy behavior.
--unescape
Convert LaTeX escapes to Unicode characters.
--sort-fields
Sort the fields within entries.
If no fields are specified fields will be sorted by: title, shorttitle,
author, year, month, day, journal, booktitle, location, on, publisher,
address, series, volume, number, pages, doi, isbn, issn, url, urldate,
copyright, category, note, metadata
Examples:
--sort-fields=name,author
--strip-comments, --no-strip-comments
Remove all comments from the bibtex source.
--trailing-commas, --no-trailing-commas
End the last key value pair in each entry with a comma.
--encode-urls, --no-encode-urls
Replace invalid URL characters with percent encoded values.
--tidy-comments, --no-tidy-comments
Remove whitespace surrounding comments.
--remove-empty-fields, --no-remove-empty-fields
Remove any fields that have empty values.
--remove-dupe-fields, --no-remove-dupe-fields
Only allow one of each field in each entry. Enabled by default.
--generate-keys
For all entries replace the key with a new key of the form
<author><year><title>. A JabRef citation pattern can be provided. This is an
experimental option that may change without warning.
--max-authors
Truncate authors if above a given number into "and others".
--no-lowercase
Lowercase field names and entry type. Enabled by default.
--enclosing-braces
Enclose the given fields in double braces, such that case is preserved during
BibTeX compilation.
Examples:
--enclosing-braces=title,journal (output title and journal fields will be of
the form {{This is a title}}), --enclosing-braces (equivalent to
---enclosing-braces=title)
--remove-braces
Remove any curly braces within the value, unless they are part of a command.
Examples:
--remove-braces=title,journal, --remove-braces (equivalent to
---remove-braces=title)
--wrap, --no-wrap
Wrap long values at the given column
Examples:
--wrap (80 by default), --wrap=82
--version, -v
Show bibtex-tidy version.
--quiet
Suppress logs on stdout.
Javascript/Typescript API
npm install bibtex-tidy
import { tidy } from 'bibtex-tidy';
const bibtex = fs.readFileSync('references.bib', 'utf8');
tidy.tidy(bibtex, { curly: true });
Documentation for the options can be found here
Pre-Commit Hook
If you keep your bibtex files in a git repository, you can run bibtex-tidy each time you commit using pre-commit:
repos:
- repo: https://github.com/FlamingTempura/bibtex-tidy
rev: v1.14.0 # see changelog for latest version
hooks:
- id: bibtex-tidy
args: ['--align=100', '--curly'] # any other settings
Docker
The web application can be deployed locally using the provided Docker configuration:
- Build and start the container:
docker compose -f docker/docker-compose.yml up - Visit the web application at http://localhost:8080 and do your BibTeX work
相關資源

Pandoc
CLI通用文档格式转换器,在 Markdown、Word、HTML、LaTeX、EPUB 等几十种格式之间互转,支持模板、引文与 Lua 过滤器。默认借助 LaTeX 生成 PDF,需另行安装。
jgm/pandoc47.1k
Tectonic
CLI自包含的现代 TeX/LaTeX 引擎(基于 XeTeX 与 TeX Live),首次编译时自动下载并缓存所需支持文件,一条命令把 .tex 编译成 PDF,无需安装完整 TeX 发行版。
tectonic-typesetting/tectonic5.3k
Papis
CLI命令行文献与书目管理器:按 DOI 添加论文并自动抓取元数据,按作者、标题、标签检索,导入导出 BibTeX;每条记录是可读的 YAML 文件,agent 容易直接读写,也带网页界面。需要 Python。
papis/papis1.8k
TeXtidote
CLI对 LaTeX 和 Markdown 源文件做拼写、语法与格式检查(如图表未被引用),并把问题定位回源码行号,可输出 HTML 报告。语法检查基于 LanguageTool,支持英、德、法等语言,不支持中文;macOS 可用 Homebrew 安装(自带 Java)。
sylvainhalle/textidote1.1k
latexdiff
CLI比较两个版本的 LaTeX 稿件,生成用颜色和删除线标出增删内容的 .tex,编译后即得修订对照 PDF,适合论文返修时向审稿人展示改动,也能对比 Git 历史版本。随 TeX Live、MiKTeX 发行,需要 Perl。
ftilmann/latexdiff681
科研写作助手 Research Writing Assistant
Skill面向本科生、研究生的论文写作流程:先多轮问答确认题目与章节结构,再分章写作、文献综述、投稿前自审和去 AI 腔润色,含法学、医学、社科等学科写作模块,可输出可编译的 LaTeX 项目。承诺不编造文献;产出为 Markdown/LaTeX,需自行转入 Word 排版。
Norman-bury/research-writing-skill3.7k