当前位置:   article > 正文

爱斯维尔(elsvier)latex环境配置记录

爱斯维尔

我要投的是elsvier下面一个子刊,要求用elsvier的cls文件为核心上传latex代码,b站和同门都请教过,感觉都不完整,还是自己一个晚上高了出来一个能用的,在这里分享下

TexLive环境+VScode编辑器

b站有很多教程,课题组前辈应该也有这方面配置经验,这里就不详述了,直接上个链接吧,其他环境编辑器也都能找到相应教程的
链接: TexLive环境+VScode编辑器

搞到elsarticle.cls文件

官网如下图:

红圈的文件是需要下载的,对于第一个文件:如果是windows就cmd进入安装的文件夹,如果是linux或者mac就直接进入安装位置,并且输入:latex elsarticle.ins
就可以得到cls文件了
在上面的b站视频里你应该已经配好latex vscode环境了吧,之后就可以随便创建一个.tex文件,这时候会有一个tex栏目,可以进入右侧tex栏进行编程了:
这是上面第二个红圈的模板文件,也是比较常用的单列模板:


我们点击打开这个,再切换到TEX栏,点击Recipe:xelatex即可(其他的也可以,点运行按钮也可以,这个我比较常用)
最后View in VSCode Tab就得到如图结果了,可以在模板里编辑文章了

安装SumatraPDF显示

下载就是官网下载,不多说了
把上面settings.json后面加上如下设置:

   "latex-workshop.view.pdf.viewer": "external",
   "latex-workshop.view.pdf.ref.viewer":"auto",
    "latex-workshop.view.pdf.external.viewer.command":"D:/pdf/SumatraPDF/SumatraPDF.exe",  //注意修改路径
    "latex-workshop.view.pdf.external.viewer.args": [
        "%PDF%"
    ],
   "latex-workshop.view.pdf.external.synctex.command":"D:/pdf/SumatraPDF/SumatraPDF.exe",  //注意修改路径
    "latex-workshop.view.pdf.external.synctex.args": [
    "-forward-search",
    "%TEX%",
    "%LINE%",
    "-reuse-instance",
    "-inverse-search",
    "\"D:/VSCode/Microsoft VS Code/Code.exe\" -g \"%f:%l\"", // 注意修改路径
    "%PDF%"
   ],
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

以上相当于是完成了PDF阅读器和vscode之间的绑定,一定注意把修改路径的地方修改了
这时候你运行完,再点"View in external viewer"就可以弹出PDF阅读器了
如果弹不出,在SumatraPDF->设置->高级选项里最后加入:

InverseSearchCmdLine = "D:/VSCode/Microsoft VS Code/Code.exe" "D:\VScode\Microsoft VS Code\resources\app\out\cli.js"  --ms-enable-electron-run-as-node -r -g "%f:%l" //注意修改路径
EnableTeXEnhancements = true
  • 1
  • 2

注意快捷键:从PDF显示到vscode的位置是选中完后双击,从vscode显示到PDF快捷键是ctrl+alt+j

最后再发个我用的整体settings.json设置吧,方便copy:

{
   "latex-workshop.latex.autoBuild.run": "never",
   "latex-workshop.showContextMenu": true,
   "latex-workshop.intellisense.package.enabled": true,
   "latex-workshop.message.error.show": false,
   "latex-workshop.message.warning.show": false,
   "latex-workshop.latex.tools": [
       {
           "name": "xelatex",
           "command": "xelatex",
           "args": [
               "-synctex=1",
               "-interaction=nonstopmode",
               "-file-line-error",
               "%DOCFILE%"
           ]
       },
       {
           "name": "pdflatex",
           "command": "pdflatex",
           "args": [
               "-synctex=1",
               "-interaction=nonstopmode",
               "-file-line-error",
               "%DOCFILE%"
           ]
       },
       {
           "name": "latexmk",
           "command": "latexmk",
           "args": [
               "-synctex=1",
               "-interaction=nonstopmode",
               "-file-line-error",
               "-pdf",
               "-outdir=%OUTDIR%",
               "%DOCFILE%"
           ]
       },
       {
           "name": "bibtex",
           "command": "bibtex",
           "args": [
               "%DOCFILE%"
           ]
       }
   ],
   "latex-workshop.latex.recipes": [
       {
           "name": "XeLaTeX",
           "tools": [
               "xelatex"
           ]
       },
       {
           "name": "PDFLaTeX",
           "tools": [
               "pdflatex"
           ]
       },
       {
           "name": "BibTeX",
           "tools": [
               "bibtex"
           ]
       },
       {
           "name": "LaTeXmk",
           "tools": [
               "latexmk"
           ]
       },
       {
           "name": "xelatex -> bibtex -> xelatex*2",
           "tools": [
               "xelatex",
               "bibtex",
               "xelatex",
               "xelatex"
           ]
       },
       {
           "name": "pdflatex -> bibtex -> pdflatex*2",
           "tools": [
               "pdflatex",
               "bibtex",
               "pdflatex",
               "pdflatex"
           ]
       },
   ],
   "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"
   ],
   "latex-workshop.latex.autoClean.run": "onFailed",
   "latex-workshop.latex.recipe.default": "lastUsed",
   "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
   "latex-workshop.view.pdf.viewer": "external",
   "latex-workshop.view.pdf.ref.viewer":"auto",
    "latex-workshop.view.pdf.external.viewer.command":"D:/pdf/SumatraPDF/SumatraPDF.exe",  //注意修改路径
    "latex-workshop.view.pdf.external.viewer.args": [
        "%PDF%"
    ],
   "latex-workshop.view.pdf.external.synctex.command":"D:/pdf/SumatraPDF/SumatraPDF.exe",  //注意修改路径
    "latex-workshop.view.pdf.external.synctex.args": [
    "-forward-search",
    "%TEX%",
    "%LINE%",
    "-reuse-instance",
    "-inverse-search",
    "\"D:/VSCode/Microsoft VS Code/Code.exe\" -g \"%f:%l\"", // 注意修改路径
    "%PDF%"
   ],
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/994345
推荐阅读
相关标签
  

闽ICP备14008679号