环境

  • Ubuntu18.4
  • Vscode + latex workshop
  • TinyTeX

原本打算安装latex live但是安装需要5G存储空间,后来看到轻量级的TinyTeX,所以放弃使用Latex Live转而使用TinyTeX

安装

  • VSCode 安装配置自行谷歌
  • Latex Workshop 直接在VSCode插件安装配置
    1
    2
    3
    4
    5
    6
    7
    8
    # setting中新增
    "latex-workshop.latex.magic.args": [
    "-shell-escape",
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "%DOC%"
    ],
  • TinyTeX安装
    1
    wget -qO- "https://yihui.name/gh/tinytex/tools/install-unx.sh" | sh
  • TinyTeX添加到path
    1
    2
    3
    4
    5
    vim ~/.bashrc
    # add
    export PATH=$PATH:/home/usename/.TinyTeX/bin/x86_64-linux
    # reload
    source ~/.bashrc
  • 安装xelatex支持中文
    1
    sudo apt install xelatex

使用

  1. 新建hello.tex
  2. 添加内容
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    % hello.tex
    % !TEX program = xelatex
    % !BIB program = bibtex
    \documentclass[a4paper,11pt]{article}
    % 中文支持
    \usepackage{xeCJK}
    \setCJKmainfont{WenQuanYi Micro Hei}
    % define the title
    \author{Skayawang}
    \title{Minimalism}
    \begin{document}
    % generates the title
    \maketitle
    % insert the table of contents
    \tableofcontents
    \section{Start}
    Well, and here begins my lovely article.
    \section{End}
    \ldots{} and here it ends.
    \end{document}