Personal Math Snippets
Personal Math Snippets is a VS Code extension for math-heavy writing in Markdown and LaTeX.
Instead of building a snippet system from scratch, this project consolidates and refines patterns that many users already rely on in existing math-snippet extensions, then adds:
- a unified experience across
Markdown and LaTeX
- math-context-aware triggering
- dynamic rules such as matrices, vectors, and indexed roots
- configurable rule groups that can be disabled or forced into automatic expansion
- an external rule layout that is easy to inspect and customize
Features
- Supports both automatic expansion and completion-based expansion
- Restricts math rules to math contexts
- Supports Markdown math wrappers such as
im, dm, mk, and dmk
- Includes symbols, operators, arrows, relations, delimiters, matrices, theorem-like environments, and probability/linear-algebra notation
- Lets you disable or promote entire built-in rule groups through settings
- Lets you open the built-in rule folder and the complete rule reference from the command palette
Typical Examples
im, dm: insert inline or display math wrappers
fr: insert \frac{...}{...}
@a: expand to \alpha
alpha: offer \alpha in the suggestion list
bmat4: generate a 4x4 matrix template
sq3: generate \sqrt[3]{...}
tt: generate \text{...}
sum, prod, int, oint: insert common large-operator templates
lra, llra: expand to long-arrow forms
NN, ZZ, PP, bbE: expand to common blackboard-bold sets and probability notation
argmax, rank, tr, Var: offer advanced operator-name expansions
ceil, angle, eval: offer paired-delimiter templates
grad, divg, curl: offer vector-calculus templates
what, wtilde, obr, ubr: offer advanced decoration templates
Scope
- In
Markdown, math rules only work inside math contexts; wrapper rules can be used in normal text.
- In
LaTeX, math rules only work inside math contexts; document, environment, and text-formatting rules work in normal text.
- Math wrappers
im, dm, mk, and dmk are available in both Markdown and LaTeX text contexts.
Commands
Personal Math Snippets: Reload Rules
Personal Math Snippets: Open Rule Reference
Personal Math Snippets: Open Rules Folder
After installation, run Personal Math Snippets: Open Rule Reference to view the complete built-in rule index shipped with the extension.
Settings
personalMathSnippets.disabledRuleGroups
personalMathSnippets.automaticRuleGroups
Both settings accept arrays of relative path prefixes under rules/.
Example:
{
"personalMathSnippets.disabledRuleGroups": [
"math/symbols",
"latex/environments",
"markdown/wrappers"
],
"personalMathSnippets.automaticRuleGroups": [
"math/direct-commands",
"math/analysis/operator-names"
]
}
Documentation
- User rule reference:
docs/rule-reference.md
- Development notes:
docs/development.md
Acknowledgements
This project was shaped by ideas, workflows, and snippet habits inspired by several existing extensions and snippet sets, especially:
HyperSnips by OrangeX4
Math Snippets by thomanq
- JeffersonQin's LaTeX snippet collection and related LaTeX snippet packs
Personal Math Snippets is an independent implementation, but it would not look the way it does without those prior tools and the communities around them.
| |