A tool to preprocess LaTeX files. Most interestingly it can perform grammar checks on LaTeX files.
The following options are currently supported:
--expand: replace\inputcommands by their content--grammar: check for spelling mistakes and grammar errors--remove-comments: remove comments
This is programmed in OCaml, improvements and suggestions are welcome.
The --grammar flag splits the text and feeds it to a large language model. In order to for it to work, you should run a llama.cpp server with
llama-server -m your_model.ggufIn practice, Llama 3.2 3B Instruct performs reasonably fast and well (download the corresponding GGUF file here). Note that, in this way, your file is never disclosed to distant servers. The output should be a (roughly valid) markdown file containing the text as well as suggested changes. In order to speed up the process, some LaTeX markup is removed from the input.