Feature request: Add syntax highlighting for \begin{equation}, \begin{align}, and \[...\] in .qmd files
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- yaml
- Domain
- tooling
Research direction
Open quarto.tmLanguage.yaml and review the repository rules and block patterns around math_block. Add coverage for the listed LaTeX environments and [...] delimiters, then verify that equation, align, and display-delimited math receive the stated scopes in .qmd files.
Written by the indexing model from the issue text.
Description
Description
The Quarto VS Code extension's TextMate grammar currently only recognizes $...$ (inline) and $$...$$ (display) as math scopes in .qmd files. LaTeX math environments like \begin{equation}, \begin{align}, and \[...\] receive no math highlighting, even though they are valid and commonly used in Quarto documents — especially in math-heavy academic papers.
Current behaviour
In a .qmd file:
$x^2$→ highlighted as math ✅$$x^2$$→ highlighted as math ✅\begin{equation} x^2 \end{equation}→ no highlighting ❌\begin{align} x^2 \end{align}→ no highlighting ❌\[ x^2 \]→ no highlighting ❌
Proposed solution
Add begin/end rules to quarto.tmLanguage.yaml for LaTeX math environments, scoped as markup.math.block.quarto with meta.embedded.math.quarto content — identical to how $$ blocks are handled. The change is small (~20 lines of YAML):
math_environment:
name: markup.math.block.quarto
contentName: meta.embedded.math.quarto
begin: '(\\begin\{(equation|align|alignat|gather|multline|flalign|split|aligned|gathered|multlined)\*?\})'
beginCaptures:
'1':
name: keyword.control.import.math.begin.quarto
end: '(\\end\{\2\*?\})'
endCaptures:
'1':
name: keyword.control.import.math.end.quarto
patterns:
- {include: 'text.html.markdown.math#math'}
math_display_delim:
name: markup.math.block.quarto
contentName: meta.embedded.math.quarto
begin: '(\\\[)'
beginCaptures:
'1':
name: keyword.control.import.math.begin.quarto
end: '(\\\])'
endCaptures:
'1':
name: keyword.control.import.math.end.quarto
patterns:
- {include: 'text.html.markdown.math#math'}
These rules would be added to the repository section of the grammar and included in the block patterns before math_block.
Use case
I write computational statistics papers in Quarto using \begin{equation}, \begin{align}, and custom theorem environments. The lack of math highlighting for these standard LaTeX environments makes the editing experience significantly worse compared to pure .tex files, especially for equation-heavy documents. This is likely a common pain point for anyone using Quarto for academic writing.
Happy to submit a PR if that would be helpful.
- Dominant language
- TypeScript
- Stars
- 645
- Forks
- 62
- Avg merge
- 17h 42m
- Merged PRs (30d)
- 13
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from quarto-dev/quarto
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
quarto-dev/quarto#1099 ·
-
vscode
Difficulty 5/5 Over a week Newbie friendliness 42/100
quarto-dev/quarto#1130 ·
-
vscode
Difficulty 3/5 1-2 days Newbie friendliness 68/100
quarto-dev/quarto#1122 ·
-
bug vscode zotero
Difficulty 4/5 3-5 days Newbie friendliness 48/100
quarto-dev/quarto#1119 · 1 comment ·
-
Visual editor outline shows Code Cell entries; quarto.symbols.showCodeCellsInOutline has no effect Openvisual-editor
Difficulty 3/5 1-2 days Newbie friendliness 48/100
quarto-dev/quarto#1114 ·
All issues in quarto-dev/quarto
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
Difficulty 1/5 Under an hour Newbie friendliness 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/models.dev#7701 ·