0
0
mirror of https://github.com/vim/vim.git synced 2025-10-16 07:24:23 -04:00

runtime(tex): add amsmath support to tex syntax script

Problem:  tex syntax file does not support some of the math equation
          environments provided by amsmath.sty, therefore well-formed
          snippet is highlighted as "texBadMath"
Solution: add the environments

closes: #18433

Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Eisuke Kawashima
2025-09-29 19:43:51 +00:00
committed by Christian Brabandt
parent b3740f4b00
commit 05e44e978f
3 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
>\+0#af5f00255#ffffff0|d|o|c|u|m|e|n|t|c|l|a|s@1|{+0#e000e06&|a|r|t|i|c|l|e|}| +0#0000000&@51
|\+0#af5f00255&|u|s|e|p|a|c|k|a|g|e|{+0#e000e06&|a|m|s|m|a|t|h|}| +0#0000000&@54
|\+0#e000e06&|b|e|g|i|n|{|d|o|c|u|m|e|n|t|}| +0#0000000&@58
|\+0#af5f00255&|b|e|g|i|n|{+0#e000e06&|a|l|i|g|n|}| +0#0000000&@61
| +0#e000e06&@7|\+0#af5f00255&|b|e|g|i|n|{+0#e000e06&|b|m|a|t|r|i|x|}| +0#0000000&@51
| +0#e000e06&@15|1| |&| |x| |&| |x|^|{|2+0#af5f00255&|}+0#e000e06&| |\@1| +0#0000000&@42
| +0#e000e06&@15|1| |&| |y| |&| |y|^|{|2+0#af5f00255&|}+0#e000e06&| |\@1| +0#0000000&@42
| +0#e000e06&@15|1| |&| |z| |&| |z|^|{|2+0#af5f00255&|}+0#e000e06&| |\@1| +0#0000000&@42
| +0#e000e06&@7|\+0#af5f00255&|e|n|d|{+0#e000e06&|b|m|a|t|r|i|x|}| +0#0000000&@53
|\+0#af5f00255&|e|n|d|{+0#e000e06&|a|l|i|g|n|}| +0#0000000&@63
|\+0#e000e06&|e|n|d|{|d|o|c|u|m|e|n|t|}| +0#0000000&@60
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
| +0#0000000&@56|1|,|1| @10|A|l@1|

View File

@@ -0,0 +1,11 @@
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\begin{bmatrix}
1 & x & x^{2} \\
1 & y & y^{2} \\
1 & z & z^{2} \\
\end{bmatrix}
\end{align}
\end{document}

View File

@@ -7,6 +7,7 @@
" 2025 Jan 18 by Vim Project: add texEmphStyle to texMatchGroup, #16228
" 2025 Feb 08 by Vim Project: improve macro option, \providecommand,
" \newcommand and \newenvironment #16543
" 2025 Sep 29 by Vim Project: add amsmath support #18433
" Version: 121
" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
@@ -443,7 +444,7 @@ endif
" Bad Math (mismatched): {{{1
if !exists("g:tex_no_math") && !s:tex_no_error
syn match texBadMath "\\end\s*{\s*\(array\|[bBpvV]matrix\|split\|smallmatrix\)\s*}"
syn match texBadMath "\\end\s*{\s*\(displaymath\|equation\|eqnarray\|math\)\*\=\s*}"
syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\)\*\=\s*}"
syn match texBadMath "\\[\])]"
syn match texBadPar contained "\%(\\par\>\|^\s*\n.\)"
endif
@@ -487,6 +488,11 @@ if !exists("g:tex_no_math")
call TexNewMathZone("B","eqnarray",1)
call TexNewMathZone("C","equation",1)
call TexNewMathZone("D","math",1)
call TexNewMathZone("E","align",1)
call TexNewMathZone("F","alignat",1)
call TexNewMathZone("G","flalign",1)
call TexNewMathZone("H","gather",1)
call TexNewMathZone("I","multline",1)
" Inline Math Zones: {{{2
if s:tex_fast =~# 'M'