Closed
Description
pandoc
supports a number of optional syntax extensions, one of which I use frequently: inline math through the \( ... \)
syntax. It'd be great if the pandocLaTeXInlineMath
region supported this alternative syntax as well.
I tried implementing it myself:
diff --git a/syntax/pandoc.vim b/syntax/pandoc.vim
index 759ebbb..185b378 100644
--- a/syntax/pandoc.vim
+++ b/syntax/pandoc.vim
@@ -210,7 +210,7 @@ call s:WithConceal('html_c_e', 'syn match pandocHTMLCommentEnd /-->/ contained',
" Unset current_syntax so the 2nd include will work
unlet b:current_syntax
syn include @LATEX syntax/tex.vim
-syn region pandocLaTeXInlineMath start=/\\\@<!\$[[:graph:]]\@=/ end=/\\\@<!\$/ keepend contains=@LATEX
+syn region pandocLaTeXInlineMath start=/\\\@<!\(\$|\\(\)[[:graph:]]\@=/ end=/\\\@<!\(\$|\\)\)/ keepend contains=@LATEX
syn match pandocProtectedFromInlineLaTeX /\\\@<!\${.*}\(\(\s\|[[:punct:]]\)\([^$]*\|.*\(\\\$.*\)\{2}\)\n\n\|$\)\@=/ display
" contains=@LATEX
syn region pandocLaTeXMathBlock start=/\$\$/ end=/\$\$/ keepend contains=@LATEX
But this solution behaves weirdly with respect to cases like the following:
\(x$
where the same delimiter isn't used on both ends.
Metadata
Metadata
Assignees
Labels
No labels