global !p def math(): return vim.eval('vimtex#syntax#in_mathzone()') == '1' endglobal snippet beg "begin{} / end{}" bA \\begin{$1} $2 \\end{$1}$0 endsnippet snippet sm "Math" wA $${1}$`!p if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']: snip.rv = ' ' else: snip.rv = '' `$2 endsnippet snippet dm "Display Math" wA \[ $1 .\] $0 endsnippet