Skip to content
Dominique edited this page Nov 18, 2023 · 2 revisions

LaTeX code is not meant to be written once and then forgotten about. You, the author, will need to go back and re-read parts of your documents, modify them, and perhaps reuse commands or tricks in other documents. But, importantly, your co-authors will also have to read your LaTeX code. Messy LaTeX code, like any other messy code, is difficult, confusing, and unpleasant to read.

My approach to LaTeX is simple:

LaTeX code is no different than code in any other programming language, and should be treated as such. It should be properly indented, formatted, and readable.

Do yourself a favor and keep your coauthors happy with clean, readable, well-formatted LaTeX.

Several tools come to the rescue, and I explain below how to configure popular editors to use them:

  1. chktex is a LaTeX semantic checker, i.e., a linter that can spot potentially badly-formed LaTeX code or typographical errors.
  2. ltex is a grammar and spell checker for LaTeX.
  3. latexindent is a formatter for LaTeX, i.e., it is able to transform messy-looking LaTeX code into readable and standardized LaTeX code.

By their very nature, chktex and ltex tend to report a number of false positives. However, those are outweighed by the true positives that they catch, and that help us improve our document.

In this wiki, you will learn how to install the tools above and configure several popular editors to use them locally.

Clone this wiki locally