summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--queries/latex/folds.scm1
-rw-r--r--queries/latex/highlights.scm102
2 files changed, 42 insertions, 61 deletions
diff --git a/queries/latex/folds.scm b/queries/latex/folds.scm
index 6769b2e6..07505c37 100644
--- a/queries/latex/folds.scm
+++ b/queries/latex/folds.scm
@@ -8,6 +8,7 @@
(subparagraph)
(generic_environment)
+ (math_environment)
(comment_environment)
(displayed_equation)
] @fold
diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm
index bfa3edbc..e1772ca1 100644
--- a/queries/latex/highlights.scm
+++ b/queries/latex/highlights.scm
@@ -32,35 +32,11 @@
;; General environments
(begin
command: _ @text.environment
- name: (curly_group_text
- (text) @text.environment.name)
- (#not-any-of? @text.environment.name
- "displaymath" "displaymath*"
- "equation" "equation*"
- "multline" "multline*"
- "eqnarray" "eqnarray*"
- "align" "align*"
- "array" "array*"
- "split" "split*"
- "alignat" "alignat*"
- "gather" "gather*"
- "flalign" "flalign*"))
+ name: (curly_group_text (text) @text.environment.name))
(end
command: _ @text.environment
- name: (curly_group_text
- (text) @text.environment.name)
- (#not-any-of? @text.environment.name
- "displaymath" "displaymath*"
- "equation" "equation*"
- "multline" "multline*"
- "eqnarray" "eqnarray*"
- "align" "align*"
- "array" "array*"
- "split" "split*"
- "alignat" "alignat*"
- "gather" "gather*"
- "flalign" "flalign*"))
+ name: (curly_group_text (text) @text.environment.name))
;; Definitions and references
(new_command_definition
@@ -73,10 +49,18 @@
command: _ @function.macro
declaration: (_) @function)
+(environment_definition
+ command: _ @function.macro
+ name: (curly_group_text (_) @text.reference))
+
(theorem_definition
command: _ @function.macro
name: (curly_group_text (_) @text.environment.name))
+(paired_delimiter_definition
+ command: _ @function.macro
+ declaration: (curly_group_command_name (_) @function))
+
(label_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
@@ -121,69 +105,65 @@
[
(displayed_equation)
(inline_formula)
+ (math_set)
] @text.math
-((generic_environment
+(math_environment
(begin
command: _ @text.math
- name: (curly_group_text
- (text) @_env))) @text.math
- (#any-of? @_env
- "displaymath" "displaymath*"
- "equation" "equation*"
- "multline" "multline*"
- "eqnarray" "eqnarray*"
- "align" "align*"
- "array" "array*"
- "split" "split*"
- "alignat" "alignat*"
- "gather" "gather*"
- "flalign" "flalign*"))
-((generic_environment
+ name: (curly_group_text (text) @text.math)))
+
+(math_environment
(end
command: _ @text.math
- name: (curly_group_text
- (text) @_env))) @text.math
- (#any-of? @_env
- "displaymath" "displaymath*"
- "equation" "equation*"
- "multline" "multline*"
- "eqnarray" "eqnarray*"
- "align" "align*"
- "array" "array*"
- "split" "split*"
- "alignat" "alignat*"
- "gather" "gather*"
- "flalign" "flalign*"))
+ name: (curly_group_text (text) @text.math)))
;; Sectioning
+(title_declaration
+ command: _ @namespace
+ options: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
+
+(author_declaration
+ command: _ @namespace
+ authors: (curly_group_author_list
+ ((command_name)? @function)
+ ((author)+ @text.title)))
+
(chapter
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(part
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(section
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(subsection
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(subsubsection
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(paragraph
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(subparagraph
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
;; Beamer frames
(generic_environment