%YAML 1.2 --- # http://www.sublimetext.com/docs/3/syntax.html name: TeX file_extensions: - sty - cls scope: text.tex contexts: prototype: - include: comments main: - 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: 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.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: 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: 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.brace.tex - match: '\}' scope: punctuation.definition.group.brace.end.tex pop: true - 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: 1: support.function.box.tex 2: punctuation.definition.backslash.tex 3: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.function.box.tex - match: '\}' scope: punctuation.definition.group.brace.end.tex pop: true - include: main macros: - match: '(\\def)\s*((\\)[A-Za-z@]+)\s*[^\{]*?\s*(\{)' captures: 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: meta.function.definition.tex - match: '\}' scope: punctuation.definition.group.brace.end.tex pop: true - include: general-constants - include: general-commands - include: macro-braces greeks: - match: ((\\)(alpha|beta|gamma|delta|epsilon|varepsilon|zeta|eta|theta|vartheta|iota|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: keyword.other.greek.math.tex 2: punctuation.definition.backslash.tex math-commands: - match: '((\\)[A-Za-z@]+)' captures: 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