Sublime Forum

Latex syntax misclassified

#1

Hi

I am experimenting with sublime text 3 as a replacement for Emacs. I primarily use it to write academic papers in Latex. I noticed that my latex code is not color coded properly. In particular, within a math environment (inline or displayed) some of my greek letters are not colored the same as the others. After investigating it further, I noticed that some (such as \tau, \iota, \zeta, \eta, \theta, and \lambda) are categorized as “text.tex.latex meta.environment.math.block.be.latex meta.group.brace.latex support.function.math.tex” while the others (such as \rho ) are categorized as “text.tex.latex meta.environment.math.block.be.latex meta.group.brace.latex keyword.other.greek.math.tex”. I have also noticed that for those that are categorized as “support.function.math.tex” if I enclose them in a pair of parentheses, they will be categorized as “keyword.other.greek.math.tex”. (The greeks that are misclassified are often, but not always, followed by a subscript “_”, so the problem could be in the regular expression used to define these scopes).

It seems there is a bug somewhere in the latex.sublime-syntax file. Is there any fix for it?

Thanks,

0 Likes

#2

What build of Sublime Text are you using? Build 3140 (from https://www.sublimetext.com/3dev) has some LaTeX bug fixes beyond what build 3126 has.

The syntax is developed in the open at https://github.com/sublimehq/Packages/tree/master/LaTeX. Bugs against the latest version can be reported at https://github.com/sublimehq/Packages/issues.

0 Likes

#3

All have the syntax text.tex.latex meta.environment.math.block.be.latex keyword.other.greek.math.tex in my setup. Have you edited your syntax or use some syntax adaption (e.g. from LaTeXing)? Open the ST console ctrl+` and paste view.settings().get("syntax") this should print 'Packages/LaTeX/LaTeX.sublime-syntax'.

0 Likes

#4

Hi wbond and r-stein

Thank you for following up. My Sublime Text build is 3126. I have not edited any syntax file. I just use what it is coming with Sublime Text with LatexTools and other Latex recommended packages (those that are recommend by LatexTools) installed. After experimenting further, I noticed that the problem only occurs if the greek symbol is followed by a subscript. For example $\lambda_t$ or $\eta_i$. I will report the issue on the github page wbond recommended.

Thanks,

0 Likes

#5

Hi r-stein

I am getting those scopes by following the instruction I found here: https://www.sublimetext.com/docs/3/syntax.html. (here is the relevant part: “While editing in Sublime Text, you can check what scopes have been applied to the text under the caret by pressing control+shift+p (OSX) or ctrl+alt+shift+p (Windows and Linux).”) I do not have LaTeXing package installed, and have not edited any syntax file.

Thanks,

0 Likes

#6

It seems this has been fixed in the latest builds in this commit, it will be fixed after the next Sublime Text update and no need to create an issue :slight_smile: .

2 Likes

#7

Great. Thanks!

0 Likes