Sublime Forum

Spell checking latex

#1

In latex (I am using LatexTools, if that’s relevant) the argument of some latex commands is flagged as a typo, for example the “1em” in \hspace{1em}. Even if I choose to ignore “1em”, it will still flag \hspace{2em} and so on.

Is it possible to teach the spell checker to ignore the arguments of certain commands?

0 Likes

#2

The general way to accomplish something like that is to adjust the spelling_selector setting to tell it that it should not spell check certain things.

In this case, that would require that the syntax definition for Latex applies a specific scope to that text that you could use to adjust the setting.

I don’t use LaTeX myself, so I don’t know if that’s the case or not. One way to tell would be if the syntax highlighting can/does highlight that text differently than surrounding text; you can also put the cursor in it and use Tools > Developer > Show Scope Name and see if there’s anything in the listed scope that would distinguish that text from the surrounding text.

1 Like

#3

Thanks – I will look into this.

0 Likes

#4

Unless you are willing to edit the scopes in the LaTeX language, unfortunately, I do not see a solution for this. Consider the two functions \title{} and \hspace{}. They have exactly the same scope meta.group.brace.latex. This implies that if you turn off the spell checker for one, you turn it off for the other.

1 Like

#5

@rcopat I understand – thanks.

0 Likes