Keybinding Note: This extension uses Emacs-style keybindings where Ctrl is used on all platforms (not Cmd on Mac), except where explicitly noted.

✅ LaTeX Navigation and Structure

Scimax VS Code provides comprehensive navigation, structure editing, and tooltips for LaTeX documents. These features mirror the org-mode heading navigation and structure editing commands, adapted for LaTeX section commands and environments.

✅ Overview

LaTeX support in Scimax VS Code includes:

  1. Document Outline - Hierarchical view of sections, environments, and labels

  2. Section Navigation - Move between sections at any level

  3. Structure Editing - Promote/demote, move, and manipulate sections

  4. Environment Commands - Select, change, wrap, and unwrap environments

  5. Hover Tooltips - Information about references, citations, packages, and commands

  6. Speed Commands - Single-key shortcuts at section start

  7. Folding - Collapse and expand sections and environments

  8. Go to Definition - Jump to labels, citations, commands, and included files

  9. Find References - Find all uses of a label or citation key

  10. Auto-Completion - Smart completions for labels, citations, environments, packages

  11. Multi-File Projects - Full support for projects using \input/\include

  12. ChkTeX Linting - Real-time warnings in Problems panel

  13. Error Navigation - Cycle through compilation errors

  14. Rename Symbol - Rename labels and update all references automatically

  15. Reference Validation - Warn about undefined and unused labels

  16. Inverse SyncTeX - Click in PDF to jump to source

  17. Document Formatting - Format with latexindent

  18. LaTeX-Aware Spell Checking - Skip commands and math in spell check

See also:

✅ Document Outline

