LaTexLaTeX科研写作

(1)Win10+TeXLive2018+VSCode+LaTe

2018-10-30  本文已影响179人  5john家安

Windows和Linux都能使用TeXLive和VSCode,VSCode是一个非常好用的编辑器

TeXLive下载与安装

TeXLive官网传送门
百度云下载链接 bfwp
安装时长20分钟左右

VSCode下载与安装

VSCode官网传送门

LaTexWorkshop插件安装

插件配置及中文支持

image.png

所有配置如下

{
    "editor.wordWrap": "on",
    "workbench.startupEditor": "newUntitledFile",
    "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"
    ],
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.latex.recipes": [
 {
            "name": "xelatex",
            "tools": [
              "xelatex",
              "xelatex"
            ]
          },
        {
            "name": "xelatexb",
            "tools": [
              "xelatex",
              "bibtex",
              "xelatex",
              "xelatex"
            ]
          },
        {
          "name": "latexmk",
          "tools": [
            "latexmk"
          ]
        },
        {
          "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": "latexmk",
          "command": "latexmk",
          "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "-pdf",
            "%DOC%"
          ]
        },
        {
          "name": "pdflatex",
          "command": "pdflatex",
          "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOC%"
          ]
        },
        {
          "name": "bibtex",
          "command": "bibtex",
          "args": [
            "%DOCFILE%"
          ]
        }
      ]
}

配置解释如下

注意
默认使用排版引擎程序调用顺序配置"latex-workshop.latex.recipes"中的第一个进行编译排版,上述配置中第一个xelatex不会对bib形式的参考文献编译排版,如用bib形式的参考文献请把第二个xelatexb移到第一个,否则会报错

要让LaTeX编译器支持中文,还需在tex文件头部添加如下代码

\documentclass[UTF8]{ctexart} %ctexart是ctex article的缩写
或
\documentclass[UTF8]{article}
\usepackage{ctex}

LaTeX实例

\documentclass[UTF8]{ctexart}
\author{5john}
\title{LaTeX中文支持及字体}
\begin{document}
\maketitle
{\kaishu 这里是楷体显示},{\songti 这里是宋体显示},{\heiti 这里是黑体显示},{\fangsong 这里是仿宋显示},{\lishu 这里是隶书显示},{\youyuan 这里是幼圆显示}
\end{document}

编译结果

经过上述设置,编写好tex文件后,<Ctrl+s>在保存文件的同时进行编译输出


image.png

注意

文件所在路径和文件名不要有中文,不然会编译失败

上一篇 下一篇

猜你喜欢

热点阅读