LaTeX 参考文献管理
BibTeX 从入门到精通
参考文献管理是学术写作中最繁琐的环节之一。BibTeX 让你一次录入、处处引用,自动生成符合期刊要求的参考文献列表。
BibTeX 基础
BibTeX 的核心思想是内容与格式分离。你把所有文献的元数据(标题、作者、年份等)存放在一个 .bib 文件中,在正文中用引用键引用它们,最终的格式由你选择的参考文献样式决定。更换期刊模板时,只需更改样式文件,所有引用自动重新排版。
@article{vaswani2017attention,
title = {Attention Is All You Need},
author = {Vaswani, Ashish and Shazeer, Noam and Parmar, Niki
and Uszkoreit, Jakob and Jones, Llion and Gomez,
Aidan N and Kaiser, Lukasz and Polosukhin, Illia},
journal = {Advances in Neural Information Processing Systems},
volume = {30},
pages = {5998--6008},
year = {2017}
}
@book{bishop2006pattern,
title = {Pattern Recognition and Machine Learning},
author = {Bishop, Christopher M},
publisher = {Springer},
address = {New York},
year = {2006},
isbn = {978-0-387-31073-2}
}
@inproceedings{devlin2019bert,
title = {{BERT}: Pre-training of Deep Bidirectional
Transformers for Language Understanding},
author = {Devlin, Jacob and Chang, Ming-Wei and Lee, Kenton
and Toutanova, Kristina},
booktitle = {Proceedings of NAACL-HLT},
pages = {4171--4186},
year = {2019}
}每条文献以 @类型{ 引用键, 开头。引用键(如 vaswani2017attention)是你在正文中引用时使用的唯一标识符。常见的命名习惯是 姓氏+年份+关键词。字段之间用逗号分隔,字段值可以用花括号 {} 或双引号包裹。
引用类型
BibTeX 支持多种文献类型,每种类型有不同的必填字段和可选字段。以下是学术写作中最常用的几种。
@article — 期刊论文
发表在学术期刊上的论文。必填字段:author、title、journal、year。常用可选字段:volume、number、pages、doi。
@inproceedings — 会议论文
发表在学术会议论文集中的论文。必填字段:author、title、booktitle、year。计算机科学领域的顶会论文(如 NeurIPS、CVPR、ACL)通常使用此类型。
@book — 书籍
正式出版的书籍。必填字段:author(或 editor)、title、publisher、year。
其他常用类型
% 硕士/博士论文
@mastersthesis{zhangsan2023thesis,
title = {基于图神经网络的社交网络分析},
author = {张三},
school = {清华大学},
year = {2023}
}
@phdthesis{lisi2022dissertation,
title = {大规模预训练模型的高效微调方法研究},
author = {李四},
school = {北京大学},
year = {2022}
}
% 在线资源(biblatex 支持)
@online{pytorch2024docs,
title = {PyTorch Documentation},
author = {{PyTorch Contributors}},
url = {https://pytorch.org/docs/stable/},
urldate = {2024-12-01},
year = {2024}
}
% 技术报告
@techreport{openai2023gpt4,
title = {GPT-4 Technical Report},
author = {OpenAI},
institution = {OpenAI},
year = {2023},
number = {arXiv:2303.08774}
}
% 预印本(也常用 @article 或 @misc)
@misc{brown2020language,
title = {Language Models are Few-Shot Learners},
author = {Brown, Tom and Mann, Benjamin and others},
year = {2020},
eprint = {2005.14165},
archiveprefix = {arXiv},
primaryclass = {cs.CL}
}在文中引用
在正文中引用文献时,使用引用命令加上 .bib 文件中定义的引用键。不同的引用命令会产生不同的引用格式。
\documentclass{article}
\usepackage[UTF8]{ctex}
\usepackage{natbib} % 提供丰富的引用命令
\begin{document}
% \cite — 基本引用
Transformer 架构 \cite{vaswani2017attention} 彻底改变了 NLP 领域。
% \citep — 括号引用:(Vaswani et al., 2017)
自注意力机制已被广泛采用 \citep{vaswani2017attention}。
% \citet — 文本引用:Vaswani et al. (2017)
\citet{vaswani2017attention} 提出了 Transformer 架构。
% \citeyear — 仅年份:2017
Vaswani 等人在 \citeyear{vaswani2017attention} 年提出了该方法。
% 多文献引用
深度学习的代表性工作包括
\citep{vaswani2017attention, devlin2019bert, bishop2006pattern}。
% 带页码
详见 \citep[第~3~章]{bishop2006pattern}。
% 在文档末尾生成参考文献列表
\bibliographystyle{plainnat} % 引用样式
\bibliography{refs} % 指向 refs.bib 文件
\end{document}pdflatex → bibtex → pdflatex → pdflatex。CoCraft 会自动处理这些步骤,你只需点击一次编译。natbib vs biblatex
LaTeX 社区有两套主流的参考文献管理方案。选择哪一套,通常取决于你投稿的期刊要求。
natbib + BibTeX(传统方案)
大多数国际期刊(IEEE、ACM、Springer、Elsevier)的官方模板仍然使用 natbib。如果你使用期刊提供的.cls 文件,通常直接用 natbib 就行。
\documentclass{article}
% natbib 方案
\usepackage[square, numbers, sort&compress]{natbib}
% square: 方括号 [1]
% numbers: 数字引用
% sort&compress: [1,2,3] → [1-3]
\begin{document}
深度学习~\citep{vaswani2017attention} 已取得突破性进展。
\bibliographystyle{unsrtnat} % 按引用顺序排列
\bibliography{refs}
\end{document}biblatex + Biber(现代方案)
biblatex 是更现代的方案,功能更强大,配置更灵活。它使用 Biber 作为后端引擎,原生支持 Unicode(中文作者名无问题)、更多文献类型(如 @online)和精细的格式控制。推荐在新项目中使用。
\documentclass{article}
\usepackage[UTF8]{ctex}
% biblatex 方案
\usepackage[
backend=biber, % 使用 Biber 引擎
style=numeric, % 数字引用样式 [1]
sorting=none, % 按引用顺序排列
maxbibnames=3, % 超过 3 位作者显示 et al.
minbibnames=1,
giveninits=true % 名字缩写
]{biblatex}
\addbibresource{refs.bib} % 注意:用 \addbibresource 不是 \bibliography
\begin{document}
Transformer~\cite{vaswani2017attention} 已成为标准架构。
BERT~\parencite{devlin2019bert} 开创了预训练范式。
\textcite{bishop2006pattern} 的教材至今仍是经典。
\printbibliography % 注意:用 \printbibliography 不是 \bibliography
\end{document}两套方案的核心区别在于:natbib 用 \bibliography,biblatex 用 \addbibresource + \printbibliography。两者不能混用。
GB/T 7714 中文引用格式
中国国家标准 GB/T 7714-2015 规定了中文学术论文的参考文献著录格式。如果你投稿国内期刊或撰写学位论文,几乎一定需要使用这个标准。LaTeX 社区提供了两种实现方式。
方式一:gbt7714 宏包(基于 natbib)
\documentclass{article}
\usepackage[UTF8]{ctex}
% gbt7714 宏包(与 natbib 兼容)
\usepackage{gbt7714}
% 默认使用顺序编码制([1] [2] [3])
% 如需著者-出版年制,改为:
% \usepackage[authoryear]{gbt7714}
\begin{document}
自然语言处理领域近年来取得了显著进展~\cite{vaswani2017attention}。
\citet{bishop2006pattern}~的著作系统介绍了模式识别方法。
相关工作还包括~\cite{devlin2019bert, vaswani2017attention}。
\bibliography{refs} % 样式由 gbt7714 自动设置
\end{document}方式二:biblatex-gb7714-2015(基于 biblatex)
\documentclass{article}
\usepackage[UTF8]{ctex}
% biblatex + GB/T 7714 样式
\usepackage[
backend=biber,
style=gb7714-2015, % GB/T 7714 顺序编码制
% style=gb7714-2015ay, % GB/T 7714 著者-出版年制
gbpub=false, % 去掉"出版地不详"等标注
gbnamefmt=lowercase % 作者名小写
]{biblatex}
\addbibresource{refs.bib}
\begin{document}
深度学习\cite{vaswani2017attention}已在多个领域取得突破。
\textcite{bishop2006pattern}的经典教材至今仍被广泛引用。
\printbibliography[title={参考文献}]
\end{document}gbt7714 宏包;如果模板基于 biblatex 或者你在新建项目,推荐 biblatex-gb7714-2015。两者都能生成符合国标的参考文献列表,不要混用。CoCraft 的智能文献管理
手动维护 .bib 文件是一件容易出错的事——作者名格式不一致、字段缺失、重复条目。CoCraft 内置了一系列工具来解决这些痛点。
DOI 自动导入
在 CoCraft 的文献面板中粘贴一个 DOI(如 10.48550/arXiv.1706.03762),系统会自动从 CrossRef、DBLP 等数据库获取完整的文献元数据,生成格式规范的 BibTeX 条目并插入到你的 .bib 文件中。批量导入也同样支持——粘贴多个 DOI,一次性导入。
引用健康检查
CoCraft 会自动扫描你的 .bib 文件和正文中的引用命令,检测常见问题:未引用的文献条目、引用了但在 .bib 中不存在的键、缺失的必填字段(如 article 类型缺少 journal)、可能重复的条目。这些检查帮助你在编译之前就发现并修复问题。
与文献管理工具集成
如果你已经在使用 Zotero 或 Mendeley 等文献管理工具,可以直接导出 .bib 文件并上传到 CoCraft 项目中。CoCraft 也支持从 Google Scholar 页面一键复制 BibTeX 条目。你的文献库可以在不同工具之间无缝流转。
用 CoCraft 管理你的参考文献
输入 DOI 即可自动生成 BibTeX,内置引用健康检查。
edit_document免费开始使用