If you're an academic or a student who uses LaTeX within Visual Studio Code, you've likely benefited from the powerful "LaTeX Workshop" extension. It turns VSCode into a full-featured LaTeX IDE. However, you might have encountered a persistent warning message that says:
Please set your LaTeX formatter in latex-workshop.formatting.latex.
This message can be a bit cryptic if you're not sure where to look. Here’s a quick and straightforward guide to fixing it.
The Problem
The LaTeX Workshop extension provides the ability to automatically format your .tex files, but it doesn't come with a built-in formatter. You need to tell the extension which formatting tool you want it to use. The warning message is simply the extension's way of telling you that this crucial piece of configuration is missing.
The Solution: Configure Your settings.json
The fix is to specify a formatter in your VSCode settings.json file.
Open Settings (JSON):
- Open the Command Palette:
Cmd + Shift + P(macOS) orCtrl + Shift + P(Windows/Linux). - Type
"settings json"and select either Preferences: Open User Settings (JSON) to apply this setting globally, or Preferences: Open Workspace Settings (JSON) to apply it only to your current project.
- Open the Command Palette:
Add the Formatter Setting: Add the following line to your
settings.json. We'll uselatexindent, a popular and powerful Perl-based formatter.{ // Your other settings... "latex-workshop.latex.formatter": "latexindent" }
Install the Formatter Tool
Specifying the formatter is only half the battle. You also need to have the tool installed on your system. If you don't have latexindent installed, the extension won't be able to find it.
You can typically install it using your LaTeX distribution's package manager. For the widely-used TeX Live distribution, the command is:
tlmgr install latexindent
After installing the package and saving your settings.json file, the warning should disappear, and you can format your documents by right-clicking in your .tex file and selecting "Format Document".
Happy typesetting!