The outline view (VS Code's built-in outline panel Cmd/C-Shift-o) shows the structure of your LaTeX document:

  • Sections (part, chapter, section, subsection, etc.)

  • Labeled Environments (figures, tables, equations with labels)

  • Labels for cross-referencing

The outline uses hierarchical nesting to show the document structure. Click any item to jump to it.

✅ Section Hierarchy

LaTeX sections are organized hierarchically:

LevelCommandSymbol Kind
0\partModule
1\chapterClass
2\sectionMethod
3\subsectionFunction
4\subsubsectionField
5\paragraphProperty
6\subparagraphProperty

Starred variants (e.g., \section*{...}) are also recognized and marked in the outline.

Section Navigation

Navigate between sections in your LaTeX document using these commands:

CommandKey BindingDescription
scimax.latex.nextSectionC-c C-nJump to next section
scimax.latex.previousSectionC-c C-pJump to previous section
scimax.latex.parentSectionC-c C-uJump to parent section
scimax.latex.nextSiblingSectionC-c C-fJump to next sibling section
scimax.latex.previousSiblingSectionC-c C-bJump to previous sibling section
scimax.latex.firstSection-Jump to first section in document
scimax.latex.lastSection-Jump to last section in document
scimax.latex.jumpToSectionC-c C-jQuick pick to jump to any section

✅ Next/Previous Section

Move through all sections in document order:

\section{Introduction}
Content here...

\subsection{Background}    % <- Current position

\subsection{Motivation}    % <- Next section

\section{Methods}          % <- Another next section

nextSection moves forward through sections regardless of level. previousSection moves backward.

✅ Sibling Navigation

Move between sections at the same level:

\section{Introduction}

\subsection{Background}    % <- Current position
\subsection{Motivation}    % <- Next sibling (same level)
\subsection{Goals}         % <- Another sibling

\section{Methods}          % <- NOT a sibling (different level)

nextSiblingSection moves to the next section at the same hierarchical level. previousSiblingSection moves backward.

✅ Parent Section

Jump to the containing (parent) section:

\section{Methods}            % <- Jump here (parent)
\subsection{Data Collection}
\subsubsection{Sampling}     % <- From here

Jump to Section

The jumpToSection command (C-c C-j) opens a quick pick showing all sections with:

  • Hierarchical indentation showing structure

  • Section type (\section, \subsection, etc.)

  • Line numbers

Type to filter, then select a section to jump to it.

✅ Structure Editing

Edit the document structure by promoting, demoting, and moving sections.

CommandKey BindingDescription
scimax.latex.promoteSectionAlt+LeftPromote section (e.g., sub→sec)
scimax.latex.demoteSectionAlt+RightDemote section (e.g., sec→sub)
scimax.latex.promoteSubtreeAlt+Shift+LeftPromote section and children
scimax.latex.demoteSubtreeAlt+Shift+RightDemote section and children
scimax.latex.moveSectionUpAlt+UpMove section above sibling
scimax.latex.moveSectionDownAlt+DownMove section below sibling
scimax.latex.markSectionC-c @Select entire section
scimax.latex.killSection-Delete section (copy to clip)
scimax.latex.cloneSection-Duplicate section
scimax.latex.insertSection-Insert new section at same level
scimax.latex.insertSubsection-Insert subsection

✅ Promote/Demote

Change the level of a section command:

% Before promote:
\subsection{Methods}

% After promote (Alt+Left):
\section{Methods}

% Before demote:
\section{Results}

% After demote (Alt+Right):
\subsection{Results}

✅ Promote/Demote Subtree

Promote or demote a section and all its children:

% Before promoteSubtree on "Methods":
\subsection{Methods}
\subsubsection{Data}
\subsubsection{Analysis}

% After promoteSubtree (Alt+Shift+Left):
\section{Methods}
\subsection{Data}
\subsection{Analysis}

✅ Move Section Up/Down

Swap a section with its previous or next sibling:

% Before moveSectionDown on "Introduction":
\section{Introduction}
Content A...

\section{Methods}
Content B...

% After moveSectionDown (Alt+Down):
\section{Methods}
Content B...

\section{Introduction}
Content A...

The entire section subtree (including all nested content) is moved.

Environment Commands

Work with LaTeX environments (\begin{...} / \end{...}):

CommandKey BindingDescription
scimax.latex.selectEnvironmentC-c C-eSelect entire environment
scimax.latex.selectEnvironmentContent-Select content (not begin/end)
scimax.latex.changeEnvironmentC-c EChange environment type
scimax.latex.wrapInEnvironmentC-c wWrap selection in environment
scimax.latex.unwrapEnvironment-Remove begin/end, keep content
scimax.latex.deleteEnvironment-Delete entire environment
scimax.latex.toggleEnvironmentStarC-c *Toggle starred variant
scimax.latex.addLabelC-c C-lAdd \label to environment
scimax.latex.addCaption-Add \caption to figure/table
scimax.latex.jumpToMatchingEnvironmentC-c %Jump between \begin and \end

✅ Environment Navigation

Navigate between environments:

CommandKey BindingDescription
scimax.latex.nextEnvironment-Jump to next environment
scimax.latex.previousEnvironment-Jump to previous environment
scimax.latex.jumpToEnvironment-Quick pick all environments

Change Environment

The changeEnvironment command (C-c E) prompts to change the environment type:

% Before:
\begin{equation}
  E = mc^2
\end{equation}

% After changing to "align":
\begin{align}
  E = mc^2
\end{align}

Both \begin and \end are updated simultaneously.

✅ Wrap in Environment

Select text and use wrapInEnvironment (C-c w) to surround it:

% Before (with "E = mc^2" selected):
E = mc^2

% After wrapping in "equation":
\begin{equation}
  E = mc^2
\end{equation}

✅ Toggle Star

Toggle the starred variant of an environment:

% Before:
\begin{equation}
  E = mc^2
\end{equation}

% After toggleEnvironmentStar (C-c *):
\begin{equation*}
  E = mc^2
\end{equation*}

✅ Hover Tooltips

Hover over LaTeX elements to see helpful information:

ElementInformation Shown
\ref{label}What the label refers to, line number
\cite{key}Citation keys (bib integration planned)
\label{name}Where label is referenced, context
\usepackage{pkg}Package description
\begin{env}Environment description
\section{...}Section hierarchy path
\alpha, \beta, etc.Unicode symbol and description
\textbf, etc.Command description
\input{file}File path, size, preview

✅ Reference Hover

Hovering over \ref{fig:example} shows:

  • The label name

  • Line number where label is defined

  • Context (section or environment containing the label)

  • Preview of the labeled line

✅ Citation Hover

Hovering over \cite{key} shows rich BibTeX information:

  • Full title

  • Authors with proper formatting

  • Year

  • Journal or book title

  • Volume, number, pages

  • DOI (as clickable link)

  • Abstract preview

Supports all natbib and biblatex citation commands:

  • \cite, \citep, \citet

  • \citealt, \citealp

  • \citeauthor, \citeyear

  • \nocite

✅ Package Hover

Hovering over \usepackage{amsmath} shows:

  • Package name

  • Description of what the package provides

✅ Math Symbol Hover

Hovering over math commands like \alpha shows:

  • Unicode representation: α

  • Unicode code point: U+03B1

  • Description: Greek lowercase alpha

✅ Speed Commands

At the beginning of a section line, single keys trigger commands:

KeyActionKeyAction
nNext section<Promote section
pPrevious section>Demote section
fNext siblingUMove section up
bPrevious siblingDMove section down
uParent sectionmMark section
jJump to sectionkKill section
JJump to labelcClone section
gFirst sectioniInsert section
GLast sectionIInsert subsection
TabToggle foldNNarrow to section
S-TabCycle global foldWWiden
?Show speed commands

Speed commands only activate when cursor is at or before the backslash of a section command.

✅ Using Speed Commands

  1. Place cursor at the start of a section line (column 0 or before \)

  2. Press a single key

  3. The corresponding action executes

Example:

\section{Introduction}   % <- Place cursor here, press 'n' to go to next section
  ^
  |__ Cursor position

✅ Folding

LaTeX documents support folding for sections and environments.

CommandKey BindingDescription
scimax.org.toggleFoldTabToggle fold at cursor
scimax.org.cycleGlobalFoldShift+TabCycle all folds

✅ Section Folding

Sections fold from the section command to the next section at the same or higher level:

\section{Introduction}...  % <- Folds from here
Content...
\subsection{Background}    % <- Included in fold
More content...
\section{Methods}          % <- Fold ends before this

✅ Environment Folding

Environments fold from \begin to \end:

\begin{figure}...          % <- Folds from here
  \includegraphics{...}
  \caption{...}
\end{figure}               % <- Fold ends here

✅ Global Fold Cycling

Shift+Tab cycles through three states:

  1. OVERVIEW - All sections folded

  2. CONTENTS - Top-level sections visible

  3. SHOWALL - Everything expanded

✅ Label Navigation

Navigate to labels in your document:

CommandKey BindingDescription
scimax.latex.jumpToLabelC-c lQuick pick all labels

The quick pick shows:

  • Label name

  • Context (section or environment)

  • Line number

✅ Compile and Preview

Compile LaTeX documents and view the generated PDF.

CommandKey BindingDescription
scimax.latex.compileC-c C-cCompile the document
scimax.latex.viewPdfC-c C-vView PDF (external viewer)
scimax.latex.viewPdfPanelC-c vView PDF (built-in panel)
scimax.latex.compileAndViewC-c C-aCompile and view PDF
scimax.latex.cleanC-c C-kClean auxiliary files
scimax.latex.syncTexForwardC-c gSyncTeX forward search
scimax.latex.wordCount-Count words (approximate)
scimax.latex.selectBuildProfile-Choose the build profile
scimax.latex.showBuildProfile-Show the active build profile

✅ Compilation

The compile command runs the configured LaTeX compiler (default: pdflatex):

  1. Saves the document

  2. Compiles with -interaction=nonstopmode for error handling

  3. Shows compilation errors with line numbers

  4. Outputs detailed log to the "LaTeX" output channel

Configure the compiler via scimax.latex.compiler setting:

  • pdflatex (default)

  • xelatex

  • lualatex

  • latexmk

Build Profiles for TeX Files

A single compiler run is not enough when the document needs BibTeX or Biber. Build profiles define a named sequence of commands (for example pdflatex → bibtex → pdflatex → pdflatex), and scimax.latex.compile uses one automatically when the file names it:

% !SCIMAX build = pdflatex-bibtex
\documentclass{article}

Pick one interactively with Scimax LaTeX: Select Build Profile (scimax.latex.selectBuildProfile), which inserts that magic comment for you, and check the active one with Scimax LaTeX: Show Build Profile.

When a profile applies:

  • Each step is reported in the progress notification, and the notification's cancel button stops the build.

  • All step output goes to the "LaTeX" output channel, and errors are still parsed for Go to Error / Next Error.

  • The build is judged successful by whether a PDF was produced, since LaTeX exits non-zero on mere warnings.

Without a profile, compilation falls back to the scimax.latex.compiler setting described above. Profiles apply to every compile entry point: C-c C-c, C-c C-a (compile and view), and the PDF panel.

Profiles are shared with org export - the same latex-profiles.json files and scimax.export.pdf.profiles setting supply them. See Build Profiles for the profile file format, substitution tokens, step options, and the built-in profiles.

✅ SyncTeX Support

SyncTeX allows jumping between source and PDF positions.

Forward search (C-c g): Jump from cursor position in source to corresponding PDF location.

Supported PDF viewers:

  • macOS: Skim (recommended)

  • Linux: Zathura

  • Windows: SumatraPDF

Configure via scimax.latex.pdfViewer setting.

✅ Built-in PDF Viewer Panel

For an Overleaf-like experience, use the built-in PDF viewer panel (C-c v):

  • Opens PDF in a VS Code panel beside your source

  • Auto-refreshes when you recompile

  • Zoom controls (+, -, Fit)

  • Page navigation

  • Bidirectional sync with text-based highlighting

  • No external PDF viewer required

This is ideal for side-by-side editing without leaving VS Code.

Viewer OptionKeyDescription
Built-in panelC-c vPDF in VS Code panel (Overleaf-like)
External viewerC-c C-vOpens in Skim/Zathura/SumatraPDF

✅ Bidirectional Sync

The built-in PDF viewer supports precise bidirectional synchronization:

Forward sync (TeX → PDF):

  • Double-click a word in your LaTeX source to jump to that location in the PDF

  • Or use C-c C-s to sync the current cursor position to the PDF

  • The word is highlighted with a yellow flash

Inverse sync (PDF → TeX): Double-click a word in the PDF viewer to jump to the corresponding line in your LaTeX source.

KeyAction
C-c C-sSync cursor position to PDF panel
C-c gSyncTeX forward to external viewer

The forward sync uses SyncTeX coordinates combined with text-layer search to find the exact word you clicked, even if SyncTeX coordinates are imprecise.

✅ Debug Popup Setting

To see SyncTeX coordinates and debug information when syncing:

{
  "scimax.latex.showSyncDebugPopup": true
}

Default is false. When enabled, shows a popup with page, coordinates, source line/column, and search text for troubleshooting sync issues.

✅ Auto-Compile on Save

When the PDF panel is open, saving a LaTeX file automatically recompiles and refreshes the PDF. This provides an Overleaf-like live preview experience.

To disable auto-compile on save:

{
  "scimax.latex.autoCompileOnSave": false
}

Default is true.

✅ Insert Commands

Quick insertion of common LaTeX elements:

CommandDescription
scimax.latex.insertFigureInsert figure environment snippet
scimax.latex.insertTableInsert table with booktabs snippet
scimax.latex.insertEquationInsert equation environment

These commands insert snippets with tab stops for easy navigation.

✅ Go to Definition

Jump to the definition of labels, citations, commands, and files:

TriggerWhat it does
\ref{label}Jump to the \label{label} definition
\cite{key}Jump to the BibTeX entry in the .bib file
\input{file}Open the included file
\mycommandJump to \newcommand or \def definition

Use F12 or Ctrl+Click (standard VS Code "Go to Definition").

Supports cross-file navigation in multi-file projects.

✅ Find All References

Find all usages of a label or citation:

Position onShows all
\label{name}All \ref{name} references
\cite{key}All citations of that key

Use Shift+F12 or right-click → "Find All References".

Works across all files in the project.

✅ Auto-Completion

Smart completions trigger as you type:

ContextCompletions
\ref{All labels in project with context
\cite{All BibTeX keys with author/year/title
\begin{Common environments (equation, figure, etc.)
\usepackage{Common packages with descriptions
\includegraphics{Image files (.png, .jpg, .pdf, etc.)
\input{.tex files in directory

Completions show:

  • Label completions include file name and line context

  • Citation completions show author, year, and title

  • Environment completions include descriptions

  • Package completions describe what each package provides

✅ Multi-File Project Support

Projects with multiple files (using \input or \include) are fully supported:

  • Master document detection: Automatically finds the main .tex file

  • Cross-file labels: Complete and navigate labels defined in any project file

  • Shared bibliography: Finds .bib files referenced anywhere in project

  • Project-wide search: Find References searches all included files

The master document is detected by looking for \documentclass.

✅ Project Structure

thesis/
├── main.tex              # Master document (has \documentclass)
│   └── \input{chapters/intro}
│   └── \input{chapters/methods}
│   └── \bibliography{refs}
├── chapters/
│   ├── intro.tex        # \label{sec:intro} defined here
│   └── methods.tex      # \ref{sec:intro} works here too
└── refs.bib              # Bibliography

✅ ChkTeX Linting

Real-time linting with ChkTeX catches common LaTeX issues:

  • Missing or extra braces

  • Spacing issues

  • Style recommendations

Errors appear in the Problems panel and as squiggles in the editor.

✅ Configuration

{
  "scimax.latex.enableChktex": true  // Enable/disable linting (default: true)
}

Requires chktex to be installed:

  • macOS: brew install chktex

  • Linux: apt install chktex

  • Windows: Included with MiKTeX/TeX Live

✅ Error Navigation

Navigate through compilation errors:

CommandKey BindingDescription
scimax.latex.nextErrorC-c `Jump to next error
scimax.latex.previousErrorC-c Shift+`Jump to previous error
scimax.latex.showErrorsC-c C-eShow all errors in quick pick

Errors are collected after compilation and persist until the next build.

✅ Error Display

When compilation fails:

  1. First error is shown in a notification with "Go to Error" button

  2. The Problems panel shows all parsed errors

  3. Use navigation commands to cycle through errors

Errors include:

  • File path (supports multi-file projects)

  • Line number

  • Error message

✅ Hover Previews

Hover over LaTeX elements to see previews and information.

✅ Equation Preview

Hover over any math expression to see a rendered preview:

  • Inline math: $E=mc^2$, \(E=mc^2\)

  • Display math: $$...$$$, \[...\]

  • Environments: equation, align, gather, etc.

The preview:

  • Renders using the system LaTeX installation

  • Respects document preamble (packages, custom commands)

  • Adapts to dark/light VS Code theme

  • Shows the source LaTeX below the preview

Note: Requires a LaTeX installation (TeX Live, MiKTeX, or MacTeX).

✅ Figure Preview

Hover over \includegraphics{...} to see:

  • Image preview (PNG, JPG, SVG, GIF, WebP)

  • File path and size

  • Last modified date

PDF and EPS files show file information without preview.

✅ Rename Symbol

Rename a label and automatically update all references across the project:

  1. Place cursor on a \label{name} or \ref{name}

  2. Press F2 or right-click → "Rename Symbol"

  3. Enter the new name

  4. All \label{} and \ref{} commands using that name are updated

Works across all files in multi-file projects.

✅ Supported Reference Commands

Rename works with all reference variants:

  • \label{...} - the definition

  • \ref{...}, \eqref{...}, \pageref{...}

  • \autoref{...}, \cref{...}, \Cref{...}

✅ Reference Validation

Automatic validation of label references:

IssueSeverityDescription
Undefined referenceError\ref{name} but no \label{name}
Unused labelWarning\label{name} with no \ref{name}

Diagnostics appear in the Problems panel and as squiggles in the editor.

✅ Configuration

{
  "scimax.latex.validateReferences": true  // Enable/disable (default: true)
}

✅ Inverse SyncTeX

Click in PDF to jump back to the corresponding source location.

✅ Setup

Run the command Scimax LaTeX: Show Inverse SyncTeX Command to get the configuration command for your PDF viewer.

PDF ViewerConfiguration
SkimPreferences → Sync → Preset: Custom; Command: code
SumatraPDFSettings → Options → Set inverse search command
ZathuraSet synctex-editor-command in config

✅ URI Handler

The extension also registers a URI handler for vscode:// URLs:

vscode://file/path/to/file.tex:42

This allows PDF viewers to communicate directly with VS Code.

✅ Document Formatting

Format LaTeX documents using latexindent:

CommandKey BindingDescription
scimax.latex.formatC-c C-qFormat entire document

✅ Format on Save

Enable automatic formatting when saving:

{
  "scimax.latex.formatOnSave": true,          // Auto-format on save
  "scimax.latex.latexindentPath": "latexindent"  // Path to latexindent
}

✅ Requirements

latexindent must be installed:

  • macOS: Included with MacTeX, or brew install latexindent

  • Linux: apt install texlive-extra-utils or cpanm YAML::Tiny File::HomeDir Unicode::GCString

  • Windows: Included with MiKTeX/TeX Live

✅ Customization

Create a .latexindent.yaml file in your project to customize formatting rules. See the latexindent documentation for options.

✅ LaTeX-Aware Spell Checking

The extension provides infrastructure for LaTeX-aware spell checking that skips commands, math, and comments.

✅ Regions Excluded from Spell Check

PatternExample
Commands with arguments\textbf{word}
Inline math$x^2 + y^2$
Display math$$..$$ and \[..\]
Environments\begin{...}...\end{...}
Comments% comment text

✅ User Dictionary

Add words to your personal dictionary:

CommandDescription
scimax.latex.addToDictionaryAdd word at cursor to dictionary

The dictionary is stored per-workspace and persists across sessions.