在科研写作中,参考文献格式一直都是比较头疼的问题,尤其是在Latex排版过程中,将Bibtex按照固定格式生成参考文献的方式比较受欢迎,下面进行详细介绍。
一、原料
1. bib 文件,这个文件是你参考文献的文件,你可以在谷歌学术中搜索文献,点击引用(cite),下载bibtex格式的文件,后缀名就.bib,给一个范例,长这个样子
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
@article{Henriques_2015,
doi = {10.1109/tpami.2014.2345390},
url = {https://doi.org/10.1109%2Ftpami.2014.2345390},
year = 2015,
month = {mar},
publisher = {Institute of Electrical and Electronics Engineers ({IEEE})},
volume = {37},
number = {3},
pages = {583--596},
author = {Joao F. Henriques and Rui Caseiro and Pedro Martins and Jorge Batista},
title = {High-Speed Tracking with Kernelized Correlation Filters},
journal = {{IEEE} Transactions on Pattern Analysis and Machine Intelligence}
}
@inproceedings{Bibi_2015,
doi = {10.1109/iccvw.2015.83},
url = {https://doi.org/10.1109%2Ficcvw.2015.83},
year = 2015,
month = {dec},
publisher = {Institute of Electrical and Electronics Engineers ({IEEE})},
author = {Adel Bibi and Bernard Ghanem},
title = {Multi-template Scale-Adaptive Kernelized Correlation Filters},
booktitle = {2015 {IEEE} International Conference on Computer Vision Workshop ({ICCVW})}
}
|
上面就是两篇参考文献,第一行是key,也就是我们引用的标识
在这里,博主推荐JabRef,可以直接管理bib文件,方便导入导出
2. bst文件,这个文件是我们生成参考文献的样式,比如IEEEtran用来规定IEEE会议引文的样式,我们可以在要投稿期刊的官网下载引文样式
3. tex文件,这是我们的论文,latex标记用来排版的源文件,也是内容文件
二、过程
1. 在原文中插入引用
1
2
3
4
5
6
7
8
9
|
\begin{document}
%... 此处省略1000字
A\cite{Henriques_2015} %引用
%... 此处省略1000字
\bibliography{bibfile}
\bibliographystyle{bstfile}
\end{document}
|
\cite{key} 来引用bib文件中的文献
在\end{document}之前加入上面的那两行代码,规定好bst文件和bib文件
2. 编译生成参考文献
这时要注意要多次编译,如果流程没走对中间参考文献可能会出现问号,基本流程:Latex->Bibtex->Latex->Latex
2.1 我们先编译PdfLatex,这时如果不会报错就进入下一步,如果有错误,就修复错误。编译完成可以获得*.aux *.dvi *.log和 *.gz文件
2.2 点击Bibtex编译,可以获得*.blg 和 *.bbl文件,*.bbl文件就是插入的参考文献了,这一步如果出错,最有可能的就是bib中参考文献格式出错,要认真核对
2.3 点击Latex编译,获得新的*aux *.dvi *.log和 *.gz文件
2.4 点击Latex编译,获得正确的引文
中间如果错误原因不明,建议删除缓存文件,一步一步重新来,根据错误提示定位错误
3. 关于生成的bbl文件
事实上,我们可以直接把bbl中的文件粘贴到tex文件中规定bst和bib文件的位置(替换),这样是最好的,抛弃了依赖文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
\begin{thebibliography}{2}
\bibitem{Henriques_2015}
Henriques
, J.F., Caseiro, R., Martins, P., Batista, J.: `High-speed tracking
with kernelized correlation filters', \emph{{IEEE} Transactions on Pattern
Analysis and Machine Intelligence}, 2015, \textbf{37}, (3), pp.~583--596.
\newblock Available from: \url{https://doi.org/10.1109%2Ftpami.2014.2345390}
\bibitem{Bibi_2015}
Bibi
, A., Ghanem, B.
\newblock `Multi-template scale-adaptive kernelized correlation filters'.
\newblock In: 2015 {IEEE} International Conference on Computer Vision Workshop
({ICCVW}). (Institute of Electrical and Electronics Engineers ({IEEE}),
2015. Available from: \url{https://doi.org/10.1109%2Ficcvw.2015.83}
\end{thebibliography}
|
就是这么简单,虽然博主折腾出各种bug,有格式错误,有依赖错误,一步一步排查,定位错误,有可能就是删掉缓存重新来一遍就好了,祝好运一次成功。