         name: 'string.other.math.display.begin.latex'
       1:
         name: 'invalid.deprecated.latex'
-    end: '(\\$\\$)|(\\\\\\])'
+    end: '(\\$\\$)|(\\\\\\])|(?=\\})'
     endCaptures:
       0:
         name: 'string.other.math.display.end.latex'

    beginCaptures:
      0:
        name: 'string.other.math.inline.begin.latex'
    end: '(\\$)|(\\\\\\))'
    endCaptures:
      0:
        name: 'string.other.math.inline.end.latex'

      { include: '#makeatsomething' }
      { include: '#verbatim' }
      { include: '#item' }
      { include: '#displayMathMode'}
      { include: '#inlineMathMode' }
      { include: '#texPrimitives' }
      { include: '#controlSymbol' }
      { include: '#controlWord' }
