Skip to content

Install

David Fiedler edited this page Dec 11, 2023 · 47 revisions

Installation and basic settings

Requirements

The only requirement is a compatible LaTeX distribution in the system PATH. For example, TeX Live. We strongly recommend TeX Live. Other possible choices are:

  • TinyTeX as a lighter-weight distribution based on TeX Live.

    The TinyTeX distributions contain only a small subset of the 4000+ packages downloaded by TeX Live. Additional packages can be installed with tlmgr install <pkgname>.

    Note that TinyTeX does not include offline documentation. LaTeX Workshop's "Show package documentation" functionality will therefore not work. (You can instead use the CTAN link, also provided in the hover popup, to download the docs).

  • MiKTeX is another lightweight distribution with a convenient automatic on-demand package install. Note, however, that for MiKTeX to work correctly with Latex Workshop, you need to install Perl.

    MiKTeX does not ship with Perl. Without Perl, latexmk fails with errors. latexmk is required for the default recipe for building LaTeX projects to work. Alternatively, you can set up your own LaTeX recipe.

Other useful tools:

  • Optional: ChkTeX to lint LaTeX projects.
  • Optional: latexindent.pl for formatting support if it is not provided by your LaTeX distribution. You also have to install a few standard Perl modules. See the official document.

Installation

Installing LaTeX Workshop is simple. You can find it in Visual Studio Code Marketplace, or simply run ext install latex-workshop in VS Code Quick Open (ctrl/cmd + P). See an official document for the details.

Setting PATH environment variable

After installing TeX Live, you must add the directory of TeX Live binaries to your PATH environment variable except on Windows. See the official document. LaTeX Workshop never touches the variable. If VS Code cannot find executables of TeX, it means that the setting of your system is broken. For the ways of setting environment variables on Windows, see link or link. On macOS and Linux, see the documentation by the rbenv dev team. Very detailed information is also available on stackoverflow for macOS.

Notice that you have to restart VS Code and the operating system after changing the variable.

If you can not fix the setting of your system, you can also override PATH with the env property of LaTeX tools in LaTeX recipes.

Notice that, to set the PATH environment variable for VS Code Remote Development, you usually have to edit .bash_profile or .profile instead of .bashrc. See the document for WSL and an issue for Remote SSH.

If you want to know about environment variable itself, please read Wikipedia and stackexchange.

Settings

You can modify settings through the menu of VS Code, Preferences > Settings. You can also modify settings by directly editing settings.json. See an official document for the location of settings.json.

You can also have different settings for each project with .vscode/settings.json at the root of each project workspace. See an official document.

For language-specific editor settings, see an official document.

Usage

The typical usage is to open a .tex file and have a look at the TeX sidebar to access all the extension features. If you wish to use a keybinding to open the TeX sidebar, you just need to associate one with the command latex-workshop.actions.

If you prefer to access some of the most common actions through a right click menu, set latex-workshop.showContextMenu to true. Default is false.

Supported languages

In addtions to LaTeX, LaTeX-Expl3 is supported. LaTeX-Expl3 is a language identifier we tentatively use for the so-called "LaTeX3". With the LaTeX-Expl3 mode, syntax highlighting and intellisense for commands of expl3 are supported in addition to basic features for LaTeX. You can change the language mode from LaTeX to LaTeX-Expl3 clicking on the language indicator, LaTeX, of the satus bar and selecting LaTeX-Expl3 from the drop-down. See an official document.

Sweave, knitr, and Weave.jl are also supported. See Building a .rnw file and Building a .jnw file for the details.

Using Docker

VS Code supports Docker with Remote - Containers. LaTeX Workshop works well with the extension. You can see an example. We strongly recommend you to use the extension instead of our following experimental feature.

LaTeX Workshop has an experimental implementation on Docker support following the idea of @Arxisos. You can set latex-workshop.docker.enabled to true to use a docker based LaTeX distribution. The docker image to be used is defined by latex-workshop.docker.image.latex, the default value is empty. Please find an appropriate image by yourself and set the name to latex-workshop.docker.image.latex.

@Arxisos created snippets for LaTeX binaries in docker, and @lippertmarkus had another short description on how to use Docker with LaTeX Workshop. You can set up the advanced configuration of Docker through environment variables with the env property of each recipe.

With the experimental feature, compiling subfiles with the subfiles package does not work.

Using WSL

VS Code supports WSL through Remote - WSL. LaTeX Workshop works well with the extension.

Table of Contents

Clone this wiki locally