Easy Setup of LaTeX in Visual Studio Code

If you’ve been struggling to set up LaTeX in Visual Studio Code (VSC), you’re not alone. Many guides online can be overwhelming or don’t quite fit your needs. If you simply want to open a folder in VSC and start writing LaTeX without any setup beforehand, there’s a straightforward solution that worked for me, and I’m here to share it with you.
What You’ll Need
- Visual Studio Code (VSC)
- MiKTeX
Step-by-Step Guide
1. Install Visual Studio Code
First things first, make sure you have Visual Studio Code installed on your system. If not, you can download and install it from the official website: Visual Studio Code
2. Install MiKTeX
MiKTeX is a popular distribution of LaTeX for Windows. It provides the necessary tools and packages to compile LaTeX documents. You can download and install MiKTeX from its official website: MiKTeX
3. Visual Studio Code Extensions
Once you have both Visual Studio Code and MiKTeX installed, open Visual Studio Code on your system. Navigate to the extension store and install:
Mandatory: Latex Workshop

Optional:
- Latex Utilities
- Citation Picker for Zotero
- LTeX — LanguageTool grammar/spell checking
4. Open Your LaTeX Folder
Navigate to the folder where you want to write your LaTeX documents. You can either open an existing LaTeX project or create a new folder for your LaTeX files.
Here’s a simple LaTeX “Hello World” document that you can use to get started. This document will create a PDF containing the phrase “Hello, World!” when compiled.
Create a new text file, name it hello_world.tex
, and insert the following content:
\documentclass[12pt]{article}
\begin{document}
Hello, World!
\end{document}
5. Compile Your LaTeX Document
To compile your LaTeX document into a PDF, you can use the built-in LaTeX Workshop extension in Visual Studio Code. If you don’t have it installed already, you can find it in the Extensions view (Ctrl+Shift+X) by searching for “LaTeX Workshop” and install it.
Once installed, you can use the shortcut Ctrl+Alt+B to compile your LaTeX document into a PDF. Alternatively, you can use the command palette (Ctrl+Shift+P) and search for “Build LaTeX project”.
6. “Perl” error

If you are now receiving the above error — fear not! Simpliy switch your default latex builder recipe from latexmk to pdflatex.
In Visual Studio Code (VSC), you can open extension settings as JSON by following these steps:
- Open Visual Studio Code.
- Click on the gear icon (⚙️) in the lower-left corner to open the Settings menu.
- In the Settings menu, you’ll see a search bar at the top. Type “Extensions” into the search bar.
- Look for the “Extensions” section in the search results and click on it.
- Scroll down until you find the extension for which you want to modify settings. Click on it.
- You’ll see a list of settings for that extension. Look for the “Edit in settings.json” link on the right side and click on it.
- This will open the
settings.json
file with the settings for the selected extension.
Now you can change the receipe the following:
"latex-workshop.latex.recipes": [
{
"name": "pdflatex ➞ bibtex ➞ pdflatex × 2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.recipe.default": "pdflatex ➞ bibtex ➞ pdflatex × 2",
Alternatively go to settings ( CMD+,) and search for latex-workshop recipes. There you can change the setting from “first” to “lastUsed” which allows you to still switch between the default receipes but remembers the lastUsed one.
Conclusion
Thats it. You should now have a working enviornment. Enjoy!