LaTex and VSCode with Chinese

本文介绍了如何在VSCode中配置TexLive与一些有用的扩展,如LaTeX Workshop,用于高效地编辑和编译LaTeX文档。通过编辑settings.json文件,设置latexmk、xelatex和pdflatex等工具及其参数,实现自动化构建流程。示例代码展示了一个包含中文支持的LaTeX文章,展示了VSCode在中文文档排版上的应用。

Requirement

  1. VSCode
  2. TexLive + TextStudio
  3. Some useful Extension for VScode:
    • Code Spell Checker
    • LaTex Utilities
    • LaTex Workshop

1. Edit setting.json , append the content below.

// Latex workshop
    "latex-workshop.latex.tools": [
        {
        "name": "latexmk",
        "command": "latexmk",
        "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-pdf",
        "%DOC%"
        ]
        },
        {
        "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%"
        ]
        }
    ],
"latex-workshop.latex.recipes": [
        {
        "name": "xelatex",
        "tools": [
        "xelatex"
                    ]
                },
        {
        "name": "latexmk",
        "tools": [
        "latexmk"
                    ]
        },

        {
        "name": "pdflatex -> bibtex -> pdflatex*2",
        "tools": [
        "pdflatex",
        "bibtex",
        "pdflatex",
        "pdflatex"
                    ]
        }
    ],
"latex-workshop.view.pdf.viewer": "tab",  
"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"
    ],
    "cSpell.languageSettings": [
    
    ],
  

2. Example in Chinese

%!TEX program = pdflatex
\documentclass{article}

\usepackage[UTF8]{ctex}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}
\title{Example of LaTex and VSCode in 中文 }
\author{你好 world!}

\begin{document}
\maketitle
% -----------------------------------------------------------
\section{MOT研究现状}
% 
基于目标跟踪的初始化方法,我们将现有的MOT方法分为两类。

\begin{figure} 
    \centerline{\includegraphics[scale=.8]{./fig/mot_3_types.png}}
    \label{mot-type}
    \caption{Comparison of processing steps between (a) DFT, (b) Two-Step TBD, and (c) One-Shot TBD methods}
\end{figure}

\end{document}

% 这里是导言区
% \begin{document}
% Hello, world   !
% fuck you latex
% 你好
% 中文呢

% \end{document}


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值