赞
踩
本文介绍如何使用TeXLive+VSCode实现Windows系统上可以本地实现对LaTeX文件的操作,包括阅读、编写和编译等。
本文基本使用默认普遍使用的选项进行安装,可能会根据作者对相关功能的理解进行后续更新。
操作系统:Windows10
TeXLive:直接使用Easy install来安装
VSCode插件:LaTeX Workshop v8.26.0
安装TeXLive:
TeXLive官网:TeX Live - TeX Users Group
Windows用户选择install on Windows选项,跳转至:Windows - TeX Live - TeX Users Group
选择Easy install:Easy install
下载安装包:https://mirror.ctan.org/systems/texlive/tlnet/install-tl-windows.exe
直接点击该安装包,基本选择默认安装(安装路径可以选择为自己的路径)。需要安装很久,5个多小时吧。
Easy install可以默认直接操作系统PATH变量等,就不再需要手动操作。
常见错误:
*** PLEASE READ THIS WARNING ***********************************
The following (inessential) packages failed to install properly:
asymptote.windows
You can fix this by running this command:
tlmgr update --all --reinstall-forcibly-removed
to complete the installation.
However, if the problem was a failure to download (by far the
most common cause), check that you can connect to the chosen mirror
in a browser; you may need to specify a mirror explicitly.
******************************************************************
这个是由于安装过程中断网了导致下载失败,只要按照它说的在cmd中重新运行一遍tlmgr update --all --reinstall-forcibly-removed
就可以:
C:\Users\Administrator>tlmgr update --all --reinstall-forcibly-removed
tlmgr.pl: package repository https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/tlnet (not verified: gpg unavailable)
tlmgr.pl: saving backups to D:/texlive/2023/tlpkg/backups
[1/1, ??:??/??:??] auto-install: asymptote.windows (65920) [7368k] ... done
tlmgr.pl: package log updated: D:/texlive/2023/texmf-var/web2c/tlmgr.log
安装LaTeX Workshop:在VSCode插件商店直接选择该插件,点击install,即可安装:
本文使用一个简单的例子,来自overleaf官方文档(具体在这一部分:Chinese - Overleaf, Online LaTeX-redigeringsprogram)。
新建文本文件latex_example.tex,文件内容为:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Welcome to Overleaf --- just edit your LaTeX on the left, % and we'll compile it for you on the right. If you open the % 'Share' menu, you can invite other users to edit at the same % time. See www.overleaf.com/learn for more info. Enjoy! % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass{article} \usepackage{CJKutf8} \begin{document} \begin{CJK*}{UTF8}{gbsn} \section{前言} \section{关于数学部分} 数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments. \end{CJK*} \bigskip %% Just some white space You can also insert Latin text in your document \bigskip %% Just some white space \begin{CJK*}{UTF8}{bsmi} 這是繁體中文。 \end{CJK*} \end{document}
点击VSCode左侧工具栏的TEX:
可以构建LaTeX项目:
观看渲染后的效果:
可以用VSCode编辑器直接打开一个新的tab来查看渲染效果:
在overleaf上渲染的效果是:
可以看出我们使用TeXLive和VSCode插件已经成功在Windows系统电脑的本地实现了LaTeX文件的编译和读写功能!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。