Ubuntu下安装Latex并配置Vscode编辑环境(中文支持+解决algorithmic.sty not found问题)

1. 安装latex

# (1) 安装Latex

sudo apt-get install texlive-latex-base

 

# (2) 安装latex-cjk,支持unicode及中文环境

sudo apt-get install latex-cjk-all

sudo apt-get install texlive-latex-extra

 

# (3) 安装texmaker,一个图形化编辑界面

sudo apt-get install texmaker

 

# (4) 安装xelatex

sudo apt-get install texlive-xetex

 

# (5) 安装texlive-publishers,支持publishers, theses, standards, conferences

sudo apt-get install texlive-publishers

 

# 使用apt-cache show texlive-publishers命令可以看到它所支持的CTAN包的信息

 

# (6) 安装texlive-science,解决algorithmic.sty not found问题

sudo apt-get install texlive-science

 

2. 配置visual studio code

2.1 安装插件LaTeX Workshop

 

Ubuntu下安装Latex并配置Vscode编辑环境(中文支持+解决algorithmic.sty not found问题)_第1张图片

 

2.2 配置设置文件settings.json

打开【Settings】,搜索latex,选择【Edit in settings.json】打开settings.json文件。

Ubuntu下安装Latex并配置Vscode编辑环境(中文支持+解决algorithmic.sty not found问题)_第2张图片

Ubuntu下安装Latex并配置Vscode编辑环境(中文支持+解决algorithmic.sty not found问题)_第3张图片

 

 

增加配置代码如下:

{

"latex-workshop.latex.recipes": [

{

"name": "xelatex",

"tools": [

"xelatex"

]

},

{

"name": "xelatex->bibtex->exlatex*2",

"tools": [

"xelatex",

"bibtex",

"xelatex",

"xelatex"

]

}

],

 

"latex-workshop.latex.tools": [

{

"name": "xelatex",

"command": "xelatex",

"args": [

"-synctex=1",

"-interaction=nonstopmode",

"-file-line-error",

"%DOC%"

]

},

{

"name": "bibtex",

"command": "bibtex",

"args": [

"%DOCFILE%"

]

}

],

}

 

2.3 在vscode中编译并预览

选择一个.tex文件并使用vscode打开。点击【Recipe: xelatex】编译,再点击【View in VSCode tab】可预览,结果如图:

 

Ubuntu下安装Latex并配置Vscode编辑环境(中文支持+解决algorithmic.sty not found问题)_第4张图片

你可能感兴趣的:(生产力工具,visual,studio,code,latex,ubuntu)