Digital Electronics 2 min read 12 views November 29, 2026

HOW SET UP latex files edit in vs code

To edit and compile LaTeX files in VS Code, you need two pieces: a LaTeX distribution (the compiler engine that turns .tex files into PDFs) and the LaTeX Workshop extension (which adds build buttons,...

ZI
Published November 29, 2026 · 0 Comments
On This Page · Jump to Section
FIG 1.0 — HOW SET UP latex files edit in vs code HARDWARE MODULE

To edit and compile LaTeX files in VS Code, you need two pieces: a LaTeX distribution (the compiler engine that turns .tex files into PDFs) and the LaTeX Workshop extension (which adds build buttons, autocomplete, error checking, and a built-in PDF viewer).

1.Install a LaTeX Distribution:Required before VS Code can build PDFs.

Download and install a TeX distribution for your operating system: TeX Live (Windows/Linux), MacTeX (macOS), or MiKTeX (Windows). On Windows with TeX Live, keep the option to adjust the system PATH checked.

Verification: Open a new terminal or Command Prompt and run pdflatex --version—it prints version details instead of a “command not found” error.

2.Install LaTeX Workshop in VS Code:2 min.

Open VS Code, press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS) to open Extensions, search for LaTeX Workshop, and click Install. Restart VS Code if prompted.

Verification: A TeX icon appears in the VS Code Activity Bar (left sidebar).

3.Create a Project Folder and Test File:

Create a dedicated folder for your project, open it in VS Code (File > Open Folder), and create a file named main.tex containing a minimal document (\documentclass{article}, \begin{document}, text, \end{document}).

Verification: main.tex shows syntax highlighting in the editor and appears inside the VS Code Explorer sidebar.

4.Build and Preview the PDF:

Save main.tex (Ctrl+S or Cmd+S), then compile by pressing Ctrl+Alt+B (Windows/Linux) or Cmd+Option+B (macOS), or click the green play/build icon in the top-right editor bar. Open the built-in PDF tab via the TeX sidebar or top-right preview icon.

Verification: A compiled main.pdf file is generated in your project folder and opens in the VS Code PDF viewer without errors in the LaTeX output log.

Useful Next Tweaks

  • Jump between code and PDF: Use Ctrl+Click (Windows/Linux) or Cmd+Click (macOS) inside the built-in PDF viewer to jump to that line in your .tex file.
  • Auto-build on save: By default, LaTeX Workshop builds on file save (latex-workshop.latex.autoBuild.run set to onFileChange). If you prefer Overleaf-style typing updates, enable Files: Auto Save in VS Code settings.

Leave a Reply

Your email address will not be published. Required fields are marked *