Code Languages

Markup Languages

LTEX supports checking grammar and spelling in the following markup languages. These markup languages are exactly those languages for which LTEX is enabled by default, so no further configuration is necessary. Change ltex.enabled to manually configure for which languages LTEX is enabled/disabled.

Language Language ID LTEX support
BibTEX bibtex ∗ Basic
ConTEXt context ∗ Advanced
LATEX latex ∗ Extensive
Markdown markdown Advanced
Org org ∗ Good
reStructuredText restructuredtext ∗ Good
R Sweave rsweave ∗ Good
XHTML html Basic

“Language ID” denotes the code language identifier that has to be used when changing ltex.enabled. An asterisk (∗) indicates that the language is not supported by VS Code out-of-the-box, and an additional extension that adds support for the language has to be installed in order for vscode-ltex to work (e.g., LaTeX Workshop Extension for VS Code for LATEX).

Programming Languages

In addition to markup languages, LTEX can also check comments in many popular programming languages. This is disabled by default, as LTEX is currently not able to reliably detect if a comment is source code that has been commented out. To enable checking for programming languages, add the respective code language identifier to ltex.enabled.

A line comment is only checked if its start delimiter is only preceded by whitespace on the same line and followed by a whitespace character. A block comment is only checked if its start delimiter is only preceded by whitespace on the same line and followed by a whitespace character, and its end delimiter is preceded by a whitespace character and only followed by whitespace on the same line. These rules try to minimize the amount of false positives, accounting for both comment delimiters inside code (e.g., strings) and commented out code. If you comment out code that should not be checked by LTEX, don’t insert whitespace after the start delimiter.

LTEX assumes comments are written in Markdown, except for Python, where reStructuredText is used.

There is a list of all supported programming languages below. Again, an asterisk (∗) indicates that the language is not supported by VS Code out-of-the-box, and an additional extension that adds support for the language has to be installed in order for vscode-ltex to work (e.g., MATLAB Extension for VS Code for MATLAB).

Bash/Shell Script (shellscript), C (c), C# (csharp), C++ (cpp), Clojure (clojure), CoffeeScript (coffeescript), Dart (dart), Elixir (elixier ∗) Elm (elm ∗), Erlang (erlang ∗), F# (fsharp), FORTRAN (fortran-modern ∗), Go (go), Groovy (groovy), Haskell (haskell ∗), Java (java), JavaScript (javascript), JavaScript React (javascriptreact), Julia (julia), Kotlin (kotlin ∗), Lisp (lisp ∗), Lua (lua), MATLAB (matlab ∗), Perl (perl), Perl 6 (perl6), PHP (php), PowerShell (powershell), Puppet (puppet ∗), Python (python), R (r), Ruby (ruby), Rust (rust), Scala (scala ∗), SQL (sql), Swift (swift), TypeScript (typescript), TypeScript React (typescriptreact), Verilog (verilog ∗), Visual Basic (vb)

Natural Languages

Apart from code languages like markup and programming languages, there is also the notion of natural languages. Natural languages are the languages in which the contents of documents can be written, like English or German.

By default, LTEX uses American English (en-US) when checking documents. If your documents are written in a different language, change ltex.language. In addition, there are ways to change the checking language in the middle of documents. For details, see the questions “How can I check multiple languages at once?” and “Why does LTEX check in a different language than expected?” in the FAQ.

Use a specific variant like en-US or de-DE instead of the generic language code like en or de to obtain spelling corrections (in addition to grammar corrections).

The natural languages supported by LTEX are identical to those supported by LanguageTool, which is LTEX’s backend. Therefore, the supported languages (and how well they are supported) might change if a new LTEX version comes with an updated version of LanguageTool. The following languages are currently supported:

Arabic (ar), Asturian (ast-ES), Belarusian (be-BY), Breton (br-FR), Catalan (ca-ES), Catalan (Valencian) (ca-ES-valencia), Chinese (zh-CN), Danish (da-DK), Dutch (nl), Dutch (Belgium) (nl-BE), English (en), English (Australian) (en-AU), English (Canadian) (en-CA), English (GB) (en-GB), English (New Zealand) (en-NZ), English (South African) (en-ZA), English (US) (en-US), Esperanto (eo), French (fr), Galician (gl-ES), German (de), German (Austria) (de-AT), German (Germany) (de-DE), German (Swiss) (de-CH), Greek (el-GR), Irish (ga-IE), Italian (it), Japanese (ja-JP), Khmer (km-KH), Persian (fa), Polish (pl-PL), Portuguese (pt), Portuguese (Angola preAO) (pt-AO), Portuguese (Brazil) (pt-BR), Portuguese (Moçambique preAO) (pt-MZ), Portuguese (Portugal) (pt-PT), Romanian (ro-RO), Russian (ru-RU), Simple German (de-DE-x-simple-language), Slovak (sk-SK), Slovenian (sl-SI), Spanish (es), Spanish (voseo) (es-AR), Swedish (sv), Tagalog (tl-PH), Tamil (ta-IN), Ukrainian (uk-UA)