1. 安裝
1.1 安裝 TexLive
1.1.1 從軟件源安裝
在終端執行以下代碼,安裝 TexLive 環境:
sudo pacman -S texlive-most
sudo pacman -S texlive-lang
【注】這樣安裝 TexLive 後無法在終端使用 texdoc
工具,會報錯:/usr/local/texlive/2020/texmf-dist/doc/generic/pgf/pgfmanual.pdf
。
1.1.2 從安裝包安裝
如果想要使用 texdoc
等其他工具,最好的辦法還是到官網下載安裝包進行在本地安裝(在線安裝包下載地址、離線安裝包下載地址)。下面以本人安裝爲例:
cd install-tl-20200411
sudo ./install-tl
安裝完後,會提示需要添加路徑:
Add /usr/local/texlive/2020/texmf-dist/doc/man to MANPATH.
Add /usr/local/texlive/2020/texmf-dist/doc/info to INFOPATH.
Most importantly, add /usr/local/texlive/2020/bin/x86_64-linux
to your PATH for current and future sessions.
首先編輯 /etc/profile
文件:
sudo vim /etc/profile
然後刷新使之生效:
source /etc/profile
此時就安裝好 TexLive 了,並且可以在終端使用 texdoc
工具。
【注】更多 TexLive 安裝詳情可參閱 ArchWiki 。
1.2 安裝 VSCode
在終端直接從軟件源安裝即可:
sudo pacman -S visual-studio-code-bin
1.3 配置 VSCode
首先安裝 LaTex 插件 LaTeX Workshop
,然後將以下設置加入到 VSCode 的設置 json 文件中:
{
// 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"
]
}
2. 管理
TexLive 提供了 Tex 宏包管理器 tlmgr
,可以用來安裝、刪除、更新宏包,具體使用參見:
tlmgr --help
3. 文檔
【注】使用LaTex寫作過程中,若想查看某一宏包(XXX)的官方手冊,可以在終端使用 texdoc 命令:
texdoc XXX