Skip to content

Support Latex in VSCode on macOS

Install BasicTeX

BasicTeX is a much smaller alternate TeX Distribution for users who do not want to download the full TeX Live, or have unreliable internet connections.

It contains all of the standard tools needed to write TeX documents, including TeX, LaTeX, pdfTeX, MetaFont, dvips, MetaPost, and XeTeX.

BasicTeX only contains the TeX Live piece of the full distribution; it does not contain GUI programs or Ghostscript. To use TeX on the Mac, it suffices to install BasicTeX and a front end.

shell
$ brew install --cask basictex
$ which pdflatex
/Library/TeX/texbin/pdflatex

Add path to your ~/.bash_profile file.

shell
export PATH="/Library/TeX/texbin:$PATH"

Download Packages

  1. Update the TeX Live Manager
shell
$ sudo tlmgr update --self
  1. Update all packages already installed by BasicTex
shell
$ sudo tlmgr update --all
  1. Install other necessary packages
shell
$ sudo tlmgr install latexmk latexindent synctex chktex

Install LaTeX Workshop VSCode Plugin

LaTeX Workshop is an extension for Visual Studio Code, aiming to provide core features for LaTeX typesetting with Visual Studio Code.

latex-workshop.png

  1. Open the .tex file in the VSCode (make sure PATH environment variable has changed) .
  2. Build (Cmd + Option + B, by default).
  3. View the result (Cmd + Option + V, by default)

References