本文主要是介绍latex sign_【包学包会】【LaTex篇】TeXLive+VsCode+TexStudio,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ShareStuff
光阴似箭
日月如梭
终于等到你
还好没放弃
引言
欢迎到知乎和语雀平台进行提问,或者推文下方留言!
今天给大家介绍 LaTeX 的环境搭建和一些学习网址。
- 感谢 ElegantLaTeX 群主及成员,一年多的加入确实学习了不少技能!

- 感谢 LaTeX 工作室[1] 提供的模板和学习资料,同时也可去这里查看下载安装[2]!
- 感谢 Stack Exchange[3] 提供的解决方案,使得学习中的问题得到解决!
LaTeX 是具有较强的排版功能,可在线写作 Overleaf[4] 和 编辑器中写作。
常用的编辑有如下:【推荐 TeXStudio 和 VsCode】
WinEdt
TeXworks
TeXStudio
TeXShop (Mac)
TeXPad (Mac)
VsCode
Vim
Emacs
Sublime Text
推荐几个在线工具:
- 在线 LaTeX 表格[5]
- 在线 LaTeX 公式 1[6]
- 在线 LaTeX 公式 2[7]
最后
欢迎大家关注
微信公众号:ShareStuff
微信小程序:ShareStuff

正文
环境:Win10
- VsCode_LaTeX环境:TEX Live[8] + Visual Studio Code + 插件
- TeXStudio_LaTeX环境:TEX Live + TeXStudio[9]
- PDF 编辑器:SumatraPDF[10]和 PDF X-change
- 利用 VsCOde 搭建 LaTeX 环境需要安装[11]:
• TEX Live 或者 MiKTeX (建议 TEX Live )
• Visual Studio Code
• LATEX Workshop (VS Code 插件)
• SumatraPDF 阅读器(可选,用于预览 PDF)
在上述软件/插件安装之后,需要把 TEX Live 的 bin 目录(D:/Program Files/texlive/2018/bin/win32) 以及 SumatraPDF 的路径(C:/Program Files (x86)/SumatraPDF)添加到系统环境变量(Path)中。
TexLive 安装
清华镜像下载地址[12]

下载并解压后,在文件夹中,双击 install-tl-windows.bat 或者 install-tl-Advanced.bat。
也可以看这里,详细的 TexLive 安装说明[13]。

- 基本安装

- 高级安装【Advanced】

注意:
- TEX Live 的 bin 目录(如 D:/Program Files/texlive/2018/bin/win32)路径添加到系统环境变量(Path)中。
TeXstudio 安装
- 双击下载好的 texstudio-2.12.22-win-qt5.exe,安装目录可更改!

- 点击 install

- 可更换语言


- 构建设置【也可导入导出设置参数】,设置编译组合方式!
VsCode 安装
安装 VsCode
VSCode 下载[14]
下载完成后,即可安装!
配置 LateX
安装 LaTeX Workshop 插件
修改 user setting
点击左下角,进入用户设置
VsCode 默认添加了 3 个编译工具(tools):分别是 latexmk,pdflatex 和 bibtex(所有的工具只编译一次)。
为了添加其他的编译方式(比如 xelatex),我们需要修改配置。
如果我们要对一个文档/项目完整的编译(比如 pdflatex -> bibtex -> pdflatex -> pdflatex),怎么办呢?
编译组合(recipes):
LaTeX Workshop 默认添加了两个 recipes,分别是 latexmk 和 pdflatex -> bibtex -> pdflatex*2,
可以通过点击左侧新增的 TEX 按钮 ,然后点击 Build LaTeX project,选择适合的编译组合。
添加新的编译组合之后需要重启 VsCode 才能在 TEX 按钮下看到。

