Editing Overleaf with VSCode

A guide to setting up VSCode as an Overleaf editor
Author

Cameron Barker

Published

May 16, 2025

Most academics will likely be familiar with Overleaf, the online LaTeX editor. However, it can be a bit clunky to use and is missing features such as code formatting. This guide will show you how to set up the following workflow:

Setup

Assuming you already have VSCode installed as well as an Overleaf account:

  1. Install VSCode extensions:

  2. Install tex-fmt:

    Requires Rust to be installed

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    cargo install tex-fmt

    Then enable the formatter in VSCode settings:

    1. Ctrl+Shift+P > Preferences: Open Settings (JSON):
    2. Add the following to your settings.json:
    "latex-workshop.formatting.latex": "tex-fmt"
  3. Install LaTeX distribution:

    I find that Tex Live works well on Linux and MikTeX works well on Windows. On Ubuntu:

    sudo apt install texlive-full

Usage

  1. Open VSCode, press Ctrl+Shift+P, enter Overleaf Workshop: Add New Server then enter https://www.overleaf.com.
  2. Press Ctrl+Shift+P, enter View: Show Overleaf Workshop, press the Login to Sever button then follow these instructions to login with cookies.
  3. In the Overleaf Workshop panel you should be able to see your projects. When you right click on a project one option is Open Project in Current Window, this remotely opens the project in your current window and uses the remote overleaf LaTeX compiler however the LTeX spelling and grammar extension currently does not work in this mode. Instead, select Open Project Locally ... and select Yes when prompted to make a local replica of the project. In this mode you are able to use the LTeX extension for spelling and grammar checking, use the tex-fmt with Ctrl+Shift+P and Format Document, and use the Latex Workshop extension to compile and preview the document. Changes are automatically synced to Overleaf and you are able to see collaborators changes in real time, as well as not having to deal with the clunky Overleaf git integration to work with Overleaf in an external editor.
  4. To format the document, press Ctrl+Shift+P, enter Format Document and select tex-fmt from the list. (Keyboard shortcut on Linux is Ctrl+Shift+I, on macOS is Cmd+Shift+I, on Windows is Ctrl+Shift+F).