Latex setup
MacOS/Ubuntu + VS Code
MacOS
-
MacTeX: choose smaller download, or by Homebrew:
brew install mactex-no-gui
or
brew install basictex
-
Update
tlmgr
and add to PATH:sudo tlmgr update --self sudo tlmgr path add
-
Install
tlmgr
plugins, check ctan for more:sudo tlmgr install latexmk sudo tlmgr install ctex sudo tlmgr install collection-fontsrecommended
note
ctex
supports Chinese words. -
Install
latexindent
:brew install latexindent
Ubuntu
-
sudo apt-get install texlive-full
or
cd /tmp # working directory of your choice wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz # or curl instead of wget zcat install-tl-unx.tar.gz | tar xf - cd install-tl-* perl ./install-tl --no-interaction # as root or with writable destination # Finally, prepend /usr/local/texlive/YYYY/bin/PLATFORM to your PATH, e.g., /usr/local/texlive/2022/bin/x86_64-linux
Vs Code
-
Install VS Code plugin: LaTex-Workshop.
-
Add following configs into VS Code's
settings.json
:"latex-workshop.latex.outDir": "./out/", "latex-workshop.latex.recipes": [ { "name": "xelatex", "tools": ["xelatex"] }, { "name": "latexmk", "tools": ["latexmk"] } ], "latex-workshop.latex.tools": [ { "name": "xelatex", "command": "xelatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-output-directory=%OUTDIR%", "%DOC%" ] }, { "name": "latexmk", "command": "latexmk", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdf", "-outdir=%OUTDIR%", "%DOC%" ], } ]
Note: we can choose a compiler to compile our files by
LaTex Workshop: Build with recipe