SEIFTeX
Swift Editing and Integration For .TeX: a VS Code extension for fast LaTeX math snippets, built-in Tectonic PDF compilation, and inline math conceal.
The Problem
Typing math in LaTeX means constantly writing out long commands like \frac, \partial, \begin{pmatrix}, and \mathbb{R}, which makes taking notes or doing homework in real time feel sluggish. On top of that, setting up a smooth LaTeX workflow in VS Code usually takes several separate extensions, a heavy TeX installation, and manual config wiring. SEIFTeX puts a curated set of math snippets, a working Tectonic compiler, and inline symbol rendering together in one place.
How It Works
SEIFTeX ties together three pieces when you open a .tex file:
- Snippets (
snippets/source/ -> snippets/latex.hsnips): The snippets are split into 13 small files and combined at build time by scripts/build-snippets.mjs. When the extension activates, it copies latex.hsnips into VS Code's extension storage and offers to point HyperSnips (hsnips.hsnipsPath) there without touching any workspace override you already have.
- Tectonic Compiler (
src/compiler.ts): Pressing Ctrl+Alt+B (Cmd+Alt+B on macOS) or clicking the status bar button saves your .tex file, finds Tectonic (checking seiftex.compilerPath, then the bundled Windows x64 tectonic.exe, then your system PATH), and compiles into a .texbuild/ folder. Any errors show up in VS Code's Problems tab and the SEIFTeX Compiler output panel, and a successful build gives you buttons to open the PDF or reveal its folder.
- Math Conceal (
src/extension.ts): Uses dragoemon.latex-conceal to render LaTeX symbols cleanly in the editor, with SEIFTeX: Toggle LaTeX Conceal keeping seiftex.conceal.enable and latex-conceal.enable in sync.
How the Final Build Changed from the Flowchart
- Instead of relying on LaTeX Workshop for compiling and previewing, SEIFTeX runs Tectonic directly and opens the finished PDF through VS Code (
Open PDF / Show in Folder).
- Instead of building a custom newline Unicode replacer from scratch, SEIFTeX integrates
dragoemon.latex-conceal and adds a toggle command for it.
- Instead of Python, the dynamic snippets (matrices, mixed partials, multi-integrals, Greek terminators) use JavaScript inside HyperSnips (
snippets/source/globals.hsnips) and are checked with Node.js.
Tech Stack
- TypeScript (
src/) and Node.js ESM scripts (scripts/)
- VS Code Extension API (
engines.vscode: ^1.144.0)
- HyperSnips (
draivin.hsnips) and LaTeX Conceal (dragoemon.latex-conceal)
- Heavily reccomended you also install TeX Side Preview (
hemantbanke.tex-side-preview) for side viewing of LaTeX
- Tectonic (bundled
bin/win32-x64/tectonic.exe on Windows x64; system tectonic or seiftex.compilerPath on macOS/Linux)
tsc and ESLint (typescript-eslint) for compilation and linting
- VS Code
globalStorageUri (stores the active latex.hsnips copy) and globalState (remembers prompt dismissal)
Setup
What You Need
- Node.js (v20+) and
npm
- Visual Studio Code (
>= 1.144.0)
- On Windows x64, Tectonic is already bundled in
bin/win32-x64/tectonic.exe. On macOS or Linux, install Tectonic on your PATH (or set seiftex.compilerPath in Settings).
Download
All that is required for SEIFTeX to work is:
- That you download the extension into your Visual Studio Code workspace,
- Click
Ctrl+Shift+p, search and run SEIFTeX: Set Up HyperSnips Snippets to install the snippets onto your machine.
- Enjoy fast clean LaTeX using SEIFTeX!
Any document ending in
.tex will automatically initiate SEIFTeX.
Tip: Tabbing Between Snippet Placeholders
VS Code's autocomplete menu can sometimes steal Tab while you're jumping through snippet placeholders. To make Tab and Shift+Tab jump placeholders first in LaTeX files, open Preferences: Open Keyboard Shortcuts (JSON) and add:
[
{
"key": "tab",
"command": "jumpToNextSnippetPlaceholder",
"when": "editorTextFocus && editorLangId == latex && inSnippetMode && hasNextTabstop"
},
{
"key": "shift+tab",
"command": "jumpToPrevSnippetPlaceholder",
"when": "editorTextFocus && editorLangId == latex && inSnippetMode && hasPrevTabstop"
}
]
In a .tex file, typing these triggers inside document expands on the fly:
m$ expands into \[ ... \]
;a = dint + Tab expands into \alpha{} = \int_{$1}^{$2} $3 \,\mathrm{d}x
(x^2 + 1)// turns into \frac{x^{2} + 1}{$1}
2imat generates a 2x2 identity matrix
Example .tex file:
\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
\[
\alpha{} = \int_{0}^{\infty} \frac{x^{2} + 1}{e^{x}} \,\mathrm{d}x, \qquad
I_{2} = \begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}
\]
\end{document}
Running Ctrl+Alt+B (SEIFTeX: Compile LaTeX) generates .texbuild/<filename>.pdf (plus .synctex.gz and compiler logs) and pops up Open PDF and Show in Folder buttons. If there's a LaTeX error, the SEIFTeX Compiler output opens and the line is underlined in Problems.
Commands & Settings
| Command |
Title |
Shortcut |
seiftex.compile |
SEIFTeX: Compile LaTeX |
Ctrl+Alt+B / Cmd+Alt+B |
seiftex.setupSnippets |
SEIFTeX: Set Up HyperSnips Snippets |
- |
seiftex.toggleConceal |
SEIFTeX: Toggle LaTeX Conceal |
- |
| Setting |
Type |
Default |
Description |
seiftex.compilerPath |
string |
"" |
Custom path to tectonic. Leave blank to use the bundled Windows x64 binary or system PATH. |
seiftex.conceal.enable |
boolean |
true |
Turns LaTeX math conceal on or off through dragoemon.latex-conceal. |
Snippets Reference
There are 66 snippets across 12 topic modules. Auto snippets expand as soon as you type them inside math mode (ignoring comments and \text{...}), while Tab snippets expand when you press Tab at a word boundary.
Math Modes & Environments
| Trigger |
Mode |
Context |
Expansion |
m$ |
Auto |
Prose |
\[ ... \] display math block |
$$ |
Auto |
Prose |
$ ... $ inline math |
bgn |
Tab |
Non-comment |
\begin{aligned} ... \end{aligned} (editable name) |
Basic Math
| Trigger |
Mode |
Expansion |
sr |
Auto |
\sqrt{$1} |
nr |
Auto |
\sqrt[n]{$2} |
abs |
Auto |
\left\lvert $1 \right\rvert |
nn |
Auto |
\left\lVert $1 \right\rVert |
^ |
Auto |
^{$1} |
_ |
Auto |
_{$1} |
Fractions
| Trigger |
Mode |
Example |
Expansion |
ff |
Auto |
ff |
\frac{$1}{$2} |
<atom>// |
Auto |
x//, 12//, \alpha{}//, x_{i}^{2}// |
\frac{<atom>}{$1} |
(<expr>)// |
Auto |
(x+y)// |
\frac{<expr>}{$1} (no nested parens) |
Derivatives
| Trigger |
Mode |
Example |
Expansion |
pd |
Tab |
pd |
\frac{\partial $1}{\partial x} |
dv |
Tab |
dv |
\frac{\mathrm{d} $1}{\mathrm{d} x} |
<n>pd / <n>dv |
Auto |
2pd, 3dv |
\frac{\partial^{n} $1}{\partial x^{n}} / \frac{\mathrm{d}^{n} $1}{\mathrm{d} x^{n}} (n = 2..9) |
pd[o1]<v1>[o2]<v2> |
Auto |
pdxy, pd2x3y, pdxx |
Mixed or combined higher-order partial derivative |
Calculus & Series
| Trigger |
Mode |
Example |
Expansion |
int, dint, oint |
Tab |
dint |
\int_{$1}^{$2} $3 \,\mathrm{d}x (indefinite / definite / contour) |
<n>int / <n>oint |
Auto |
2int, 3int, 2oint |
\iint, \iiint, \oiint, \oiiint (n = 2 or 3) |
sum, prod |
Tab |
sum |
\sum_{i=1}^{n}, \prod_{i=1}^{n} |
sum<v>=, prod<v>= |
Auto |
sumi=, prodj= |
\sum_{i=$1}^{$2}, \prod_{j=$1}^{$2} |
sum<v>0, sum<v>1, prod<v>0, prod<v>1 |
Auto |
sumi0, prodk1 |
\sum_{i=0}^{$1}, \prod_{k=1}^{$1} |
lim |
Tab |
lim |
\lim_{x \to \infty} |
lim<v>to |
Auto |
limxto, limnto |
\lim_{x \to $1} |
oo |
Auto |
oo |
\infty |
Vectors
| Trigger |
Mode |
Example |
Expansion |
vv, VV |
Auto |
vv, VV |
\vec{$1}, \hat{$1} |
<atom>vec, <atom>VEC |
Auto |
xvec, xVEC, \alpha{}vec |
\vec{<atom>}, \hat{<atom>} |
dotp, crossp |
Tab |
dotp |
$1 \cdot $2, $1 \times $2 |
grad, divg, curl, lapl |
Tab |
lapl |
\nabla, \nabla \cdot, \nabla \times, \nabla^{2} |
Matrices
| Trigger |
Mode |
Example |
Expansion |
mat2, mat3 |
Tab |
mat2 |
Editable 2x2 or 3x3 pmatrix with tabstops |
<r>x<c>mat, <r>x<c>bmat |
Auto |
2x3mat, 2x3bmat |
r x c pmatrix or bmatrix filled with \square (1..6) |
<n>imat |
Auto |
3imat |
n x n identity pmatrix (1..6) |
Greek Letters
| Trigger |
Mode |
Example |
Expansion |
;<letter> |
Auto |
;a, ;q, ;o |
Lowercase Greek (\alpha{}, \theta{}, o, ...) |
:<LETTER> |
Auto |
:G, :D, :A |
Uppercase Greek (\Gamma{}, \Delta{}, A, ...) |
Keys: a–z except j and v (q -> theta, h -> eta, f -> phi, c -> chi, y -> psi, w -> omega; letters that match Latin glyphs like o, A, and R stay literal).
Logic, Arrows & Relations
| Trigger |
Mode |
Expansion |
implies, iff, forall, exists, land, lor, neg |
Tab |
\implies{}, \iff{}, \forall, \exists, \land{}, \lor{}, \neg |
!=, <=, >=, ~=, === |
Auto |
\neq, \leq, \geq, \approx, \equiv |
->, =>, \|->, <->, <-- |
Auto |
\to, \implies, \mapsto, \leftrightarrow, \leftarrow |
<=> |
Auto / Tab |
\iff |
approx |
Tab |
\approx |
Sets & Number Systems
| Trigger |
Mode |
Example |
Expansion |
RR, NN, ZZ, QQ, CC, EE, PP, FF |
Auto |
RR |
\mathbb{R} (and matching letter) |
inn, notin, eset |
Auto |
inn |
\in, \notin, \emptyset |
bcup<v>=, bcap<v>= |
Auto |
bcupi=, bcapi= |
\bigcup_{i=$1}^{$2}, \bigcap_{i=$1}^{$2} |
sub, supe, cup, cap, smin |
Tab |
sub |
\subseteq, \supseteq, \cup, \cap, \setminus |
Standard Math Functions
- Auto-backslashed (
Auto): arcsin, arccos, arctan, sin, cos, tan, csc, sec, cot, ln, log, exp, max, min, sup, inf, det, dim, ker, gcd, deg
- Limits & arg extrema (
Auto): limsup -> \limsup, liminf -> \liminf, argmax -> \operatorname{arg\,max}, argmin -> \operatorname{arg\,min}
Roadmap
Based on CS193/Eisenhower Matrix.pdf:
MVP (Do)
- [x] Set up TypeScript VS Code extension boilerplate
- [x] Integrate HyperSnips (
draivin.hsnips) and build modular .hsnips snippets
- [x] Compile
.tex files to PDF with Tectonic, including error diagnostics and cancellation
- [x] Replace the planned LaTeX Workshop PDF viewer with Tectonic + VS Code
Open PDF / Show in Folder
- [x] Write extension download, usage, and snippet documentation
Schedule
- [x] Expand the snippet library with dynamic helpers (written in HyperSnips JS + Node validation instead of Python)
- [x] Make snippet setup repeatable without overwriting existing user or workspace
hsnipsPath settings
- [x] Add inline math symbol concealment using
dragoemon.latex-conceal and SEIFTeX: Toggle LaTeX Conceal
- [ ] Add custom LaTeX auto-indentation and formatting rules
What's Next (Defer)
- [ ] IntelliSense autocomplete previews for snippets
- [ ] Symbolic math integration (e.g., SymPy)
- [ ] Document-level LaTeX boilerplate snippets outside math mode
- [ ] Dedicated settings and interactive snippet cheat-sheet view
Demo
Development
Edit snippets under snippets/source/ rather than editing snippets/latex.hsnips directly.
npm run build:snippets # Check JS/contexts/duplicates and rebuild snippets/latex.hsnips
npm run compile # Build snippets and compile TypeScript to out/
npm run lint # Run ESLint on src/ and scripts/
npm run pretest # Run compile, lint, and scripts/check-snippets.mjs
| |