diff --git a/Haskell/Literate Haskell.sublime-syntax b/Haskell/Literate Haskell.sublime-syntax
index 82d232809a..482ba775a2 100644
--- a/Haskell/Literate Haskell.sublime-syntax
+++ b/Haskell/Literate Haskell.sublime-syntax
@@ -6,22 +6,45 @@ file_extensions:
- lhs
scope: text.tex.latex.haskell
contexts:
+ prototype:
+ - include: scope:text.tex.latex#comments
+
main:
- - match: '^((\\)begin)({)code(})(\s*\n)?'
+ - include: scope:text.tex.latex#unique-latex
+ - include: scope:text.tex.latex#packages
+ - include: haskell-code
+ - include: scope:text.tex.latex#plain-tex
+ - include: scope:text.tex.latex#begin-end-commands
+ - include: scope:text.tex.latex#general-commands
+ - include: global-braces
+
+ global-braces:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: main
+
+ haskell-code:
+ - match: '(?:\s*)((\\)begin)(\{)(code)(\})'
captures:
1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: punctuation.definition.arguments.end.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- meta_scope: meta.function.embedded.haskell.latex
- meta_content_scope: source.haskell.embedded.latex
- - match: '^((\\)end)({)code(})'
+ - match: '((\\)end)(\{)(code)(\})'
captures:
1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: punctuation.definition.arguments.end.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
pop: true
- include: scope:source.haskell
- - include: scope:text.tex.latex
diff --git a/LaTeX/Indentation Rules.tmPreferences b/LaTeX/Indentation Rules.tmPreferences
new file mode 100644
index 0000000000..2810f8a8d3
--- /dev/null
+++ b/LaTeX/Indentation Rules.tmPreferences
@@ -0,0 +1,14 @@
+
+
+
+ scope
+ text.tex
+ settings
+
+ decreaseIndentPattern
+ ^\s*\\end\s*\{(?:itemize|enumerate|description)\*?\}\s*$
+ increaseIndentPattern
+ ^\s*\\begin\s*\{(?:itemize|enumerate|description)\*?\}\s*$
+
+
+
diff --git a/LaTeX/LaTeX Beamer.sublime-syntax b/LaTeX/LaTeX Beamer.sublime-syntax
deleted file mode 100644
index 89e3c06303..0000000000
--- a/LaTeX/LaTeX Beamer.sublime-syntax
+++ /dev/null
@@ -1,36 +0,0 @@
-%YAML 1.2
----
-# http://www.sublimetext.com/docs/3/syntax.html
-name: LaTeX Beamer
-file_extensions: []
-first_line_match: '^\\documentclass(\[.*\])?\{beamer\}'
-scope: text.tex.latex.beamer
-contexts:
- main:
- - match: '(?:\s*)((\\)begin)(\{)(frame)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- push:
- - meta_scope: meta.function.environment.frame.latex
- - match: '((\\)end)(\{)(frame)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- pop: true
- - include: main
- - match: '((\\)frametitle)(\{)(.*)(\})'
- scope: meta.function.frametitle.latex
- captures:
- 1: support.function.frametitle.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: entity.name.function.frame.latex
- 5: punctuation.definition.arguments.end.latex
- - include: scope:text.tex.latex
diff --git a/LaTeX/LaTeX Memoir.sublime-syntax b/LaTeX/LaTeX Memoir.sublime-syntax
deleted file mode 100644
index 76e9c6bc79..0000000000
--- a/LaTeX/LaTeX Memoir.sublime-syntax
+++ /dev/null
@@ -1,68 +0,0 @@
-%YAML 1.2
----
-# http://www.sublimetext.com/docs/3/syntax.html
-name: LaTeX Memoir
-file_extensions: []
-first_line_match: '^\\documentclass(\[.*\])?\{memoir\}'
-scope: text.tex.latex.memoir
-contexts:
- main:
- - match: '(?:\s*)((\\)begin)(\{)(framed|shaded|leftbar)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- push:
- - meta_scope: meta.function.memoir-fbox.latex
- - match: '((\\)end)(\{)(\4)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- pop: true
- - include: main
- - match: '(?:\s*)((\\)begin)(\{)((?:fboxv|boxedv|V)erbatim)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- push:
- - meta_scope: meta.function.memoir-verbatim.latex
- - meta_content_scope: markup.raw.verbatim.latex
- - match: '((\\)end)(\{)(\4)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- pop: true
- - match: '(?:\s*)((\\)begin)(\{)(alltt)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- push:
- - meta_scope: meta.function.memoir-alltt.latex
- - meta_content_scope: markup.raw.verbatim.latex
- - match: '((\\)end)(\{)(alltt)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- pop: true
- - match: '(\\)[A-Za-z]+'
- scope: support.function.general.tex
- captures:
- 1: punctuation.definition.function.tex
- - include: scope:text.tex.latex
diff --git a/LaTeX/LaTeX.sublime-settings b/LaTeX/LaTeX.sublime-settings
new file mode 100644
index 0000000000..ebdd55fede
--- /dev/null
+++ b/LaTeX/LaTeX.sublime-settings
@@ -0,0 +1,4 @@
+{
+ "spelling_selector": "-(comment, source, constant, keyword, storage, support, variable, markup.underline.link, meta.tag, meta.preamble, meta.include, meta.function.citation, meta.function.reference, meta.function.label, meta.function.includegraphics)",
+ "word_separators": "_./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?"
+}
diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax
index 5f6e590610..cc567c43bf 100644
--- a/LaTeX/LaTeX.sublime-syntax
+++ b/LaTeX/LaTeX.sublime-syntax
@@ -4,554 +4,1644 @@
name: LaTeX
file_extensions:
- tex
-first_line_match: '^\\documentclass(?!.*\{beamer\})'
+ - ltx
scope: text.tex.latex
contexts:
+ prototype:
+ - include: comments
+
main:
- - match: '(?=\s)(?<=\\[\w@]|\\[\w@]{2}|\\[\w@]{3}|\\[\w@]{4}|\\[\w@]{5}|\\[\w@]{6})\s'
- scope: meta.space-after-command.latex
- - match: '((\\)(?:usepackage|documentclass))(?:(\[)([^\]]*)(\]))?(\{)'
- captures:
- 1: keyword.control.preamble.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.latex
- 5: punctuation.definition.arguments.end.latex
- 6: punctuation.definition.arguments.begin.latex
- push:
- - meta_scope: meta.preamble.latex
- - meta_content_scope: support.class.latex
+ - include: unique-latex
+ - include: packages
+ - include: plain-tex
+ - include: begin-end-commands
+ - include: general-commands
+ - include: global-braces
+
+ unique-latex:
+ - include: preamble
+ - include: structure
+ - include: includes
+ - include: sections
+ - include: text-decorators
+ - include: references
+ - include: verbatim
+ - include: verb
+ - include: url
+ - include: graphics
+ - include: lists
+
+ plain-tex:
+ - include: macros
+ - include: scope:text.tex#controls
+ - include: scope:text.tex#catcode
+ - include: boxes
+ - include: block-math
+ - include: inline-math
+ - include: general-constants
+
+ comments:
+ - include: scope:text.tex#comments
+
+ global-braces:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
- match: '\}'
- captures:
- 0: punctuation.definition.arguments.end.latex
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: main
+
+ # these are used to identify arguments in commands
+ general-optional-arguments:
+ - match: '\['
+ scope: punctuation.definition.group.bracket.begin.latex
+ push:
+ - meta_scope: meta.group.bracket.latex
+ - match: '\]'
+ scope: punctuation.definition.group.bracket.end.latex
+ pop: true
+ - include: general-constants
+ - include: general-commands
+ - match: '[A-Za-z[:digit:]-]*(?=\s*\=)'
+ scope: variable.parameter.bracket.latex
+
+ _general-1-more-argument:
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ set:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
+ - match: '(?=\})'
+ pop: true
+ - include: main
+ - match: '(?=\})'
+ pop: true
+
+ _general-2-more-arguments:
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ set:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
+ - include: _general-1-more-argument
+ - match: '(?=\})'
+ pop: true
+ - include: main
+ - match: '(?=\})'
+ pop: true
+
+ general-1-argument:
+ - match: '\}'
+ scope: meta.group.brace.latex punctuation.definition.group.brace.end.latex
+ pop: true
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
+ - match: '(?=\})'
pop: true
- include: main
- - match: '((\\)(?:include|input))(\{)'
+ - match: '(?=\S)'
+ pop: true
+
+ general-2-arguments:
+ - match: '\}'
+ scope: meta.group.brace.latex punctuation.definition.group.brace.end.latex
+ pop: true
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
+ - include: _general-1-more-argument
+ - include: main
+ - match: '(?=\S)'
+ pop: true
+
+ general-3-arguments:
+ - match: '\}'
+ scope: meta.group.brace.latex punctuation.definition.group.brace.end.latex
+ pop: true
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
+ - include: _general-2-more-arguments
+ - include: main
+ - match: '(?=\S)'
+ pop: true
+
+ general-1-argument-with-options:
+ - include: general-optional-arguments
+ - include: general-1-argument
+
+ general-2-arguments-with-options:
+ - include: general-optional-arguments
+ - include: general-2-arguments
+
+ general-3-arguments-with-options:
+ - include: general-optional-arguments
+ - include: general-3-arguments
+
+ # used in macros to prevent matching of \begin{env}...\end{env}
+ macro-braces:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: general-constants
+ - include: general-commands
+ - include: macro-braces
+
+ macros:
+ - include: scope:text.tex#macros
+ - match: |-
+ (?x)
+ (
+ (\\)
+ (?:(?:re)?newcommand\*?)
+ )
+ (?:
+ (\{)(\\[A-Za-z@]+)(\})
+ | (\\[A-Za-z@])+
+ )
+ (?:(\[)(?:[^\]]*)(\]))?
+ (\{)
+ captures:
+ 1: support.function.newcommand.latex storage.modifier.newcommand.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: support.function.latex entity.name.newcommand.latex
+ 5: punctuation.definition.group.brace.end.latex
+ 6: support.function.latex
+ 7: punctuation.definition.group.bracket.begin.latex
+ 8: punctuation.definition.group.bracket.end.latex
+ 9: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.function.newcommand.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: general-constants
+ - include: general-commands
+ - include: macro-braces
+ - match: |-
+ (?x)
+ (
+ (\\)
+ DeclareMathOperator\*?
+ )
+ (?:
+ (\{)(\\[A-Za-z@]+)(\})
+ | (\\[A-Za-z@])+
+ )
+ (?:(\[)(?:[^\]]*)(\]))?
+ (\{)
+ captures:
+ 1: support.function.declare-math-operator.latex storage.modifier.declare-math-operator.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: support.function.latex entity.name.declare-math-operator.latex
+ 5: punctuation.definition.group.brace.end.latex
+ 6: support.function.latex
+ 7: punctuation.definition.group.bracket.begin.latex
+ 8: punctuation.definition.group.bracket.end.latex
+ 9: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.function.declare-math-operator.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: general-constants
+ - include: general-commands
+ - include: macro-braces
+
+ general-constants:
+ - match: '(\\\\)(?:(\[)\s*-?([[:digit:]]*)\s*(\w*)\s*(\]))?'
+ captures:
+ 1: constant.character.newline.latex
+ 2: punctuation.definition.group.bracket.begin.newline.latex
+ 3: constant.numeric.newline.latex
+ 4: keyword.other.newline.latex
+ 5: punctuation.definition.group.bracket.begin.newline.latex
+ - include: scope:text.tex#general-constants
+
+ general-commands:
+ - match: '(\\)[A-Za-z@]+'
+ scope: support.function.general.latex
+ captures:
+ 1: punctuation.definition.backslash.latex
+
+ boxes:
+ - match: '((\\)[hvmf]box)\s*(\{)'
+ captures:
+ 1: support.function.box.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.function.box.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: main
+ - match: '((\\)(?:framebox|makebox))\b'
+ captures:
+ 1: support.function.box.latex
+ 2: punctuation.definition.backslash.latex
+ push:
+ - meta_scope: meta.function.box.latex
+ - include: general-1-argument-with-options
+ - match: '((\\)parbox)\b'
+ captures:
+ 1: support.function.box.latex
+ 2: punctuation.definition.backslash.latex
+ push:
+ - meta_scope: meta.function.box.latex
+ - include: general-2-arguments-with-options
+ - match: '((\\)raisebox)\b'
+ captures:
+ 1: support.function.box.latex
+ 2: punctuation.definition.backslash.latex
+ push:
+ - meta_scope: meta.function.box.latex
+ - include: general-1-argument-with-options
+
+ preamble:
+ - match: '(\\)documentclass\b'
+ captures:
+ 0: keyword.control.preamble.latex
+ 1: punctuation.definition.backslash.latex
+ push:
+ - meta_scope: meta.preamble.documentclass.latex
+ - include: general-optional-arguments
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ set:
+ - meta_scope: meta.preamble.documentclass.latex meta.group.brace.latex
+ - match: '[A-Za-z[:digit:]-]'
+ scope: support.class.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - match: '(?=\S)'
+ pop: true
+
+ - match: '(\\)usepackage\b'
+ captures:
+ 0: keyword.control.preamble.latex
+ 1: punctuation.definition.backslash.latex
+ push:
+ - meta_scope: meta.preamble.usepackage.latex
+ - include: general-optional-arguments
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ set:
+ - meta_scope: meta.preamble.usepackage.latex meta.group.brace.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - match: '[A-Za-z[:digit:]-]*'
+ scope: support.class.latex
+ - match: '(?=\S)'
+ pop: true
+
+ includes:
+ - match: '((\\)(?:include|includeonly))(\{)'
+ scope: meta.function.include.latex
captures:
1: keyword.control.include.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
push:
- meta_scope: meta.include.latex
- - meta_content_scope: support.class.latex
- match: '\}'
- captures:
- 0: punctuation.definition.arguments.end.latex
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- - include: main
+
+ sections:
- match: |-
(?x)
- ( # Capture 1
- (\\) # Marker
- (?:
- (?:sub){0,2}section # Functions
- | (?:sub)?paragraph
- | chapter|part|addpart
- | addchap|addsec|minisec
- )
- (?:\*)? # Optional Unnumbered
+ (
+ (\\)
+ (?:
+ (?:sub){0,2}section
+ | (?:sub)?paragraph
+ | chapter|part|addpart
+ | addchap|addsec|minisec
+ )
+ (?:\*)?
)
(?:
- (\[)([^\[]*?)(\]) # Optional Title
- )??
- (\{) # Opening Bracket
- comment: this works OK with all kinds of crazy stuff as long as section is one line
+ (\[)([^\[]*?)(\]) # optional Title
+ )?
+ (\{)
captures:
1: support.function.section.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.optional.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: entity.name.section.latex
- 5: punctuation.definition.arguments.optional.end.latex
- 6: punctuation.definition.arguments.begin.latex
+ 5: punctuation.definition.group.brace.end.latex
+ 6: punctuation.definition.group.brace.begin.latex
push:
- - meta_scope: meta.function.section.latex
+ - meta_scope: meta.section.latex
- meta_content_scope: entity.name.section.latex
- match: '\}'
- captures:
- 0: punctuation.definition.arguments.end.latex
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- include: main
- - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Java)\n?)'
+
+ structure:
+ - match: ((\\)(?:frontmatter|mainmatter|backmatter|appendix|printindex))\b
+ captures:
+ 1: keyword.control.latex
+ 2: punctuation.definition.backslash.latex
+
+ verbatim:
+ - match: '((\\)begin)(\{)\s*((?:[vV]erbatim|alltt)\*?)\s*(\})'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.brace.bebgin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- 6: punctuation.definition.arguments.optional.begin.latex
- 7: punctuation.definition.arguments.optional.end.latex
- 8: comment.line.percentage.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: meta.function.embedded.java.latex
- - meta_content_scope: source.java.embedded
- - match: '((\\)end)(\{)(lstlisting)(\})'
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.verbatim.latex
+ - meta_content_scope: markup.raw.verbatim.latex
+ - match: '((\\)end)(\{)\s*(\4)\s*(\})'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 1: support.function.end.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- 6: punctuation.definition.arguments.optional.begin.latex
- 7: punctuation.definition.arguments.optional.end.latex
- 8: comment.line.percentage.latex
- pop: true
- - include: scope:source.java
- - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Python)\n?)'
- comment: Put the lstlisting match before the more general environment listing. Someday it would be nice to make this rule general enough to figure out which language is inside the lstlisting environment rather than my own personal use for python. --Brad
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 5: punctuation.definition.group.brace.end.latex
+ pop: true
+
+ lists:
+ - match: '((\\)begin)(\{)\s*(itemize\*?)\s*(\})'
+ captures:
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- 6: punctuation.definition.arguments.optional.begin.latex
- 7: punctuation.definition.arguments.optional.end.latex
- 8: comment.line.percentage.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: meta.function.embedded.python.latex
- - meta_content_scope: source.python.embedded
- - match: '((\\)end)(\{)(lstlisting)(\})'
+ - meta_scope: meta.environment.list.itemize.latex
+ - match: '((\\)end)(\{)\s*(\4)\s*(\})'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 1: support.function.end.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- 6: punctuation.definition.arguments.optional.begin.latex
- 7: punctuation.definition.arguments.optional.end.latex
- 8: comment.line.percentage.latex
- pop: true
- - include: scope:source.python
- - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%.*\n?)?'
- comment: Put the lstlisting match before the more general environment listing. Someday it would be nice to make this rule general enough to figure out which language is inside the lstlisting environment rather than my own personal use for python. --Brad
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 5: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: main
+ - match: '((\\)begin)(\{)\s*(enumerate\*?)\s*(\})'
+ captures:
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- 6: punctuation.definition.arguments.optional.begin.latex
- 7: punctuation.definition.arguments.optional.end.latex
- 8: comment.line.percentage.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: meta.function.embedded.generic.latex
- - meta_content_scope: source.generic.embedded
- - match: '((\\)end)(\{)(lstlisting)(\})'
+ - meta_scope: meta.environment.list.enumerate.latex
+ - match: '((\\)end)(\{)\s*(\4)\s*(\})'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 1: support.function.end.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- 6: punctuation.definition.arguments.optional.begin.latex
- 7: punctuation.definition.arguments.optional.end.latex
- 8: comment.line.percentage.latex
+ 5: punctuation.definition.group.brace.end.latex
pop: true
- - match: '(?:\s*)((\\)begin)(\{)((?:V|v)erbatim|alltt)(\})'
+ - include: main
+ - match: '((\\)begin)(\{)\s*(list\*?)\s*(\})'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: meta.function.verbatim.latex
- - meta_content_scope: markup.raw.verbatim.latex
- - match: '((\\)end)(\{)(\4)(\})'
+ - meta_scope: meta.environment.list.list.latex
+ - match: '((\\)end)(\{)\s*(\4)\s*(\})'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
+ 1: support.function.end.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
+ 5: punctuation.definition.group.brace.end.latex
pop: true
- - match: '(?:\s*)((\\)(?:url|href))(\{)([^}]*)(\})'
- scope: meta.function.link.url.latex
- captures:
- 1: support.function.url.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: markup.underline.link.latex
- 5: punctuation.definition.arguments.end.latex
- - match: '(?:\s*)((\\)begin)(\{)(document)(\})'
- comment: 'These two patterns match the \begin{document} and \end{document} commands, so that the environment matching pattern following them will ignore those commands.'
- scope: meta.function.begin-document.latex
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- - match: '(?:\s*)((\\)end)(\{)(document)(\})'
- scope: meta.function.end-document.latex
+ - include: main
+ - match: '((\\)begin)(\{)\s*(description\*?)\s*(\})'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- - match: |-
- (?x)
- (?:\s*) # Optional whitespace
- ((\\)begin) # Marker - Function
- (\{) # Open Bracket
- (
- (?:
- align|equation|eqnarray # Argument
- | multline|aligned|alignat
- | split|gather|gathered
- )
- (?:\*)? # Optional Unnumbered
- )
- (\}) # Close Bracket
- (\s*\n)? # Match to end of line absent of content
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- push:
- - meta_scope: meta.function.environment.math.latex
- - meta_content_scope: string.other.math.block.environment.latex
- - match: |-
- (?x)
- (?:\s*) # Optional whitespace
- ((\\)end) # Marker - Function
- (\{) # Open Bracket
- (\4) # Previous capture from begin
- (\}) # Close Bracket
- (?:\s*\n)? # Match to end of line absent of content
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- pop: true
- - include: $top_level_main
- - match: |-
- (?x)
- (?:\s*) # Optional whitespace
- ((\\)begin) # Marker - Function
- (\{) # Open Bracket
- (array|tabular[xy*]?)
- (\}) # Close Bracket
- (\s*\n)? # Match to end of line absent of content
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- push:
- - meta_scope: meta.function.environment.tabular.latex
- - meta_content_scope: meta.data.environment.tabular.latex
- - match: |-
- (?x)
- (?:\s*) # Optional whitespace
- ((\\)end) # Marker - Function
- (\{) # Open Bracket
- (\4) # Previous capture from begin
- (\}) # Close Bracket
- (?:\s*\n)? # Match to end of line absent of content
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.begin.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.end.latex
- pop: true
- - match: \\
- scope: punctuation.definition.table.row.latex
- - match: '(?:^|(?<=\\\\))(?!\\\\|\s*\\end\{(?:tabular|array))'
- push:
- - meta_scope: meta.row.environment.tabular.latex
- - match: '(?=\\\\|\s*\\end\{(?:tabular|array))'
- pop: true
- - match: "&"
- scope: punctuation.definition.table.cell.latex
- - match: (?:^|(?<=&))((?!&|\\\\|$))
- push:
- - meta_scope: meta.cell.environment.tabular.latex
- - match: '(?=&|\\\\|\s*\\end\{(?:tabular|array))'
- pop: true
- - include: $top_level_main
- - include: $top_level_main
- - include: $top_level_main
- - match: '(?:\s*)((\\)begin)(\{)(itemize|enumerate|description|list)(\})'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: meta.function.environment.list.latex
- - match: '((\\)end)(\{)(\4)(\})(?:\s*\n)?'
+ - meta_scope: meta.environment.list.description.latex
+ - match: '((\\)end)(\{)\s*(\4)\s*(\})'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.latex
+ 1: support.function.end.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.latex
+ 5: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: main
+
+ math-braces:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.group.brace.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: math-content
+
+ math-content:
+ # unique to latex
+ - include: verb
+ - include: text-decorators
+ - include: references
+ - include: begin-end-commands
+ # extended from tex
+ - include: scope:text.tex#greeks
+ - include: scope:text.tex#math-brackets
+ - include: math-braces
+ - include: boxes
+ - include: scope:text.tex#math-commands
+ - include: scope:text.tex#math-operators
+ - include: scope:text.tex#math-characters
+ - include: scope:text.tex#math-numerics
+ - include: general-constants
+
+ inline-math:
+ - match: \$
+ scope: string.other.math.latex punctuation.definition.string.begin.latex
+ push:
+ - meta_scope: meta.environment.math.inline.dollar.latex
+ - match: \$
+ scope: string.other.math.latex punctuation.definition.string.end.latex
pop: true
- - include: $top_level_main
- - match: '(?:\s*)((\\)begin)(\{)(\w+[*]?)(\})'
+ - include: math-content
+ - match: '((\\)ensuremath)(\{)'
captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.latex
+ 1: support.function.ensuremath.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
push:
- - meta_scope: meta.function.environment.general.latex
- - match: '((\\)end)(\{)(\4)(\})(?:\s*\n)?'
- captures:
- 1: support.function.be.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.arguments.latex
- 4: variable.parameter.function.latex
- 5: punctuation.definition.arguments.latex
+ - meta_scope: meta.function.ensuremath.latex
+ - meta_content_scope: meta.environment.math.inline.ensuremath.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
- - match: (\\)(newcommand|renewcommand)\b
- scope: storage.type.function.latex
+ - include: math-content
+
+ - match: (\\\()
+ scope: string.other.math.latex
captures:
- 1: punctuation.definition.function.latex
- - match: '((\\)marginpar)(\{)'
+ 1: punctuation.definition.string.begin.latex
+ push:
+ - meta_scope: meta.environment.math.inline.paren.latex
+ - match: (\\\))
+ scope: string.other.math.latex punctuation.definition.string.end.latex
+ pop: true
+ - include: math-content
+
+ block-math:
+ - match: \$\$
+ scope: string.other.math.latex punctuation.definition.string.begin.latex
+ push:
+ - meta_scope: meta.environment.math.block.dollar.latex
+ - match: \$\$
+ scope: string.other.math.latex punctuation.definition.string.end.latex
+ pop: true
+ - include: math-content
+
+ - match: '(\\\[)'
+ scope: string.other.math.latex punctuation.definition.string.begin.latex
+ push:
+ - meta_scope: meta.environment.math.block.bracket.latex
+ - match: '(\\\])'
+ scope: string.other.math.latex punctuation.definition.string.end.latex
+ pop: true
+ - include: math-content
+
+ - match: |-
+ (?x)
+ ((\\)begin)(\{)\s*((?:
+ align|alignat|aligned|alignedat|displaymath
+ |eqnarray|equation|flalign|gather|gathered
+ |math|multline|x?xalignat|split
+ )\*?)\s*(\})
captures:
- 1: support.function.marginpar.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.marginpar.begin.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_content_scope: meta.paragraph.margin.latex
- - match: '\}'
+ - meta_content_scope: meta.environment.math.block.be.latex
+ - match: '((\\)end)(\{)\s*(\4)\s*(\})'
captures:
- 0: punctuation.definition.marginpar.end.latex
+ 1: support.function.end.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
- - match: '((\\)footnote)(\{)'
+ - include: math-content
+
+ graphics:
+ - match: '((\\)includegraphics)\b'
captures:
- 1: support.function.footnote.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.footnote.begin.latex
+ 1: support.function.includegraphics.latex
+ 2: punctuation.definition.backslash.latex
push:
- - meta_content_scope: meta.footnote.latex
- - match: '\}'
- captures:
- 0: punctuation.definition.footnote.end.latex
+ - meta_scope: meta.function.includegraphics.latex
+ - include: general-1-argument-with-options
+
+ url:
+ - match: '((\\)(?:url|href))(\{)([^}]*)(\})'
+ scope: meta.function.link.url.latex
+ captures:
+ 1: support.function.url.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: markup.underline.link.latex
+ 5: punctuation.definition.group.brace.end.latex
+
+ verb:
+ - match: ((\\)verb)(\W)
+ captures:
+ 1: support.function.verb.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.verb.latex
+ push:
+ - meta_scope: meta.environment.verbatim.verb.latex
+ - meta_content_scope: markup.raw.verb.latex
+ - match: '\3'
+ scope: punctuation.definition.verb.latex
pop: true
- - include: $top_level_main
+
+
+ text-decorators:
- match: '((\\)emph)(\{)'
captures:
1: support.function.emph.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.emph.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
push:
- meta_scope: meta.function.emph.latex
- meta_content_scope: markup.italic.emph.latex
- match: '\}'
- captures:
- 0: punctuation.definition.emph.end.latex
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
+ - include: main
- match: '((\\)textit)(\{)'
- comment: |
- We put the keyword in a capture and name this capture, so that disabling spell checking for “keyword” won't be inherited by the argument to \textit{...}.
-
- Put specific matches for particular LaTeX keyword.functions before the last two more general functions
captures:
1: support.function.textit.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.textit.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
push:
- meta_scope: meta.function.textit.latex
- meta_content_scope: markup.italic.textit.latex
- match: '\}'
- captures:
- 0: punctuation.definition.textit.end.latex
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
+ - include: main
- match: '((\\)textbf)(\{)'
captures:
1: support.function.textbf.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.textbf.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
push:
- meta_scope: meta.function.textbf.latex
- meta_content_scope: markup.bold.textbf.latex
- match: '\}'
- captures:
- 0: punctuation.definition.textbf.end.latex
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
+ - include: main
- match: '((\\)texttt)(\{)'
captures:
1: support.function.texttt.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.texttt.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
push:
- meta_scope: meta.function.texttt.latex
- meta_content_scope: markup.raw.texttt.latex
- match: '\}'
- captures:
- 0: punctuation.definition.texttt.end.latex
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
- - match: (\\)item\b
- scope: meta.scope.item.latex
+ - include: main
+ - match: '((\\)textsl)(\{)'
captures:
- 0: keyword.other.item.latex
- 1: punctuation.definition.keyword.latex
- - match: |-
- (?x)
- (
- (\\) # Marker
- (?:foot)?(?:full)?(?:no)?(?:short)? # Function Name
- [cC]ite
- (?:al)?(?:t|p|author|year(?:par)?|title)?[ANP]*
- \*? # Optional Unabbreviated
- )
- (?:(\[)[^\]]*(\]))? # Optional
- (?:(\[)[^\]]*(\]))? # Arguments
- (\{) # Opening Bracket
- captures:
- 1: keyword.control.cite.latex
- 2: punctuation.definition.keyword.latex
- 3: punctuation.definition.arguments.optional.begin.latex
- 4: punctuation.definition.arguments.optional.end.latex
- 5: punctuation.definition.arguments.optional.begin.latex
- 6: punctuation.definition.arguments.optional.end.latex
- 7: punctuation.definition.arguments.latex
- push:
- - meta_scope: meta.citation.latex
+ 1: support.function.textsl.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.function.textsl.latex
+ - meta_content_scope: markup.italic.textsl.latex
- match: '\}'
- captures:
- 0: punctuation.definition.arguments.latex
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- - match: '[\w:.]+'
- scope: constant.other.reference.citation.latex
- - match: '((\\)(?:\w*[r|R]ef\*?))(\{)'
+ - include: main
+ - match: '((\\)text)(\{)'
captures:
- 1: keyword.control.ref.latex
- 2: punctuation.definition.keyword.latex
- 3: punctuation.definition.arguments.begin.latex
+ 1: support.function.text.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
push:
- - meta_scope: meta.reference.label.latex
- match: '\}'
- captures:
- 0: punctuation.definition.arguments.begin.latex
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: main
+ - match: '((\\)underline)(\{)'
+ captures:
+ 1: support.function.text.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ push:
+ - meta_scope: meta.function.underline.latex
+ - meta_content_scope: markup.underline.underline.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - include: main
+
+ references:
+ - match: |-
+ (?x)
+ (
+ (\\)
+ (?:
+ [cC]ite(?:author|title|year|date|url|t|p|alt|alp|text)?
+ | (?:[pP]aren|foot|[tT]ext|[sS]mart|super|[aA]|no|full|footfull)cite|footcitetext
+ )
+ \*?
+ )\b
+ captures:
+ 1: support.function.cite.latex keyword.other.cite.latex
+ 2: punctuation.definition.backslash.latex
+ push:
+ - meta_scope: meta.function.citation.latex
+ - include: general-optional-arguments
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ set:
+ - meta_scope: meta.function.citation.latex meta.group.brace.latex
+ - match: '[a-zA-Z0-9\.:/*!^_-]+'
+ scope: constant.other.citation.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - match: '(?=\S)'
+ pop: true
+ - match: |-
+ (?x)
+ (
+ (\\)
+ (?:eq|c?page|[vV]|auto|name|[cC])?ref
+ \*?
+ )\b
+ captures:
+ 1: support.function.reference.latex keyword.other.reference.latex
+ 2: punctuation.definition.backslash.latex
+ push:
+ - meta_scope: meta.function.reference.latex
+ - include: general-optional-arguments
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
+ set:
+ - meta_scope: meta.function.reference.latex meta.group.brace.latex
+ - match: '[a-zA-Z0-9\.:/*!^_-]+'
+ scope: constant.other.reference.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
+ pop: true
+ - match: '(?=\S)'
pop: true
- - match: '[a-zA-Z0-9\.,:/*!^_-]'
- scope: constant.other.reference.label.latex
- match: '((\\)label)(\{)'
captures:
- 1: keyword.control.label.latex
- 2: punctuation.definition.keyword.latex
- 3: punctuation.definition.arguments.begin.latex
+ 1: support.function.label.latex storage.type.label.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
push:
- - meta_scope: meta.definition.label.latex
+ - meta_scope: meta.function.label.latex
+ - match: '[a-zA-Z0-9\.:/*!^_-]+'
+ scope: entity.name.label.latex
- match: '\}'
- captures:
- 0: punctuation.definition.arguments.end.latex
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- - match: '[a-zA-Z0-9\.,:/*!^_-]'
- scope: variable.parameter.definition.label.latex
- - match: '((\\)verb[\*]?)\s*((\\)scantokens)(\{)'
+
+ begin-end-commands:
+ - match: '((\\)begin)(\{)\s*(\w*)\*?\s*(\})'
captures:
- 1: support.function.verb.latex
- 2: punctuation.definition.function.latex
- 3: support.function.verb.latex
- 4: punctuation.definition.verb.latex
- 5: punctuation.definition.begin.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: meta.function.verb.latex
- - meta_content_scope: markup.raw.verb.latex
- - match: '(\})'
- captures:
- 1: punctuation.definition.end.latex
+ - include: general-optional-arguments
+ - match: ''
pop: true
- - include: main
- - match: '((\\)verb[\*]?)\s*((?<=\s)\S|[^a-zA-Z])(.*?)(\3|$)'
- scope: meta.function.verb.latex
+ - match: '((\\)end)(\{)\s*(\w*)\*?\s*(\})'
captures:
- 1: support.function.verb.latex
- 2: punctuation.definition.function.latex
- 3: punctuation.definition.verb.latex
- 4: markup.raw.verb.latex
- 5: punctuation.definition.verb.latex
- - match: '"`'
+ 1: support.function.end.latex keyword.control.flow.end.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
+
+ # external packages
+ packages:
+ - include: pkglistings
+ - include: minted
+ - include: pkgcomment
+ - include: beamer
+
+ # listings package
+ pkglistings:
+ - match: (\\)lstinline\b
+ captures:
+ 0: support.function.lstinline.latex
+ 1: punctuation.definition.backslash.latex
+ push:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.lstinline.latex
+ - include: general-optional-arguments
+ - match: '(\W)'
+ scope: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.verbatim.lstinline.latex markup.raw.verb.latex
+ - match: '\1'
+ scope: meta.environment.verbatim.lstinline.latex punctuation.definition.verb.latex
+ pop: true
+
+ - match: ((\\)begin)(\{)(lstlisting)(\})
captures:
- 0: punctuation.definition.string.begin.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: string.quoted.double.european.latex
- - match: '"'''
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.lstlisting.latex
+ - match: '((\\)end)(\{)(lstlisting)(\})'
captures:
- 0: punctuation.definition.string.end.latex
+ 1: support.function.end.latex keyword.control.flow.end.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
- - match: "``"
+ - include: general-optional-arguments
+ - match: '.*(%\s*(?i:c))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.c.latex source.c.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.c
+ - match: '.*(%\s*(?i:cpp|c\+\+))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.c++.latex source.c++.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.c++
+ - match: '.*(%\s*(?i:haskell|hs))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.haskell.latex source.haskell.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.haskell
+ - match: '.*(%\s*(?i:java))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.java.latex source.java.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.java
+ - match: '.*(%\s*(?i:tex|latex))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.latex.latex source.latex.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:text.tex.latex
+ - match: '.*(%\s*(?i:lisp))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.lisp.latex source.lisp.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.lisp
+ - match: '.*(%\s*(?i:lua))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.lua.latex source.lua.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.lua
+ - match: '.*(%\s*(?i:perl))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.perl.latex source.perl.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.perl
+ - match: '.*(%\s*(?i:php))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.php.latex source.php.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.php
+ - match: '.*(%\s*(?i:python|py))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.python
+ - match: '.*(%\s*(?i:r))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.r.latex source.r.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.r
+ - match: '.*(%\s*(?i:ruby))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.ruby.latex source.ruby.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.ruby
+ - match: '.*(%\s*(?i:sh|shell|bash ))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.shell.latex source.shell.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.shell
+ - match: '.*(%\s*(?i:sql|mysql|ddl|dml))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.sql.latex source.sql.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.sql
+ - match: '.*(%\s*(?i:yaml))$'
+ captures:
+ 1: comment.line.percentage.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.yaml.latex source.yaml.embedded
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+ - include: scope:source.yaml
+ - match: ''
+ push:
+ - meta_scope: meta.environment.embedded.generic.latex markup.raw.verb.latex
+ - match: '(?=\\end\{lstlisting\})'
+ pop: true
+
+ minted:
+ - include: minted-env
+ - include: mint
+
+ minted-env:
+ - match: ((\\)begin)(\{)(minted)(\})
captures:
- 0: punctuation.definition.string.begin.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: string.quoted.double.latex
- - match: '''''|"'
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - match: '((\\)end)(\{)(minted)(\})'
captures:
- 0: punctuation.definition.string.end.latex
+ 1: support.function.end.latex keyword.control.flow.end.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
- - match: '">'
+ - include: general-optional-arguments
+ - match: '(\{)(c)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.c.latex source.c.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.c
+ - match: '(\{)(cpp|c\+\+)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.c++.latex source.c++.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.c++
+ - match: '(\{)(diff)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.diff.latex source.diff.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.diff
+ - match: '(\{)(go|golang)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.go.latex source.go.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.go
+ - match: '(\{)(haskell|hs)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.haskell.latex source.haskell.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.haskell
+ - match: '(\{)(java)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.java.latex source.java.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.java
+ - match: '(\{)(javascript|js)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.js.latex source.js.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.js
+ - match: '(\{)(json)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.json.latex source.json.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.json
+ - match: '(\{)(tex|latex)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.latex.latex text.tex.latex.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:text.tex.latex
+ - match: '(\{)(lisp)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.lisp.latex source.lisp.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.lisp
+ - match: '(\{)(lua)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.lua.latex source.lua.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.lua
+ - match: '(\{)(obj(?:ective\-|)c)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.objc.latex source.objc.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.objc
+ - match: '(\{)(obj(?:ective\-|)c\+\+)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.objc++.latex source.objc++.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.objc++
+ - match: '(\{)(perl)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.perl.latex source.perl.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.perl
+ - match: '(\{)(php)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.php.latex source.php.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.php
+ - match: '(\{)(python|py)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.python
+ - match: '(\{)(r)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.r.latex source.r.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.r
+ - match: '(\{)(ruby)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.ruby.latex source.ruby.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.ruby
+ - match: '(\{)(sh|shell|bash )(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.shell.latex source.shell.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.shell
+ - match: '(\{)(sql|mysql|ddl|dml)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.sql.latex source.sql.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.sql
+ - match: '(\{)(yaml)(\})'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ push:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.environment.embedded.yaml.latex source.yaml.embedded
+ - match: '(?=\\end\{minted\})'
+ pop: true
+ - include: scope:source.yaml
+ - match: ''
+ push:
+ - meta_scope: meta.environment.embedded.generic.latex markup.raw.verb.latex
+ - match: '(?=\\end\{minted\})'
+ pop: true
+
+ mint:
+ - match: ((\\)mint)\b|((\\)mintinline)\b
captures:
- 0: punctuation.definition.string.begin.latex
+ 1: support.function.mint.latex
+ 2: punctuation.definition.backslash.latex
+ 3: support.function.mintinline.latex
+ 4: punctuation.definition.backslash.latex
push:
- - meta_scope: string.quoted.double.guillemot.latex
- - match: '"<'
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - include: general-optional-arguments
+ - match: '(\{)(c)(\})((\{)|(\W))'
captures:
- 0: punctuation.definition.string.end.latex
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.c.latex source.c.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.c
+ - match: '(\{)(cpp|c\+\+)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.c++.latex source.c++.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.c++
+ - match: '(\{)(diff)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.diff.latex source.diff.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.diff
+ - match: '(\{)(go|golang)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.go.latex source.go.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.go
+ - match: '(\{)(haskell|hs)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.haskell.latex source.haskell.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.haskell
+ - match: '(\{)(java)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.java.latex source.java.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.java
+ - match: '(\{)(javascript|js)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.js.latex source.js.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.js
+ - match: '(\{)(json)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.json.latex source.json.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.json
+ - match: '(\{)(tex|latex)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.latex.latex text.tex.latex.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:text.tex.latex
+ - match: '(\{)(lisp)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.lisp.latex source.lisp.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.lisp
+ - match: '(\{)(lua)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.lua.latex source.lua.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.lua
+ - match: '(\{)(obj(?:ective\-|)c)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.objc.latex source.objc.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.objc
+ - match: '(\{)(obj(?:ective\-|)c\+\+)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.objc++.latex source.objc++.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.objc++
+ - match: '(\{)(perl)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.perl.latex source.perl.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.perl
+ - match: '(\{)(php)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.php.latex source.php.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.php
+ - match: '(\{)(python|py)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.python
+ - match: '(\{)(r)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.r.latex source.r.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.r
+ - match: '(\{)(ruby)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.ruby.latex source.ruby.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.ruby
+ - match: '(\{)(sh|shell|bash )(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.shell.latex source.shell.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.shell
+ - match: '(\{)(sql|mysql|ddl|dml)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.sql.latex source.sql.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.sql
+ - match: '(\{)(yaml)(\})((\{)|(\W))'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: variable.parameter.function.latex
+ 3: punctuation.definition.group.brace.end.latex
+ 5: punctuation.definition.group.brace.begin.latex
+ 6: punctuation.definition.verb.latex
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.environment.verbatim.minted.latex
+ - meta_content_scope: meta.environment.embedded.yaml.latex source.yaml.embedded
+ - match: '(\})|(\4)'
+ captures:
+ 1: punctuation.definition.group.brace.begin.latex
+ 2: punctuation.definition.verb.latex
+ pop: true
+ - include: scope:source.yaml
+ - match: ''
pop: true
- - include: $top_level_main
- - match: '"<'
+
+ # comment package
+ pkgcomment:
+ - match: '^(\\)comment\b'
captures:
- 0: punctuation.definition.string.begin.latex
+ 0: punctuation.definition.comment.start.latex
+ 1: punctuation.definition.backslash.latex
push:
- - meta_scope: string.quoted.double.guillemot.latex
- - match: '">'
+ - meta_scope: meta.environment.comment.latex comment.block.command.comment.latex
+ - match: '^(\\)endcomment\b'
captures:
- 0: punctuation.definition.string.end.latex
+ 0: punctuation.definition.comment.end.latex
+ 1: punctuation.definition.backslash.latex
pop: true
- - include: $top_level_main
- - match: \\\(
+ - match: '((\\)begin)(\{)\s*(comment)\s*(\})'
captures:
- 0: punctuation.definition.string.begin.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: string.other.math.latex
- - match: \\\)
+ - meta_scope: meta.environment.comment.latex
+ - meta_content_scope: comment.block.environment.comment.latex
+ - match: '((\\)end)(\{)\s*(comment)\s*(\})'
captures:
- 0: punctuation.definition.string.end.latex
+ 1: support.function.end.latex keyword.control.flow.end.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
- - match: '\\\['
+
+ # beamer support
+ beamer:
+ - match: '((\\)begin)(\{)(frame)(\})'
captures:
- 0: punctuation.definition.string.begin.latex
+ 1: support.function.begin.latex keyword.control.flow.begin.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
push:
- - meta_scope: string.other.math.latex
- - match: '\\\]'
+ - meta_scope: meta.environment.frame.latex
+ - match: '((\\)end)(\{)(frame)(\})'
captures:
- 0: punctuation.definition.string.end.latex
+ 1: support.function.end.latex keyword.control.flow.end.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: variable.parameter.function.latex
+ 5: punctuation.definition.group.brace.end.latex
pop: true
- - include: $top_level_main
- - match: (?)(\{)\$(\})'
- scope: meta.column-specials.latex
+ - include: frametitles
+ - include: main
+
+ frametitles:
+ - match: '((\\)frametitle)(\{)(.*)(\})'
+ scope: meta.function.frametitle.latex
captures:
- 1: punctuation.definition.column-specials.begin.latex
- 2: punctuation.definition.column-specials.end.latex
- - include: scope:text.tex
+ 1: support.function.frametitle.latex
+ 2: punctuation.definition.backslash.latex
+ 3: punctuation.definition.group.brace.begin.latex
+ 4: entity.name.function.frame.latex
+ 5: punctuation.definition.group.brace.end.latex
diff --git a/LaTeX/Snippets/Item[description].sublime-snippet b/LaTeX/Snippets/Item[description].sublime-snippet
index 210b8fba52..60ee52bb1a 100644
--- a/LaTeX/Snippets/Item[description].sublime-snippet
+++ b/LaTeX/Snippets/Item[description].sublime-snippet
@@ -1,6 +1,6 @@
itd
- text.tex.latex meta.function.environment.list
+ text.tex.latex meta.environment.list
\item[description]
diff --git a/LaTeX/Symbol List - Commands.tmPreferences b/LaTeX/Symbol List - Commands.tmPreferences
new file mode 100644
index 0000000000..b5e7f119a8
--- /dev/null
+++ b/LaTeX/Symbol List - Commands.tmPreferences
@@ -0,0 +1,16 @@
+
+
+
+ name
+ Symbol List
+ scope
+ entity.name.newcommand.latex, entity.name.declare-math-operator.latex, entity.name.definition.tex
+ settings
+
+ showInSymbolList
+ 1
+ showInIndexedSymbolList
+ 1
+
+
+
diff --git a/LaTeX/Symbol List - Labels.tmPreferences b/LaTeX/Symbol List - Labels.tmPreferences
new file mode 100644
index 0000000000..6f435bf2eb
--- /dev/null
+++ b/LaTeX/Symbol List - Labels.tmPreferences
@@ -0,0 +1,16 @@
+
+
+
+ name
+ Symbol List
+ scope
+ entity.name.label.latex
+ settings
+
+ showInSymbolList
+ 1
+ showInIndexedSymbolList
+ 1
+
+
+
diff --git a/LaTeX/Symbol List - Sections.tmPreferences b/LaTeX/Symbol List - Sections.tmPreferences
new file mode 100644
index 0000000000..dcb4512121
--- /dev/null
+++ b/LaTeX/Symbol List - Sections.tmPreferences
@@ -0,0 +1,24 @@
+
+
+
+ name
+ Symbol List
+ scope
+ meta.section.latex
+ settings
+
+ showInSymbolList
+ 1
+ showInIndexedSymbolList
+ 1
+ symbolTransformation
+
+ s/\\((?:sub)*(?:paragraph|section|chapter|part)(?:\*)?)(?:\[[^\]]*\])?\{(.*)\}/\u$1: $2/g;
+
+ symbolIndexTransformation
+
+ s/\\((?:sub)*(?:paragraph|section|chapter|part)(?:\*)?)(?:\[[^\]]*\])?\{(.*)\}/\u$1: $2/g;
+
+
+
+
diff --git a/LaTeX/TeX Math.sublime-syntax b/LaTeX/TeX Math.sublime-syntax
deleted file mode 100644
index dcc282b48c..0000000000
--- a/LaTeX/TeX Math.sublime-syntax
+++ /dev/null
@@ -1,41 +0,0 @@
-%YAML 1.2
----
-# http://www.sublimetext.com/docs/3/syntax.html
-name: TeX Math
-file_extensions: []
-scope: text.tex.math
-contexts:
- main:
- - match: (\\)(s(s(earrow|warrow|lash)|h(ort(downarrow|uparrow|parallel|leftarrow|rightarrow|mid)|arp)|tar|i(gma|m(eq)?)|u(cc(sim|n(sim|approx)|curlyeq|eq|approx)?|pset(neq(q)?|plus(eq)?|eq(q)?)?|rd|m|bset(neq(q)?|plus(eq)?|eq(q)?)?)|p(hericalangle|adesuit)|e(tminus|arrow)|q(su(pset(eq)?|bset(eq)?)|c(up|ap)|uare)|warrow|m(ile|all(s(etminus|mile)|frown)))|h(slash|ook(leftarrow|rightarrow)|eartsuit|bar)|R(sh|ightarrow|e|bag)|Gam(e|ma)|n(s(hort(parallel|mid)|im|u(cc(eq)?|pseteq(q)?|bseteq))|Rightarrow|n(earrow|warrow)|cong|triangle(left(eq(slant)?)?|right(eq(slant)?)?)|i(plus)?|u|p(lus|arallel|rec(eq)?)|e(q|arrow|g|xists)|v(dash|Dash)|warrow|le(ss|q(slant|q)?|ft(arrow|rightarrow))|a(tural|bla)|VDash|rightarrow|g(tr|eq(slant|q)?)|mid|Left(arrow|rightarrow))|c(hi|irc(eq|le(d(circ|S|dash|ast)|arrow(left|right)))?|o(ng|prod|lon|mplement)|dot(s|p)?|u(p|r(vearrow(left|right)|ly(eq(succ|prec)|vee(downarrow|uparrow)?|wedge(downarrow|uparrow)?)))|enterdot|lubsuit|ap)|Xi|Maps(to(char)?|from(char)?)|B(ox|umpeq|bbk)|t(h(ick(sim|approx)|e(ta|refore))|imes|op|wohead(leftarrow|rightarrow)|a(u|lloblong)|riangle(down|q|left(eq(slant)?)?|right(eq(slant)?)?)?)|i(n(t(er(cal|leave))?|plus|fty)?|ota|math)|S(igma|u(pset|bset))|zeta|o(slash|times|int|dot|plus|vee|wedge|lessthan|greaterthan|m(inus|ega)|b(slash|long|ar))|d(i(v(ideontimes)?|a(g(down|up)|mond(suit)?)|gamma)|o(t(plus|eq(dot)?)|ublebarwedge|wn(harpoon(left|right)|downarrows|arrow))|d(ots|agger)|elta|a(sh(v|leftarrow|rightarrow)|leth|gger))|Y(down|up|left|right)|C(up|ap)|u(n(lhd|rhd)|p(silon|harpoon(left|right)|downarrow|uparrows|lus|arrow)|lcorner|rcorner)|jmath|Theta|Im|p(si|hi|i(tchfork)?|erp|ar(tial|allel)|r(ime|o(d|pto)|ec(sim|n(sim|approx)|curlyeq|eq|approx)?)|m)|e(t(h|a)|psilon|q(slant(less|gtr)|circ|uiv)|ll|xists|mptyset)|Omega|D(iamond|ownarrow|elta)|v(d(ots|ash)|ee(bar)?|Dash|ar(s(igma|u(psetneq(q)?|bsetneq(q)?))|nothing|curly(vee|wedge)|t(heta|imes|riangle(left|right)?)|o(slash|circle|times|dot|plus|vee|wedge|lessthan|ast|greaterthan|minus|b(slash|ar))|p(hi|i|ropto)|epsilon|kappa|rho|bigcirc))|kappa|Up(silon|downarrow|arrow)|Join|f(orall|lat|a(t(s(emi|lash)|bslash)|llingdotseq)|rown)|P(si|hi|i)|w(p|edge|r)|l(hd|n(sim|eq(q)?|approx)|ceil|times|ightning|o(ng(left(arrow|rightarrow)|rightarrow|maps(to|from))|zenge|oparrow(left|right))|dot(s|p)|e(ss(sim|dot|eq(qgtr|gtr)|approx|gtr)|q(slant|q)?|ft(slice|harpoon(down|up)|threetimes|leftarrows|arrow(t(ail|riangle))?|right(squigarrow|harpoons|arrow(s|triangle|eq)?))|adsto)|vertneqq|floor|l(c(orner|eil)|floor|l|bracket)?|a(ngle|mbda)|rcorner|bag)|a(s(ymp|t)|ngle|pprox(eq)?|l(pha|eph)|rrownot|malg)|V(dash|vdash)|r(h(o|d)|ceil|times|i(singdotseq|ght(s(quigarrow|lice)|harpoon(down|up)|threetimes|left(harpoons|arrows)|arrow(t(ail|riangle))?|rightarrows))|floor|angle|r(ceil|parenthesis|floor|bracket)|bag)|g(n(sim|eq(q)?|approx)|tr(sim|dot|eq(qless|less)|less|approx)|imel|eq(slant|q)?|vertneqq|amma|g(g)?)|Finv|xi|m(ho|i(nuso|d)|o(o|dels)|u(ltimap)?|p|e(asuredangle|rge)|aps(to|from(char)?))|b(i(n(dnasrepma|ampersand)|g(s(tar|qc(up|ap))|nplus|c(irc|u(p|rly(vee|wedge))|ap)|triangle(down|up)|interleave|o(times|dot|plus)|uplus|parallel|vee|wedge|box))|o(t|wtie|x(slash|circle|times|dot|plus|empty|ast|minus|b(slash|ox|ar)))|u(llet|mpeq)|e(cause|t(h|ween|a))|lack(square|triangle(down|left|right)?|lozenge)|a(ck(s(im(eq)?|lash)|prime|epsilon)|r(o|wedge))|bslash)|L(sh|ong(left(arrow|rightarrow)|rightarrow|maps(to|from))|eft(arrow|rightarrow)|leftarrow|ambda|bag)|Arrownot)\b
- scope: constant.character.math.tex
- captures:
- 1: punctuation.definition.constant.math.tex
- - match: (\\)(sum|prod|coprod|int|oint|bigcap|bigcup|bigsqcup|bigvee|bigwedge|bigodot|bigotimes|bogoplus|biguplus)\b
- scope: constant.character.math.tex
- captures:
- 1: punctuation.definition.constant.math.tex
- - match: (\\)(arccos|arcsin|arctan|arg|cos|cosh|cot|coth|csc|deg|det|dim|exp|gcd|hom|inf|ker|lg|lim|liminf|limsup|ln|log|max|min|pr|sec|sin|sinh|sup|tan|tanh)\b
- scope: constant.other.math.tex
- captures:
- 1: punctuation.definition.constant.math.tex
- - match: '((\\)Sexpr)(\{)'
- captures:
- 1: support.function.sexpr.math.tex
- 2: punctuation.definition.function.math.tex
- 3: punctuation.section.embedded.begin.math.tex
- push:
- - meta_scope: meta.function.sexpr.math.tex
- - meta_content_scope: source.r.embedded.math.tex
- - match: '(\})'
- captures:
- 1: punctuation.section.embedded.end.math.tex
- pop: true
- - include: scope:source.r
- - match: '(\\)([^a-zA-Z]|[A-Za-z]+)(?=\b|\}|\]|\^|\_)'
- scope: constant.other.general.math.tex
- captures:
- 1: punctuation.definition.constant.math.tex
- - match: '(([0-9]*[\.][0-9]+)|[0-9]+)'
- scope: constant.numeric.math.tex
- - match: "«press a-z and space for greek letter»[a-zA-Z]*"
- scope: meta.placeholder.greek.math.tex
diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax
index 7ced7ce42d..51c458a496 100644
--- a/LaTeX/TeX.sublime-syntax
+++ b/LaTeX/TeX.sublime-syntax
@@ -7,73 +7,183 @@ file_extensions:
- cls
scope: text.tex
contexts:
+ prototype:
+ - include: comments
+
main:
- - match: (\\)(backmatter|else|fi|frontmatter|ftrue|mainmatter|if(case|cat|dim|eof|false|hbox|hmode|inner|mmode|num|odd|undefined|vbox|vmode|void|x)?)\b
- scope: keyword.control.tex
- captures:
- 1: punctuation.definition.keyword.tex
- - match: ((\\)catcode)`(?:\\)?.(=)(\d+)
- scope: meta.catcode.tex
+ - include: macros
+ - include: controls
+ - include: catcode
+ - include: braces
+ - include: boxes
+ - include: block-math
+ - include: inline-math
+ - include: general-constants
+ - include: general-commands
+
+ general-commands:
+ - match: '(\\)[A-Za-z@]+'
+ scope: support.function.general.tex
captures:
- 1: keyword.control.catcode.tex
- 2: punctuation.definition.keyword.tex
- 3: punctuation.separator.key-value.tex
- 4: constant.numeric.category.tex
- - match: (%:).*$\n?
- scope: comment.line.percentage.semicolon.texshop.tex
+ 1: punctuation.definition.backslash.tex
+
+ general-constants:
+ - match: \\\\
+ scope: constant.character.newline.tex
+ - match: '(\\)[^A-Za-z@]'
+ scope: constant.character.escape.tex
captures:
- 1: punctuation.definition.comment.tex
- - match: ^%!TEX (\S*) =\s*(.*)\s*$
- scope: comment.line.percentage.directive.texshop.tex
- - match: (%).*$\n?
+ 1: punctuation.definition.backslash.tex
+ - match: '&'
+ scope: constant.character.ampersand.tex
+ - match: '~'
+ scope: constant.character.space.tex
+
+ comments:
+ - match: '%.*$\n?'
scope: comment.line.percentage.tex
+
+ controls:
+ - match: ((\\)(else|fi|ftrue|if(case|cat|dim|eof|false|hbox|hmode|inner|mmode|num|odd|undefined|vbox|vmode|void|x)?))\b
captures:
- 1: punctuation.definition.comment.tex
- - match: '\{'
+ 1: keyword.control.tex
+ 2: punctuation.definition.backslash.tex
+ - match: '((\\)(?:input))\b'
+ scope: meta.function.input.tex
+ captures:
+ 1: keyword.control.input.tex
+ 2: punctuation.definition.backslash.tex
+
+ catcode:
+ - match: ((\\)catcode)`(?:\\)?.=(\d+)
+ scope: meta.function.catcode.tex
captures:
- 0: punctuation.section.group.tex
+ 1: keyword.control.catcode.tex
+ 2: punctuation.definition.backslash.tex
+ 3: constant.numeric.category.tex
+
+ braces:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.tex
push:
- - meta_scope: meta.group.braces.tex
+ - meta_scope: meta.group.brace.tex
- match: '\}'
- captures:
- 0: punctuation.section.group.tex
+ scope: punctuation.definition.group.brace.end.tex
pop: true
- - include: $top_level_main
- - match: '[\[\]]'
- scope: punctuation.definition.brackets.tex
- - match: \$\$
+ - include: main
+
+ macro-braces:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.tex
+ push:
+ - meta_scope: meta.group.brace.tex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.tex
+ pop: true
+ - include: general-constants
+ - include: general-commands
+ - include: macro-braces
+
+ boxes:
+ - match: '((\\)[hv]box)\s*(\{)'
captures:
- 0: punctuation.definition.string.begin.tex
+ 1: support.function.box.tex
+ 2: punctuation.definition.backslash.tex
+ 3: punctuation.definition.group.brace.begin.tex
push:
- - meta_scope: string.other.math.block.tex
- - match: \$\$
- captures:
- 0: punctuation.definition.string.end.tex
+ - meta_scope: meta.function.box.tex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.tex
pop: true
- - include: scope:text.tex.math
- include: main
- - match: \\\\
- scope: constant.character.newline.tex
- - match: \$
+
+ macros:
+ - match: '(\\def)\s*((\\)[A-Za-z@]+)\s*[^\{]*?\s*(\{)'
captures:
- 0: punctuation.definition.string.begin.tex
+ 1: support.function.definition.tex storage.modifier.definition.tex
+ 2: support.function.general.tex entity.name.definition.tex
+ 3: punctuation.definition.backslash.tex
+ 4: punctuation.definition.group.brace.begin.tex
push:
- - meta_scope: string.other.math.tex
- - match: \$
- captures:
- 0: punctuation.definition.string.end.tex
+ - meta_scope: meta.function.definition.tex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.tex
pop: true
- - match: \\\$
- scope: constant.character.escape.tex
- - include: scope:text.tex.math
- - include: main
- - match: '(\\)[A-Za-z@]+'
- scope: support.function.general.tex
+ - include: general-constants
+ - include: general-commands
+ - include: macro-braces
+
+ greeks:
+ - match: ((\\)(alpha|beta|gamma|delta|epsilon|varepsilon|zeta|eta|theta|vartheta|gamma|kappa|lambda|mu|nu|xi|pi|varpi|rho|varrho|sigma|varsigma|tau|upsilon|phi|varphi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega))\b
captures:
- 1: punctuation.definition.function.tex
- - match: '(\\)[^a-zA-Z@]'
- scope: constant.character.escape.tex
+ 1: keyword.other.greek.math.tex
+ 2: punctuation.definition.backslash.tex
+
+ math-commands:
+ - match: '((\\)[A-Za-z@]+)'
captures:
- 1: punctuation.definition.keyword.tex
- - match: "«press a-z and space for greek letter»[a-zA-Z]*"
- scope: meta.placeholder.greek.tex
+ 1: support.function.math.tex
+ 2: punctuation.definition.backslash.tex
+
+ math-operators:
+ - match: \+|\-|=|-|\*|/|\^|_|<|>
+ scope: keyword.operator.math.tex
+
+ math-braces:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.tex
+ push:
+ - meta_scope: meta.group.brace.tex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.tex
+ pop: true
+ - include: math-content
+
+ math-brackets:
+ - match: '[\(\)]'
+ scope: constant.character.parenthesis.tex
+ - match: '[\[\]]'
+ scope: constant.character.bracket.tex
+ - match: '(\\)[\{\}]'
+ scope: constant.character.brace.escape.tex
+ captures:
+ 1: punctuation.definition.backslash.brace.escape.tex
+
+ math-numerics:
+ - match: '(([[:digit:]]*\.[[:digit:]]+)|[[:digit:]]+)'
+ scope: constant.numeric.math.tex
+
+ math-characters:
+ - match: "[A-Za-z]+"
+ scope: variable.other.math.tex
+
+ math-content:
+ - include: greeks
+ - include: math-brackets
+ - include: math-braces
+ - include: boxes
+ - include: math-commands
+ - include: math-operators
+ - include: math-characters
+ - include: math-numerics
+ - include: general-constants
+
+ inline-math:
+ - match: \$
+ scope: string.other.math.tex punctuation.definition.string.begin.tex
+ push:
+ - meta_scope: meta.environment.math.inline.dollar.tex
+ - match: \$
+ scope: string.other.math.tex punctuation.definition.string.end.tex
+ pop: true
+ - include: math-content
+
+ block-math:
+ - match: \$\$
+ scope: string.other.math.tex punctuation.definition.string.begin.tex
+ push:
+ - meta_scope: meta.environment.math.block.dollar.tex
+ - match: \$\$
+ scope: string.other.math.tex punctuation.definition.string.end.tex
+ pop: true
+ - include: math-content
diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex
new file mode 100644
index 0000000000..a40da1e69c
--- /dev/null
+++ b/LaTeX/syntax_test_latex.tex
@@ -0,0 +1,336 @@
+% SYNTAX TEST "Packages/LaTeX/LaTeX.sublime-syntax"
+
+% <- text.tex.latex
+
+\documentclass[12pt]{article}
+% ^ keyword.control.preamble.latex
+% ^ support.class.latex
+
+\usepackage[args]{mypackage, anotherpackage}
+% ^ keyword.control.preamble.latex
+% ^ support.class.latex
+% ^ -support.class.latex
+% ^ support.class.latex
+
+\usepackage[pdftex,
+ %plainpages={false},
+% ^ comment.line
+ bookmarks=true,
+% ^ variable.parameter
+ unicode=true,
+ bookmarksnumbered={true},
+ % pagebackref=true,
+ breaklinks=true,
+ pdfstartview={FitBH}]{hyperref}
+% ^ support.class.latex
+
+% line comment
+% <- comment.line.percentage.tex
+
+\begin{document}
+% ^ support.function.begin.latex keyword.control.flow.begin.latex
+% ^ variable.parameter.function.latex
+
+% SECTION COMMANDS
+
+\part{name}
+% <- meta.section.latex
+% ^ support.function.section.latex
+% ^ entity.name.section.latex
+\chapter{name}
+% <- meta.section.latex
+% ^ support.function.section.latex
+% ^ entity.name.section.latex
+\section{name}
+% <- meta.section.latex
+% ^ support.function.section.latex
+% ^ entity.name.section.latex
+\subsection{name}
+% <- meta.section.latex
+% ^ support.function.section.latex
+% ^ entity.name.section.latex
+\subsubsection{name}
+% <- meta.section.latex
+% ^ support.function.section.latex
+% ^ entity.name.section.latex
+\paragraph{name}
+% <- meta.section.latex
+% ^ support.function.section.latex
+% ^ entity.name.section.latex
+\subparagraph{name}
+% <- meta.section.latex
+% ^ support.function.section.latex
+% ^ entity.name.section.latex
+
+
+% REF/LABEL/CITE COMMANDS
+
+\label{sec:name}
+% ^ meta.function.label.latex
+% ^ support.function.label.latex
+% ^ entity.name
+
+\ref{sec:name}
+% ^ meta.function.reference.latex
+% ^ support.function.reference.latex keyword.other.reference.latex
+% ^ constant.other.reference
+
+\cite{my:bib:key}
+% ^ meta.function.citation.latex
+% ^ support.function.cite.latex keyword.other.cite.latex
+% ^ constant.other.citation
+
+
+\cite[\command]{my:bib:key}
+% ^ meta.function.citation.latex
+% ^ support.function.cite.latex
+% ^ support.function
+%
+
+
+% URL COMMAND
+
+\url{https://www.sublimetext.com/}
+% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.link.url.latex
+% ^ support.function.url.latex
+% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.latex
+
+\href{https://www.sublimetext.com/}
+% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.link.url.latex
+% ^ support.function.url.latex
+% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.latex
+
+
+% INCLUDE COMMANDS
+
+\include{path/to/file}
+% ^ meta.function.include.latex
+% ^ keyword.control.include.latex
+
+\includeonly{path/to/file.tex}
+% ^ meta.function.include.latex
+% ^ keyword.control.include.latex
+
+\input{path/to/file.tex}
+% ^ meta.function.input.tex
+% ^ keyword.control.input.tex
+
+\includecommand{...}
+% ^^^^^^^^^^ support.function.general.latex
+
+\inputminted{py}{path/to/file.py}
+% ^^^^^^^^^^ support.function.general.latex
+
+
+% MARKUP COMMANDS
+
+\emph{text}
+% ^ markup.italic.emph.latex
+\textbf{text}
+% ^ markup.bold.textbf.latex
+\textit{text}
+% ^ markup.italic.textit.latex
+\texttt{text}
+% ^ markup.raw.texttt.latex
+\textsl{text}
+% ^ markup.italic.textsl.latex
+\textbf{\textit{text}}
+% ^ markup.bold.textbf.latex markup.italic.textit.latex
+\textit{\textbf{text}}
+% ^ markup.italic.textit.latex markup.bold.textbf.latex
+\underline{text}
+% ^ markup.underline.underline.latex
+
+
+% LIST ENVIRONMENTS
+
+\begin{itemize}
+\item first item
+% <- meta.environment.list.itemize.latex
+\end{itemize}
+
+\begin{enumerate}
+\item first item
+% <- meta.environment.list.enumerate.latex
+\end{enumerate}
+
+\begin{description}
+\item[item] description of item
+% <- meta.environment.list.description.latex
+\end{description}
+
+\begin{list}{(\arabic{listcounter})}{\usecounter{listcounter}}
+\item first item
+% <- meta.environment.list.list.latex
+\end{list}
+
+% VERBATIM
+
+\command{}
+% ^ support.function.general.latex
+\verb|\command{}|
+% ^ markup.raw.verb.latex
+% ^ meta.environment.verbatim.verb.latex
+% ^ - support.function.general.latex
+\verb+\command{}+
+% ^ markup.raw.verb.latex
+% ^ meta.environment.verbatim.verb.latex
+% ^ - support.function.general.latex
+
+\begin{verbatim}
+% ^ support.function.begin.latex keyword.control.flow.begin.latex
+% ^ variable.parameter.function.latex
+The \emph{verbatim} environment sets everything in verbatim.
+% <- meta.environment.verbatim.verbatim.latex
+% ^ markup.raw.verbatim.latex
+% ^ - markup.italic.emph.latex
+\command{}
+% ^ - support.function.general.latex
+% This is not a comment
+% <- - comment.line.percentage.tex
+\end{verbatim}
+
+
+% COMMANDS INSIDE ARGUMENTS
+
+\makebox[\linewidth]{...}
+% ^ support.function.box.latex
+% ^ support.function.general.latex
+
+\includegraphics[width=0.33\textwidth, angle=30]{test.png}
+% ^ support.function.includegraphics.latex
+% ^ support.function.general.latex
+
+
+% MATH
+
+% Check we have always a shared environment
+
+$f(x) = x^2$
+% ^ meta.environment.math.inline
+$$f(x) = x^2$$
+% ^ meta.environment.math.block
+\(f(x) = x^2\)
+% ^ meta.environment.math.inline
+\[
+ f(x) = x^2 \text{ $f$ is a function}
+% ^ meta.environment.math.block
+\]
+\ensuremath{f(x) = x^2}
+% ^ meta.environment.math.inline
+\begin{equation}
+f(x) = x^2
+% ^ meta.environment.math.block
+\end{equation}
+
+
+% Boxes
+\mbox{text}{text}
+% ^ meta.function.box.latex
+% ^ -meta.function.box.latex
+\parbox{text}{text}
+% ^ meta.function.box.latex
+% ^ meta.function.box.latex
+
+
+% PACKAGE: comment
+% The comment package can be used to write block comment
+% using an environment.
+
+\begin{comment}
+% ^ support.function.begin.latex keyword.control.flow.begin.latex
+% ^ variable.parameter.function.latex
+This environment can be used to write
+% <- comment.block.environment.comment.latex
+block comments.
+% <- comment.block.environment.comment.latex
+\end{comment}
+
+
+\comment
+% <- comment.block.command.comment.latex
+% ^ punctuation.definition.comment.start.latex
+This block comment can be done with
+% <- comment.block.command.comment.latex
+opening and closing commands.
+% <- comment.block.command.comment.latex
+\endcomment
+% <- comment.block.command.comment.latex
+% ^ punctuation.definition.comment.end.latex
+
+
+% PACKAGE: listings
+% The listings package is used to highlight source code.
+% Supported languages:
+% - python
+% - java
+
+\begin{lstlisting} % python
+def my_function():
+ pass
+% <- meta.environment.verbatim.lstlisting.latex
+% <- meta.environment.embedded.python.latex
+% <- source.python.embedded
+% ^ keyword.control.flow.python
+\end{lstlisting}
+
+\begin{lstlisting}[frame=single,
+ language=python] %python
+def my_function():
+ pass
+% <- meta.environment.verbatim.lstlisting.latex
+% <- meta.environment.embedded.python.latex
+% <- source.python.embedded
+% ^ keyword.control.flow.python
+\end{lstlisting}
+
+\begin{lstlisting} %java
+class MyClass() {
+% <- meta.environment.verbatim.lstlisting.latex
+% <- meta.environment.embedded.java.latex
+% <- source.java.embedded
+% ^ storage.modifier.java
+}
+\end{lstlisting}
+
+
+% PACKAGE: minted
+% The minted package is used to highlight source code using
+% the Pygments library.
+
+\begin{minted}[linenos=true]{python}
+def my_function():
+ pass
+% <- meta.environment.verbatim.minted.latex
+% <- meta.environment.embedded.python.latex
+% <- source.python.embedded
+% ^ keyword.control.flow.python
+\end{minted}
+
+
+\mint{python}{import this}
+% ^ meta.environment.verbatim.minted.latex
+% ^ meta.environment.embedded.python.latex
+% ^ source.python.embedded
+% ^ keyword.control.import.python
+
+% instead of embedding the code into { and } it is also possible
+% to use an arbitrary character
+\mint{python}|import this|
+% ^ meta.environment.verbatim.minted.latex
+% ^ source.python.embedded
+
+
+\mintinline{python}{print(x ** 2)}
+% ^ meta.environment.verbatim.minted.latex
+% ^ meta.environment.embedded.python.latex
+% ^ source.python.embedded
+% ^ keyword.other.python
+
+\mintinline{python}+print(x ** 2)+
+% ^ source.python.embedded
+
+
+\end{document}
+% ^ support.function.end.latex keyword.control.flow.end.latex
+% ^ variable.parameter.function.latex
diff --git a/R/Rd (R Documentation).sublime-syntax b/R/Rd (R Documentation).sublime-syntax
index 84762c8dc8..804364bc9f 100644
--- a/R/Rd (R Documentation).sublime-syntax
+++ b/R/Rd (R Documentation).sublime-syntax
@@ -6,66 +6,140 @@ file_extensions:
- rd
scope: text.tex.latex.rd
contexts:
+ prototype:
+ - include: scope:text.tex.latex#comments
+
main:
- - match: '((\\)(?:alias|docType|keyword|name|title))(\{)'
- captures:
- 1: keyword.other.section.rd
- 2: punctuation.definition.function.rd
- 3: punctuation.definition.arguments.begin.rd
+ - include: rd-stucture
+ - include: r-code
+ - include: latex-equations
+ - include: scope:text.tex.latex#plain-tex
+ - include: scope:text.tex.latex#begin-end-commands
+ - include: scope:text.tex.latex#general-commands
+ - include: global-braces
+
+ global-braces:
+ - match: '\{'
+ scope: punctuation.definition.group.brace.begin.latex
push:
- - meta_scope: meta.section.rd
- - meta_content_scope: entity.name.tag.rd
- - match: '(\})'
- captures:
- 1: punctuation.definition.arguments.end.rd
+ - meta_scope: meta.group.brace.latex
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.latex
pop: true
- include: main
- - match: '((\\)(?:details|format|references|source))(\{)'
+
+ latex-equations:
+ - include: deqn
+ - include: eqn
+
+ deqn:
+ - match: '((\\)(?:deqn))(\{)'
captures:
- 1: keyword.other.section.rd
- 2: punctuation.definition.function.rd
- 3: punctuation.definition.arguments.begin.rd
+ 1: support.function.deqn.rd
+ 2: punctuation.definition.backslash.rd
+ 3: punctuation.definition.group.brace.begin.rd
push:
- - meta_scope: meta.section.rd
- - match: '(\})'
- captures:
- 1: punctuation.definition.arguments.end.rd
+ - meta_scope: meta.function.deqn.rd
+ - meta_content_scope: meta.environment.math
+ - include: scope:text.tex.latex#math-content
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.rd
pop: true
- - include: main
+
+ eqn:
+ - match: '((\\)(?:eqn))(\{)'
+ captures:
+ 1: support.function.eqn.rd
+ 2: punctuation.definition.backslash.rd
+ 3: punctuation.definition.group.brace.begin.rd
+ push:
+ - meta_scope: meta.function.eqn.rd
+ - meta_content_scope: meta.environment.math
+ - include: scope:text.tex.latex#math-content
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.rd
+ pop: true
+
+ r-code:
+ - match: '((\\)(?:code))(\{)'
+ captures:
+ 1: support.function.code.rd
+ 2: punctuation.definition.backslash.rd
+ 3: punctuation.definition.group.brace.begin.rd
+ push:
+ - meta_scope: meta.function.code.rd
+ - meta_content_scope: source.r.embedded
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.rd
+ pop: true
+ - match: \\%
+ - include: scope:source.r
+ - match: '((\\)(?:Sexpr))(?:(\[)(?:[^\]]*)(\]))?(\{)'
+ captures:
+ 1: support.function.sexpr.rd
+ 2: punctuation.definition.backslash.rd
+ 3: punctuation.definition.group.bracket.begin.rd
+ 4: punctuation.definition.group.bracket.end.rd
+ 5: punctuation.definition.group.brace.begin.rd
+ push:
+ - meta_scope: meta.function.sexpr.rd
+ - meta_content_scope: source.r.embedded
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.rd
+ pop: true
+ - match: \\%
+ - include: scope:source.r
- match: '((\\)(?:usage))(\{)(?:\n)?'
captures:
- 1: keyword.other.usage.rd
- 2: punctuation.definition.function.rd
- 3: punctuation.definition.arguments.begin.rd
+ 1: support.function.usage.rd
+ 2: punctuation.definition.backslash.rd
+ 3: punctuation.definition.group.brace.begin.rd
push:
- - meta_scope: meta.usage.rd
+ - meta_scope: meta.function.usage.rd
- meta_content_scope: source.r.embedded
- - match: '(\})'
- captures:
- 1: punctuation.definition.arguments.end.rd
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.rd
pop: true
+ - match: \\%
- include: scope:source.r
- match: '((\\)(?:examples))(\{)(?:\n)?'
captures:
- 1: keyword.other.examples.rd
- 2: punctuation.definition.function.rd
- 3: punctuation.definition.arguments.begin.rd
+ 1: support.function.examples.rd
+ 2: punctuation.definition.backslash.rd
+ 3: punctuation.definition.group.brace.begin.rd
push:
- - meta_scope: meta.examples.rd
+ - meta_scope: meta.function.examples.rd
- meta_content_scope: source.r.embedded
+ - match: '\}'
+ scope: punctuation.definition.group.brace.end.rd
+ pop: true
+ - match: \\%
+ - include: scope:source.r
+
+ rd-stucture:
+ - match: '((\\)name)(\{)'
+ captures:
+ 1: keyword.other.section.rd
+ 2: punctuation.definition.function.rd
+ 3: punctuation.definition.group.brace.begin.rd
+ push:
+ - meta_scope: meta.section.rd
+ - meta_content_scope: entity.name.function.rd
- match: '(\})'
captures:
- 1: punctuation.definition.arguments.end.rd
+ 1: punctuation.definition.group.brace.end.rd
pop: true
- - include: scope:source.r
- - match: '((\\)(?:author))(\{)([\w\s]+?)\s+(<)([^>]*)(>)'
- scope: meta.author.rd
+ - include: main
+
+ - match: '((\\)(?:alias|docType|keyword|title))(\{)'
captures:
- 1: keyword.other.author.rd
+ 1: keyword.other.section.rd
2: punctuation.definition.function.rd
- 3: punctuation.definition.arguments.begin.rd
- 4: entity.name.tag.author.rd
- 5: punctuation.definition.link.rd
- 6: markup.underline.link.rd
- 7: punctuation.definition.link.rd
- - include: scope:text.tex.latex
+ 3: punctuation.definition.group.brace.begin.rd
+ push:
+ - meta_scope: meta.section.rd
+ - match: '(\})'
+ captures:
+ 1: punctuation.definition.group.brace.end.rd
+ pop: true
+ - include: main