【Vscode+Latex】Mac 系统Vscode的LaTeX中插入参考文献

简介: 在Mac系统下的VSCode环境中配置LaTeX工作流以便插入和引用参考文献的详细步骤。

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中。

1.png

@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中保存即可编译,或者点击编译按钮

2.png

5 第五步:编译***.bib文件

在终端中cd 进入reference.bib文件目录,执行以下编译命令

bibtex reference

如果报错没有找到.aux文件,那就去setting.json文件中找到删除冗余文件的代码注释掉

6 第六步:更新***.tex文件

在Vscode中保存即可编译,或者点击编译按钮。查看PDF文件时。就可以看到论文的最后生成了参考文献。

目录
相关文章
|
1月前
|
关系型数据库 MySQL 数据库
【Mac os系统】安装MySQL数据库
本文详细介绍了在Mac OS系统上安装MySQL数据库的步骤,包括下载、安装、配置环境变量、启动服务、授权设置以及解决常见问题,并提供了一些常用的MySQL命令。
55 0
【Mac os系统】安装MySQL数据库
|
1月前
|
iOS开发 MacOS
【Mac系统】解决Vscode中LeetCode插件不能刷剑指offer题库
文章讨论了解决Mac系统中Vscode里LeetCode插件无法刷剑指Offer题库的问题,并提供了一些相关的使用技巧和资源链接。
85 1
|
27天前
mac系统使用NTFS移动硬盘只读问题
mac系统使用NTFS移动硬盘只读问题
47 4
|
1月前
|
Linux
【Linux 或Mac系统】自动生成项目结构目录并放在README.md文件中
如何在Linux或Mac系统中使用tree命令自动生成项目结构目录,并将其格式化后放入项目的README.md文件中以展示项目结构。
64 1
|
1月前
|
JavaScript Linux iOS开发
【Mac系统】Vscode使用LeetCode插件报错‘leetcode.toggleLeetCodeCn‘ not found
在Mac系统下使用VSCode的LeetCode插件时遇到“leetcode.toggleleetcodecn”命令找不到的错误解决方法,主要是通过从Nodejs官网下载并安装最新版本的Node.js来解决环境配置问题。
90 0
|
27天前
|
NoSQL 数据可视化 Redis
Mac安装Redis
Mac安装Redis
33 3
|
27天前
|
关系型数据库 MySQL 数据安全/隐私保护
Mac安装Mysql5.7
Mac安装Mysql5.7
46 5
|
27天前
|
缓存 关系型数据库 MySQL
Mac安装brew
Mac安装brew
95 5
|
27天前
|
Oracle Java 关系型数据库
Mac安装JDK1.8
Mac安装JDK1.8
257 4
|
27天前
|
数据安全/隐私保护 iOS开发 MacOS
Mac安装Navicat Premium 16.3.5
Mac安装Navicat Premium 16.3.5
85 3