diff --git a/CHANGELOG.md b/CHANGELOG.md index df5a22d..724ded1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ based on http://keepachangelog.com/en/1.0.0/ - Grammar for `comment` environment. ### Changed +- Changed `'include': '$base'` to `'include': '$self'`. This improves highlighting when embedded in another grammar, such as Markdown. - Set 'softWrap' to be true by default in LaTeX files. - Changed inline math snippet from `$...$` to `\(...\)`. diff --git a/grammars/latex-beamer.cson b/grammars/latex-beamer.cson index b16c267..31f820b 100644 --- a/grammars/latex-beamer.cson +++ b/grammars/latex-beamer.cson @@ -59,6 +59,25 @@ 'match': '((\\\\)frametitle)(\\{)(.*)(\\})' 'name': 'meta.function.frametitle.latex' } + # The following rule is repeated from `latex.cson` in order to support the use + # of `$self` instead of `$base`. This allows for correct embedding of + # LaTeX rules within other grammars, for example Markdown. + { + 'begin': '\\{' + 'beginCaptures': + '0': + 'name': 'punctuation.section.group.begin.tex.latex.beamer' + 'end': '\\}' + 'endCaptures': + '0': + 'name': 'punctuation.section.group.end.tex.latex.beamer' + 'name': 'meta.group.braces.tex.latex.beamer' + 'patterns': [ + { + 'include': '$self' + } + ] + } { 'include': 'text.tex.latex' } diff --git a/grammars/latex-memoir.cson b/grammars/latex-memoir.cson index ea82460..7395900 100644 --- a/grammars/latex-memoir.cson +++ b/grammars/latex-memoir.cson @@ -67,6 +67,25 @@ } ] } + # The following rule is repeated from `latex.cson` in order to support the use + # of `$self` instead of `$base`. This allows for correct embedding of + # LaTeX rules within other grammars, for example Markdown. + { + 'begin': '\\{' + 'beginCaptures': + '0': + 'name': 'punctuation.section.group.begin.tex.latex.memoir' + 'end': '\\}' + 'endCaptures': + '0': + 'name': 'punctuation.section.group.end.tex.latex.memoir' + 'name': 'meta.group.braces.tex.latex.memoir' + 'patterns': [ + { + 'include': '$self' + } + ] + } { 'include': 'text.tex.latex' } diff --git a/grammars/latex.cson b/grammars/latex.cson index 3d6c533..95bce0e 100644 --- a/grammars/latex.cson +++ b/grammars/latex.cson @@ -122,7 +122,7 @@ 'name': 'support.variable.expl3.latex' } { - 'include': '$base' + 'include': '$self' } ] } @@ -147,7 +147,7 @@ 'name': 'support.variable.expl3.latex' } { - 'include': '$base' + 'include': '$self' } ] } @@ -1448,7 +1448,7 @@ 'name': 'meta.function.environment.math.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1476,7 +1476,7 @@ 'name': 'meta.function.environment.math.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1504,7 +1504,7 @@ 'name': 'meta.function.environment.math.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1526,7 +1526,7 @@ 'name': 'meta.function.environment.math.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1580,17 +1580,17 @@ 'name': 'meta.cell.environment.tabular.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } { - 'include': '$base' + 'include': '$self' } ] } { - 'include': '$base' + 'include': '$self' } ] } @@ -1611,7 +1611,7 @@ 'name': 'meta.function.environment.list.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1673,7 +1673,7 @@ 'name': 'meta.function.environment.general.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1712,7 +1712,7 @@ 'name': 'punctuation.definition.marginpar.end.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1745,7 +1745,7 @@ 'name': 'punctuation.definition.footnote.end.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1766,7 +1766,7 @@ 'name': 'meta.function.emph.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1788,7 +1788,7 @@ 'name': 'meta.function.textit.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1809,7 +1809,7 @@ 'name': 'meta.function.textbf.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -1830,7 +1830,7 @@ 'name': 'meta.function.texttt.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -2018,7 +2018,7 @@ 'name': 'string.other.math.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -2034,7 +2034,7 @@ 'name': 'string.other.math.latex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] } @@ -2054,6 +2054,22 @@ 'match': '(?:<|>)(\\{)\\$(\\})' 'name': 'meta.column-specials.latex' } + { + 'begin': '\\{' + 'beginCaptures': + '0': + 'name': 'punctuation.section.group.begin.tex.latex' + 'end': '\\}' + 'endCaptures': + '0': + 'name': 'punctuation.section.group.end.tex.latex' + 'name': 'meta.group.braces.tex.latex' + 'patterns': [ + { + 'include': '$self' + } + ] + } { 'include': 'text.tex' } diff --git a/grammars/tex.cson b/grammars/tex.cson index 30db355..e3d06e0 100644 --- a/grammars/tex.cson +++ b/grammars/tex.cson @@ -82,7 +82,7 @@ 'name': 'meta.group.braces.tex' 'patterns': [ { - 'include': '$base' + 'include': '$self' } ] }