     patterns: [
       {
         comment: 'Simplify syntax highlighting until the next magic syntax comment'
-        begin: '% !(?>T[eE]X) syntax = plain'
+        begin: '% !(?>T[eE]X) syntax\\s*=\\s*plain\\s*$'
         beginCaptures: 0: name: 'keyword.control.magic.syntax.plain.latex'
         end: '(?=% !T[eE]X syntax)'
         contentName: 'meta.syntax.plain.latex'

      }
      {
        comment: 'Forces out of mathmode. Actually implemented in the mathMode patterns, as I dont know how to force an exit indirectly.'
        match: '% !(?>T[eE]X) syntax = text'
        captures: 0: name: 'keyword.control.magic.syntax.text.latex'
      }
      {
        begin: '% !(?>T[eE]X) syntax = verbatim'
        beginCaptures: 0: name: 'keyword.control.magic.syntax.verbatim.latex'
        end: '(?=% !T[eE]X syntax)'
        contentName: 'markup.raw.verbatim.latex'
      }
      {
        begin: '% !(?>T[eE]X) syntax = none'
        beginCaptures: 0: name: 'keyword.control.magic.syntax.verbatim.latex'
        end: '(?=% !T[eE]X syntax)'
        contentName: 'meta.syntax.none.latex'

      { include: '#lineComment' }
      {
        comment: 'Does not look for matching, just shows it is there'
        match: '(\\$\\$)|(\\$)|(\\{)|(\\})'
        captures:
          1: name: 'string.other.math.display.latex'
          2: name: 'string.other.math.inline.latex'
          3: name: 'punctuation.definition.group.begin.latex'
          4: name: 'punctuation.definition.group.end.latex'
      }
    ]
  }
