在科研寫作中,參考文獻格式一直都是比較頭疼的問題,尤其是在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,有格式錯誤,有依賴錯誤,一步一步排查,定位錯誤,有可能就是刪掉緩存重新來一遍就好了,祝好運一次成功。