Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LaTeX] Add support for IEEEarray environments #4123

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions LaTeX/LaTeX.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -634,16 +634,31 @@ contexts:
4: variable.parameter.function.latex
5: punctuation.definition.group.brace.end.tex
push: block-math-begin-end-command-body
- match: |-
(?x)
((\\)begin)
\s* (\{) \s* ( IEEEeqnarray\*? ) \s* (\})
(?: \s* (\{) \s* ( {{letter}}+ ) \s* (\}) )?
captures:
1: support.function.begin.latex keyword.control.flow.begin.latex
2: punctuation.definition.backslash.latex
3: punctuation.definition.group.brace.begin.tex
4: variable.parameter.function.latex
5: punctuation.definition.group.brace.end.tex
6: punctuation.definition.group.brace.begin.tex
7: variable.parameter.function.latex
8: punctuation.definition.group.brace.end.tex
push: block-math-begin-end-command-body

block-math-begin-end-command-body:
- meta_content_scope: meta.environment.math.block.be.latex markup.math.block
- meta_content_scope: meta.environment.math.block.latex markup.math.block
- include: block-math-begin-end-command-end
- include: math-content

block-math-begin-end-command-end:
- match: ((\\)end)(\{)\s*(\4)\s*(\})
captures:
1: support.function.end.latex keyword.control.flow.begin.latex
1: support.function.end.latex keyword.control.flow.end.latex
2: punctuation.definition.backslash.latex
3: punctuation.definition.group.brace.begin.tex
4: variable.parameter.function.latex
Expand Down
61 changes: 54 additions & 7 deletions LaTeX/tests/syntax_test_latex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,13 @@ \subsubsection{name}
% ^^^^^^^^^^ markup.math.inline - string
% ^ punctuation.definition.string.end.tex - markup.math.inline

$\verb!$! \alpha$
%^ meta.environment.math.inline.dollar.tex string.other.math.tex punctuation.definition.string.begin.tex
% ^^^^^^^^^^^^^^^ meta.environment.math.inline.dollar.tex markup.math.inline
% ^ markup.raw.verb.latex
% ^^^^^^ keyword.other.math.greek.tex
% ^ meta.environment.math.inline.dollar.tex string.other.math.tex punctuation.definition.string.end.tex

$$f(x) = x^2$$
%^^ string.other.math.tex punctuation.definition.string.begin.tex
%^^^^^^^^^^^^^^ meta.environment.math.block.dollar.tex
Expand Down Expand Up @@ -838,21 +845,61 @@ \subsubsection{name}
% ^^^^^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex
f(x) = x^2
% <- meta.environment.math.block.be.latex variable.other.math.tex
% <- meta.environment.math.block.latex variable.other.math.tex
%^^^^^^^^^ meta.environment.math.block
\end{equation}
% <- support.function.end.latex keyword.control.flow.begin.latex punctuation.definition.backslash.latex
%^^^ support.function.end.latex keyword.control.flow.begin.latex
% <- support.function.end.latex keyword.control.flow.end.latex punctuation.definition.backslash.latex
%^^^ support.function.end.latex keyword.control.flow.end.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex

\begin{equation*}
% <- support.function.begin.latex keyword.control.flow.begin.latex punctuation.definition.backslash.latex
%^^^^^ support.function.begin.latex keyword.control.flow.begin.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^^^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex
f(x) = x^2
% <- meta.environment.math.block.latex variable.other.math.tex
%^^^^^^^^^ meta.environment.math.block
\end{equation*}
% <- support.function.end.latex keyword.control.flow.end.latex punctuation.definition.backslash.latex
%^^^ support.function.end.latex keyword.control.flow.end.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^^^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex

$\verb!$! \alpha$
%^^^^^^^^^^^^^^^ meta.environment.math.inline.dollar.tex markup.math.inline
% ^ markup.raw.verb.latex
% ^^^^^^ keyword.other.math.greek.tex
\begin{IEEEeqnarray}
%^^^^^ support.function.begin.latex keyword.control.flow.begin.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^^^^^^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex
f(x) = x^2
% <- meta.environment.math.block.latex variable.other.math.tex
%^^^^^^^^^ meta.environment.math.block
\end{IEEEeqnarray}
%^^^ support.function.end.latex keyword.control.flow.end.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^^^^^^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex

\begin{IEEEeqnarray}{c}
%^^^^^ support.function.begin.latex keyword.control.flow.begin.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^^^^^^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex
% ^ punctuation.definition.group.brace.begin.tex
% ^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex
f(x) = x^2
% <- meta.environment.math.block.latex variable.other.math.tex
%^^^^^^^^^ meta.environment.math.block
\end{IEEEeqnarray}
%^^^ support.function.end.latex keyword.control.flow.end.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^^^^^^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.tex

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Boxes
Expand Down
Loading