text editor vsc - joaomlourenco/novathesis GitHub Wiki
Visual Studio Code for LaTeX
Visual Studio Code (VS Code) is now a premier environment for LaTeX, offering a "what you see is what you get" experience through integrated side-by-side editing, automated building, and a high-performance internal PDF viewer.
The gold standard for this workflow is the LaTeX Workshop extension.
Requirements (Updated 2026)
Before configuring VS Code, you must have a LaTeX engine installed on your OS.
-
LaTeX Distribution: Ensure a distribution is in your system
PATH. -
TeX Live: (Recommended for Linux/Windows) The most comprehensive and stable.
-
MiKTeX: (Recommended for Windows/macOS) Features a convenient "install-on-the-fly" package manager.
-
MacTeX: The standard for macOS users.
-
Perl: Essential if you use
latexmk(the default build tool for the extension). -
Note: On Windows, MiKTeX users often forget this; install Strawberry Perl or use the version bundled with Git for Windows.
-
VS Code Extension: Install LaTeX Workshop from the Marketplace.
Getting Started
1. The TeX Sidebar
Once the extension is installed, a TeX icon (usually a stylized 'A') appears in the Activity Bar. This is your command center for:
- Commands: Building, cleaning auxiliary files, and syncing PDF to source.
- Structure: Navigating your document via sections, figures, and tables.
- Snippets: Quick access to math symbols and environments.
2. Building your Document
The extension defaults to "Build on Save." Simply press Ctrl+S (or Cmd+S), and the extension will automatically run the necessary tools (pdflatex, bibtex, etc.) to generate your PDF.
3. Integrated Preview
You no longer need an external PDF reader like Adobe or Sumatra.
- To View: Click the "View LaTeX PDF" icon in the top-right editor bar.
- SyncTeX: Use
Ctrl+Clickin the PDF to jump to the corresponding line in the code, orAlt+Jin the code to find that spot in the PDF.
Advanced Usage & Tips
| Feature | Description |
|---|---|
| Intellisense | Start typing \cite{ or \ref{ to see a dropdown of your bibliography keys or labels. |
| Math Preview | Hover over a LaTeX math environment to see a live render of the equation in a tooltip. |
| Linting | Use chktex (usually included in your LaTeX distribution) to catch common formatting errors in real-time. |
Modern Spell Check & Grammar
Standard VS Code still lacks a native LaTeX-aware spell checker. For a professional setup, use:
- Code Spell Checker: Great for basic typos. It ignores LaTeX commands so it won't flag
\sectionas an error. - LTeX: (Highly Recommended) This provides Grammarly-style checks using LanguageTool. It understands LaTeX syntax and checks for grammar, style, and spelling across multiple languages.
Pro Tip: If your project is large, create a
.vscode/settings.jsonfile in your folder to define specific build recipes (like usingXeLaTeXorLuaLaTeX) that are unique to that project.