1 第一步:正确配置setting.json
注意
(1)在setting.json文件中添加以下内容
(2)在"latex-workshop.latex.recipes"中把 “name”: "pdflatex -> bibtex -> pdflatex*2"放在第一个,如果不这样,那需要**.tex文件和**.bib文件需要同名,才能编译成功
(3)“latex-workshop.latex.autoClean.run”:"onBuilt"表示编译**.tex文件后删除冗余的文件,但是在编译**.bib文件时,需要.aux冗余文件,除非不用编译.bib文件,一般不要加这句话。
"latex-workshop.latex.tools": [{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
}, {
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}, {
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}, {
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}],
"latex-workshop.latex.recipes": [{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "xelatex",
"tools": [
"xelatex"
]
}, {
"name": "latexmk",
"tools": [
"latexmk"
]
},
],
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.toolchain": [
{
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}
],
"latex-workshop.latex.clean.enabled": true,
// "latex-workshop.latex.autoClean.run":"onBuilt",
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk",
"*.gz",
],
2 第二步:准备reference.bib文件
从谷歌学术或者百度学术中获得BibTex文件,复制粘贴进reference.bib中。
@inproceedings{ru2020model,
title={Model-driven channel estimation for OFDM systems based on image super-resolution network},
author={Ru, Xin and Wei, Li and Xu, Youyun},
booktitle={2020 IEEE 5th International Conference on Signal and Image Processing (ICSIP)},
pages={804--808},
year={2020},
organization={IEEE}
}
其中“ru2020model”是自定义的名称,在论文中引用的时候用到
3 第三步:引用文献
在论文的正文中引用
\documentclass[UTF8]{ctexart}
\usepackage{cite} % 导入引用的包,能够使用\cite
\begin{document}
% \cite括号内为引用文献的变量名,\cite前要有一个空格
% 在正文中引用,如果不引用则在参考文献部分中不显示该文献
ComNet \cite{ru2020model}深度学习的模型是一个OFDM无线接收机的深度学习模型 .
\bibliography{reference} % 导入lib,ref为“ref.lib"的文件名
\bibliographystyle{ieeetr} % 参考文献排版风格,这个是IEEE transaction的,其他可以自查
\end{document}
4 第四步:编译***.tex文件
在Vscode中保存即可编译,或者点击编译按钮
5 第五步:编译***.bib文件
在终端中cd 进入reference.bib文件目录,执行以下编译命令
bibtex reference
如果报错没有找到.aux文件,那就去setting.json文件中找到删除冗余文件的代码注释掉
6 第六步:更新***.tex文件
在Vscode中保存即可编译,或者点击编译按钮。查看PDF文件时。就可以看到论文的最后生成了参考文献。