打开 settings.json,删除所有内容,复制粘贴如下配置文件内容。具体配置文件如下:
{
"latex-workshop.latex.recipes": [
{
"name": "PDFLaTeX",
"tools": [
"pdflatex"
]
},
{
"name": "PDFLaTeX with Shell Escape",
"tools": [
"pdflatex-with-shell-escape"
]
},
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]},
{
"name": "XeLaTeX with Shell Escape",
"tools": [
"xelatex-with-shell-escape"
]
},
{
"name": "PDFLaTeX -> BibTeX -> PDFLaTeX*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "XeLaTeX -> BibTeX -> XeLaTeX*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "BibTeX",
"tools": [
"bibtex"
]
},
{
"name":"MakeIndex",
"tools":[
"makeindex"
]
},
],
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "xelatex-with-shell-escape",
"command": "xelatex",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "pdflatex-with-shell-escape",
"command": "pdflatex",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
},
{
"name":"makeindex",
"command":"makeindex",
"args":["%DOCFILE%"]
},
],
}
请按照上面进行复制,然后保存后,重启 VSCode。
测试
1)新建并打开文件夹,之后所有产生的文件都在此文件夹下,如桌面下 VScode 内的 LaTeX。
2)新建 tex 文件,扩展名是 .tex
3)编写 tex 文档
在 test.tex 中输入:
\documentclass{article}
\begin{document}
hello,world
\end{document}
单击"Recipe:xelatex",使用 xelatex 编译,预览可以选择在 VSCode 的标签页中打开即可。
注意:当你修改 tex 文档的时候,修改后保存,先进行编译,然后预览。在 vs 界面中的预览效果:

%这一段是用于编写中文文档的代码
\documentclass[UTF8]{ctexart}
\title{\LaTeX 练习}
\author{XXX}
\date{\today}
\begin{document}
\maketitle
在此处输入你的内容
\end{document}

配置知乎
安装插件

进入主页面
点击登录图标,或使用 Ctrl + Shift + P
打开命令面板,搜索并执行 Zhihu: Login
命令。

选择登录方式:
二维码
根据提示操作即可。
账号密码
根据提示操作即可。

知乎搜索
内容发布
- 若你想在特定的问题下回答
#! https://... 的格式放置于文件的第一行,发布即可
比如:
#! https://www.zhihu.com/question/19602618
答案:balabalabala................
- 若是你已经创作过的答案, 则将答案的链接放置于文件的第一行,发布即可
比如:
#! https://www.zhihu.com/question/355223335/answer/1003461264
更正答案:balabalabala................
- 还可以选择发布新文章,或从收藏夹中选取发布即可

上传图片
从粘贴板上传图片
先从电脑的任何地方复制一张图片或者截图,然后按下快捷键为 ctrl+alt+p
,即可自动生成相应链接。
打开文件选择图片
在正在编辑文档内右键,如下图选择,然后选择一张图片。

彩蛋
免费进群


欢迎打赏


致谢
参考资料
[1]LaTeX工作室: https://www.latexstudio.net/
[2]下载安装: https://www.latexstudio.net/archives/51801.html
[3]Stack Exchange: https://tex.stackexchange.com/
[4]Overleaf: https://www.overleaf.com
[5]在线LaTeX表格: https://www.tablesgenerator.com/
[6]在线LaTeX公式1: https://private.codecogs.com/latex/eqneditor.php
[7]在线LaTeX公式2: https://www.latexlive.com/
[8]TEX Live: https://tug.org/texlive/
[9]TeXStudio: http://texstudio.sourceforge.net/
[10]SumatraPDF: https://www.sumatrapdfreader.org/download-free-pdf-viewer.html
[11]安装: https://github.com/EthanDeng/vscode-latex/blob/master/main.pdf
[12]清华镜像下载地址: https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/
[13]详细的 TexLive 安装说明: http://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf
[14]VSCode下载: https://code.visualstudio.com/docs/?dv=win
这篇关于latex sign_【包学包会】【LaTex篇】TeXLive+VsCode+TexStudio的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!