Skip to content

Commit

Permalink
Ignore all {}/[] arguments after \begin{env}
Browse files Browse the repository at this point in the history
  • Loading branch information
valentjn committed Sep 25, 2019
1 parent d742140 commit 59c6008
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,26 @@ public LatexAnnotatedTextBuilder addCode(String text) throws InterruptedExceptio
preserveDummyLast = true;
addMarkup(argument, interpretAs);

if (environment.equals("tabular")) {
String environmentArgument = LatexCommandSignature.matchArgumentFromPosition(
text, pos, LatexCommandSignature.ArgumentType.BRACE);
addMarkup(environmentArgument);
if (command.equals("\\begin")) {
while (pos < text.length()) {
if (Thread.currentThread().isInterrupted()) throw new InterruptedException();

String environmentArgument = LatexCommandSignature.matchArgumentFromPosition(
text, pos, LatexCommandSignature.ArgumentType.BRACE);

if (!environmentArgument.isEmpty()) {
addMarkup(environmentArgument);
} else {
environmentArgument = LatexCommandSignature.matchArgumentFromPosition(
text, pos, LatexCommandSignature.ArgumentType.BRACKET);

if (!environmentArgument.isEmpty()) {
addMarkup(environmentArgument);
} else {
break;
}
}
}
}
} else if (command.equals("\\$") || command.equals("\\%") || command.equals("\\&")) {
addMarkup(command, command.substring(1));
Expand Down

0 comments on commit 59c6008

Please sign in to comment.