2018/4/29 Aiden Leung
更改VScode的用户设置(文件–>首选项–>设置)”latex-workshop.latex.recipes”和”latex-workshop.latex.tools”如下:
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.tools": [
{
"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%"
]
}
],
编译生成的pdf文件不能显示插入的eps格式图片(Texwork中选择xelatex可以直接插入,选择pdflatex则同样不能插入eps格式的图片。),所以考虑将eps格式转为pdf。批量转换某一文件夹下的所有eps图片并输出到指定文件夹的MATLAB脚本如下:
% Convert an eps file to pdf format using epstopdf
% 确定路径无误,否则会出错
dirpathsource = 'C:\Users\LiangNN\Desktop\LaTeX\figures\';
dirpathdest = 'C:\Users\LiangNN\Desktop\LaTeX\figures\test\';
dirs = dir([dirpathsource '*.eps']);
for ii = 1:length(dirs)
system(['epstopdf ' [dirpathsource dirs(ii).name] ' ' [dirpathdest dirs(ii).name(1:end-3) 'pdf']]) %注意空格一定要保留
end
另外还在网上看到了一个GitHub项目可以完成eps到pdf的转换,是一个MATLAB的工具包,将链接留下,以后想看了再说:export_fig
更改VScode的用户设置(文件–>首选项–>设置),删除编译产生的无用文件
//删除编译过程中产生的无用文件
"latex-workshop.latex.clean.enabled": true,
"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"
],
我安装了texlive 0.6.2和vscode 1.22.2,vscode的扩展是LaTeX Workshop 5.3.1。