自从有了它,我终于能完成我的学术论文了

前言

最近在完善一篇学术论文,格式要用到LaTeX,LaTeX比较庞大,只能装在电脑上面,本人经常奔波于宿舍、教室、图书馆和实验室之间,电脑真的很沉。疫情原因必须按照学校规划的路径走,没有代步工具,距离还很远。每次背着电脑跑一趟都要累的休息一会,很影响创作。有时候灵感一来还要打开电脑再记录,可能这个时间灵感都散掉了。今天偶然和朋友抱怨了一下,朋友马上给我推荐了一个方案,就是上次的在线VScose加上LaTeX,这两个完全开源,且搭配起来非常好用,简直神器,那我们接下来赶紧开整吧!

准备

一台已经部署好在线VScode的服务器,具体部署方案可以看我上一篇文章,可以 登录服务器的SSH客户端,这里我采用orcaterm。

部署

登录服务器

登录服务器控制台,选择Centos7.6系统,进行购买或者重装系统。

如何利用自己喜欢的SSH客户端进行登录服务器,这里采用的是腾讯云新开发的WebShell——orcaterm

安装TeXLive

下载镜像文件

 wget https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/texlive2022-20220321.iso

挂载iso文件

进入下载的iso文件所在目录

挂载

 sudo mount -o loop texlive2021-20210325.iso /mnt

安装

切入/mnt目录(也就是之前挂载iso的目录)

 cd /mnt

开始安装texlive

 sudo ./install-tl

有提示的时候输入I后回车即可。

这一步会比较费时,请耐心等待。

安装完成标志

配置环境变量

进入.bashrc

 vi ~/.bashrc

在最后一行开始输入以下内容

Texlive 说明:这一行是说明给texlive配置环境变量的,不是必须的

 export MANPATH=${MANPATH}:/usr/local/texlive/2021/texmf-dist/doc/man
 export INFOPATH=${INFOPATH}:/usr/local/texlive/2021/texmf-dist/doc/info
 export PATH=${PATH}:/usr/local/texlive/2021/bin/x86_64-linux

卸载iso文件

 sudo umount /mnt

支持中文,需要安装中文包

 sudo apt-get install texlive-lang-chinese

如果报错,记得升级依赖包

sudo apt-get install update

使用更多的字体和软件包

sudo apt-get install texlive-latex-base texlive-latex-extra texlive-latex-recommended texlive-fonts-recommended

安装XeLaTex

sudo apt-get install texlive-xetex

对接VScode

安装LaTeX Workshop插件

进入json设置

输入下面的配置json

{
   “settingsSync.ignoredSettings”: [
       “vslilypond.general.pathToLilypond”
   ],
   
   “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”: “lualatex”,
           “command”: “lualatex”,
           “args”: [
               “-synctex=1”,
               “-interaction=nonstopmode”,
               “-file-line-error”,
               “-shell-escape”, //这个命令行在网上的Latex Workshop设置里一般没有,所以直接recipe会报错
               “%DOCFILE%”
           ]
       },
       {
           “name”: “xelatex”,
           “command”: “xelatex”,
           “args”: [
               “-synctex=1”,
               “-interaction=nonstopmode”,
               “-file-line-error”,
               “%DOCFILE%”
           ]
       },
       {
           “name”: “bibtex”,
           “command”: “bibtex”,
           “args”: [
               “%DOCFILE%”
           ]
       }
   ],
      “latex-workshop.latex.recipes”: [
       {
           “name”: “LuaLaTeX”,
           “tools”: [
               “lualatex”
           ]
       },
       {
           “name”: “XeLaTeX”,
           “tools”: [
               “xelatex”
           ]
       },
       {
           “name”: “xelatex -> bibtex -> xelatex*2”,
           “tools”: [
               “xelatex”,
               “bibtex”,
               “xelatex”,
               “xelatex”
           ]
       },
       {
           “name”: “BibTeX”,
           “tools”: [
               “bibtex”
           ]
       },
       {
           “name”: “lualatex -> bibtex -> lualatex*2”,
           “tools”: [
               “lualatex”,
               “bibtex”,
               “lualatex”,
               “lualatex”
           ]
       },
   ],
  ”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.external.viewer.command”: “C:\\Program Files (x86)\\Adobe\\Acrobat DC\\Acrobat\\Acrobat.exe”,
        //双引号里是pdf浏览器的执行文件,可以根据实际情况更换
       “latex-workshop.view.pdf.viewer”: “tab”,
       “workbench.editorAssociations”: {
           “*.pdf”: “lilypond.pdf.preview”
       },
       “editor.maxTokenizationLineLength”: 99999,
       “jupyter.interactiveWindowMode”: “perFile”,
       “lilypondFormatter.general.reformatTimeout”: 100000,
       “git.confirmSync”: false,
       “jupyter.askForKernelRestart”: false,
       “vslilypond.general.pathToLilypond”: “/usr/local/Cellar/lilypond/2.22.2/bin/lilypond”,
       “git.ignoreLegacyWarning”: true,
       “explorer.confirmDelete”: false,
       “latex-workshop.intellisense.biblatexJSON.replace”: {
           

       
       },
       “PandocCiter.DefaultBib”: “/Users/xhhdd/Documents/test.bib”,
       “editor.inlineSuggest.enabled”: true,
       “security.workspace.trust.untrustedFiles”: “open”,
       “python.defaultInterpreterPath”: “C:\\Users\\cqtwx\\AppData\\Local\\Programs\\Python\\Python39\\python.exe”
}

接下来就能创建tex后缀文件愉快的玩耍啦

资源下载: