James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.64k stars 532 forks source link

Strange syntax highlight color scheme in math environment #2956

Closed Yarakashi-Kikohshi closed 2 years ago

Yarakashi-Kikohshi commented 2 years ago

Strange syntax highlight color scheme in math environment

Preliminary questions [Required]

Disable all the other extensions except for LaTeX Workshop, restart VS Code, and check that you can not see the requested feature. [Required]

Yes

Make sure to visit the wiki FAQ before requesting a feature.

Yes

If your requested feature is with compiling a document (not having to do with finding the root file of a project), check first that you can compile manually.

Not relevant to this case.

Is your requested feature related to a problem? Please describe. [Required]

Many commands in the math environment have a #569CD6 color scheme, while some commands, such as \frac, have a #4EC9B0 color scheme. This is the same color scheme as a normal variable, and it feels very hard to see. I don't have a complete list of commands whose color scheme is #4EC9B0.

The color theme of the editor is Default Dark+.

Of course, users may be able to solve the problem by customizing editor.tokenColorCustomizations, but I think the extension needs to solve this.

FAQ # Customizing a Color Theme

Does this difference in color scheme have any meaning?

Describe the solution you'd like [Required]

If the difference in color scheme is not particularly meaningful, I would like you to align the commands in the mathematical environment with a unified color scheme #569CD6.

Additional to, I don't want the "some description" inside \text to have the same color scheme as a normal variable.

Screenshots

syntaxhighlight-inmath

Desktop [Required]

This is a very nice extension. Thank you.

jlelong commented 2 years ago

Actually, you should think in terms of scopes (see here) and not colours as grammars are only responsible for assigning scopes based on regex. Then, themes map colours to scopes.

Math environments mainly use two scopes constant.other.general.math.tex and constant.character.math.tex, hence the two different colours you see.

The content of \text{...} is indeed normal text, which justifies why it is highlighted as such. See #2215.

tamuratak commented 2 years ago

See also https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#scope-inspector