美文网首页
CTeX、VScode协作写作

CTeX、VScode协作写作

作者: lossfunc | 来源:发表于2018-03-22 13:44 被阅读0次

今天花了两个小时终于搭建好了TeX的写作环境,还是有点繁琐的,总是会动不动踩到坑,这里记录下以便下次参考。

下载CTeX

CTeX的官方网站:CTeX下载
清华大学镜像站:清华大学镜像站CTeX下载
有基本版和完整版,我嫌完整版太大,选择了基本版的下载,暂时足够使用。

安装CTeX

据说安装可能导致环境变量被覆盖,所以安装前请自行备份一份,我安装的时候并没有覆盖,谨慎起见,还是备份下吧。安装没有什么多余的选项,直接一路next就好。

VScode上配置CTeX的开发环境

  • 下载插件 LaTeX Workshop
  • 在首选项--设置--用户设置中添加以下内容:
   "latex-workshop.latex.toolchain": [
       {
           "command": "pdflatex",
           "args": [
               "-synctex=1",
               "-interaction=nonstopmode",
               "-file-line-error",
               "%DOC%"
           ]
       },
       {
           "command": "bibtex",
           "args": [
               "%DOCFILE%"
           ]
       },
       {
           "command": "pdflatex",
           "args": [
               "-synctex=1",
               "-interaction=nonstopmode",
               "-file-line-error",
               "%DOC%"
           ]
       },
       {
           "command": "pdflatex",
           "args": [
               "-synctex=1",
               "-interaction=nonstopmode",
               "-file-line-error",
               "%DOC%"
           ]
       }
   ],
}

来个简单的例子:

\documentclass[UTF8]{ctexart}
\title{你好,world!}
\author{Liam}
\date{\today}
\begin{document}
\maketitle
\section{你好中国}
中国在East Asia.
\subsection{Hello Beijing}
北京是capital of China.
\subsubsection{Hello Dongcheng District}
\paragraph{Tian'anmen Square}
is in the center of Beijing
\subparagraph{Chairman Mao}
is in the center of 天安门广场。
\subsection{Hello 山东}
\paragraph{山东大学} is one of the best university in 山东。
\end{document}
右键就有编译的选项,或者ctrl+alt+B,然后在右上角可以选择预览。效果如下: ctex.png

至此,就可以使用VScode开心的写TeX啦~

参考链接

相关文章

网友评论

      本文标题:CTeX、VScode协作写作

      本文链接:https://www.haomeiwen.com/subject/idkaqftx.html