Topic 5

Snippets

Snippets are useful when they remove repetition without hiding the structure of the document.

Start with high-frequency patterns

Create snippets only for patterns you type constantly:

  • theorem environments
  • aligned equation blocks
  • common figure or table shells
  • repeated document scaffolding

If a snippet is used once a month, it probably does not belong in the core set.

Start from the Command Palette and open the user snippet flow instead of creating random JSON files by hand.

VS Code Command Palette showing Snippets Configure User Snippets

Then search for the LaTeX snippet target so the snippet file is attached to the language you actually use for manuscript work.

VS Code snippet target search with latex typed in the filter box

If a LaTeX snippet file already exists, open that existing file instead of scattering duplicate snippet files across the system.

VS Code prompt showing latex.json as the existing LaTeX snippets file

Example snippet

If you need to inspect the files directly, the Windows example below shows the %APPDATA%\\Code\\User\\snippets folder where user snippets are stored.

Windows File Explorer showing the AppData Code User snippets path

Inside that folder, confirm that the LaTeX snippet file exists and is the file you plan to keep editing.

Windows File Explorer showing the latex snippet file inside the VS Code snippets folder

Once the file is open, keep the snippet set short and readable so future edits stay easy.

VS Code editor with latex.json open for snippet editing
{
  "align environment": {
    "prefix": "ali",
    "body": [
      "\\begin{align}",
      "  $1",
      "\\end{align}"
    ]
  }
}

Keep prefixes short but memorable.

Avoid oversized libraries

Large snippet files become their own maintenance burden. Start with a small set that you trust, then add entries only when repeated typing is clearly wasting time.

Before proceeding

Confirm that your snippets speed up common LaTeX patterns and that you still understand the structure they expand into.